}
Identity consistsOf = findExternal(tg, "http://www.simantics.org/Layer0-1.1/ConsistsOf");
Identity hasName = findExternal(tg, "http://www.simantics.org/Layer0-1.1/HasName");
- for (int i = 0; i < tg.statements.length; i += 4) {
- if (tg.statements[i] == parentResource) {
- if (tg.statements[i + 1] == consistsOf.resource) {
- Identity identity = getIdentity(tg, tg.statements[i + 3]);
- if (identity != null) {
- if (identity.definition instanceof Internal) {
- Internal internal = (Internal) identity.definition;
- result.put(internal.name, identity);
- }
- } else {
- int possibleNameResource = getPossibleObject2(tg, tg.statements[i + 3], hasName);
- if (possibleNameResource != NOT_FOUND) {
- Value value = findValue(tg, possibleNameResource);
- if (value != null) {
- try {
- String name = (String) value.value.getValue(Bindings.STRING);
- result.put(name, new Identity(tg.statements[i + 3], new Internal(tg.statements[i], name)));
- } catch (AdaptException e) {
- e.printStackTrace();
+ if(consistsOf != null && hasName != null) {
+ for (int i = 0; i < tg.statements.length; i += 4) {
+ if (tg.statements[i] == parentResource) {
+ if (tg.statements[i + 1] == consistsOf.resource) {
+ Identity identity = getIdentity(tg, tg.statements[i + 3]);
+ if (identity != null) {
+ if (identity.definition instanceof Internal) {
+ Internal internal = (Internal) identity.definition;
+ result.put(internal.name, identity);
+ }
+ } else {
+ int possibleNameResource = getPossibleObject2(tg, tg.statements[i + 3], hasName);
+ if (possibleNameResource != NOT_FOUND) {
+ Value value = findValue(tg, possibleNameResource);
+ if (value != null) {
+ try {
+ String name = (String) value.value.getValue(Bindings.STRING);
+ result.put(name, new Identity(tg.statements[i + 3], new Internal(tg.statements[i], name)));
+ } catch (AdaptException e) {
+ e.printStackTrace();
+ }
}
}
}