public QID id() { if (id == null) { id = new QID(getName()); } return id; }
public com.mysema.rdfbean.model.QID _id() { if (id == null) id = new com.mysema.rdfbean.model.QID(PathMetadata.forProperty(this,"id")); return id; }
private Block handleRootPath(Path<?> path, Filters filters) { MappedClass mappedClass = configuration.getMappedClass(path.getType()); UID rdfType = mappedClass.getUID(); UID context = mappedClass.getContext(); QID pathNode = new QID(path.toString()); pathToMapped.put(path, pathNode); if (rdfType != null) { Collection<UID> types = ontology.getSubtypes(rdfType); if (types.size() > 1 && inferenceOptions.subClassOf()) { QID type = new QID(path + "_type"); filters.add(type.in(types)); return Blocks.pattern(pathNode, RDF.type, type); } else { if (context != null) { pathToContext.put(path, context); return Blocks.pattern(pathNode, RDF.type, rdfType, context); } else { return Blocks.pattern(pathNode, RDF.type, rdfType); } } } else { throw new IllegalArgumentException("No types mapped against " + path.getType().getName()); } }
@Test public void Complex() { QID u = new QID("u"), u2 = new QID("u2"); QLIT label = new QLIT("label"); UID User = new UID(TEST.NS, "User"); ID id = new BID(), id2 = new BID(), id3 = new BID(); connection().update(null, Arrays.asList( new STMT(id, RDF.type, User), new STMT(id2, RDF.type, User), new STMT(id3, RDF.type, User), new STMT(id, RDFS.label, new LIT("x")), new STMT(id2, RDFS.label, new LIT("x")), new STMT(id3, RDFS.label, new LIT("y")))); CloseableIterator<Map<String, NODE>> iterator = query().where( Blocks.pattern(u, RDF.type, User), Blocks.pattern(u2, RDF.type, User), Blocks.pattern(u2, RDFS.label, label), Blocks.pattern(u, RDFS.label, label), u.ne(u2) ).select(u, u2); List<Map<String, NODE>> list = IteratorAdapter.asList(iterator); assertEquals(2, list.size()); }