private UID getContext(Class<?> clazz, @Nullable ID subject, @Nullable UID defaultContext) { UID contextUID = configuration.getMappedClass(clazz).getContext(); if (contextUID != null) { return contextUID; } else { return defaultContext; } }
@Override @Nullable public UID createURI(Object instance) { Class<?> clazz = instance.getClass(); UID context = getMappedClass(clazz).getContext(); if (context != null) { return new UID(context.getId() + "#", clazz.getSimpleName() + "-" + UUID.randomUUID().toString()); } return null; }
@Override public UID createURI(Object instance) { Class<?> clazz = instance.getClass(); UID context = getMappedClass(clazz).getContext(); if (context != null) { return new UID(context.getId() + "#", clazz.getSimpleName() + "-" + UUID.randomUUID().toString()); } return null; }
private <T> void findInstances(Class<T> clazz, UID type, final Set<T> instances) { MappedClass mappedClass = configuration.getMappedClass(clazz); boolean polymorphic = isPolymorphic(mappedClass); UID context = mappedClass.getContext();
private <T> void loadAll(Class<T> clazz, Collection<ID> ids, Set<ID> handled) { MappedClass mappedClass = configuration.getMappedClass(clazz); boolean polymorphic = isPolymorphic(mappedClass); UID context = mappedClass.getContext();
UID context = mappedClass.getContext();
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()); } }
private RDFQuery createQuery(MappedClass mappedClass, @Nullable UID type, boolean polymorphic) { RDFQuery query = new RDFQueryImpl(connection); if (type != null) { query.where(Blocks.S_TYPE); if (mappedClass.getContext() != null) { query.set(QNODE.typeContext, mappedClass.getContext()); } if (polymorphic) { Collection<UID> types = ontology.getSubtypes(type); if (types.size() > 1 && connection.getInferenceOptions().subClassOf()) { query.where(QNODE.type.in(types)); } else { query.set(QNODE.type, type); } } else { query.set(QNODE.type, type); } } query.where(Blocks.SPOC); if (!polymorphic && mappedClass.getDynamicProperties().isEmpty() && mappedClass.getMappedPredicates().size() < 5) { query.where(QNODE.p.in(mappedClass.getMappedPredicates())); } return query; }
MappedClass mappedClass = configuration.getMappedClass(path.getType()); if (mappedClass.getClass() != null) { pathToContext.put(path, mappedClass.getContext());