if (!polymorphic && !mappedClass.getInvMappedPredicates().isEmpty()) { inverseProps = getInvProperties(mappedClass, directProps.keySet());
private Map<ID, Multimap<UID, STMT>> getInvProperties(MappedClass mappedClass, Collection<ID> objects) { RDFQuery query = new RDFQueryImpl(connection); query.where( Blocks.SPOC, QNODE.p.in(mappedClass.getInvMappedPredicates())); if (objects.size() == 1) { query.set(QNODE.o, objects.iterator().next()); } else { query.where(QNODE.o.in(objects)); } CloseableIterator<STMT> stmts = query.construct(Blocks.SPOC); Map<ID, Multimap<UID, STMT>> invProperties = getPropertiesMap(stmts, true); for (ID id : objects) { if (!invProperties.containsKey(id)) { invProperties.put(id, MultimapFactory.<UID, STMT> create()); } } return invProperties; }
if (!polymorphic && !mappedClass.getInvMappedPredicates().isEmpty()) { inverseProps = getInvProperties(mappedClass, directProps.keySet());
if (!polymorphic && !mappedClass.getInvMappedPredicates().isEmpty()) { inverseProps = getInvProperties(mappedClass, directProps.keySet());
private Multimap<UID, STMT> getInvProperties(ID object, MappedClass mappedClass) { Multimap<UID, STMT> properties = MultimapFactory.<UID, STMT> create(); if (logger.isDebugEnabled()) { logger.debug("query for inverse properties of " + object); } RDFQuery query = new RDFQueryImpl(connection); CloseableIterator<STMT> stmts = query.where( Blocks.SPOC, QNODE.p.in(mappedClass.getInvMappedPredicates())) .set(QNODE.o, object) .construct(Blocks.SPOC); try { while (stmts.hasNext()) { STMT stmt = stmts.next(); properties.put(stmt.getPredicate(), stmt); } } finally { stmts.close(); } return properties; }
if (mappedClass.getInvMappedPredicates().isEmpty()) { inverse = MultimapFactory.<UID, STMT> create(); } else {