private Multimap<UID, STMT> getProperties(ID subject, MappedClass mappedClass, boolean polymorphic) {
Multimap<UID, STMT> properties = MultimapFactory.<UID, STMT> create();
if (mappedClass.getDynamicProperties().isEmpty()
&& !polymorphic
&& mappedClass.getMappedPredicates().size() < 5) {
if (logger.isDebugEnabled()) {
logger.debug("query for properties of " + subject);
}
RDFQuery query = new RDFQueryImpl(connection);
CloseableIterator<STMT> stmts = query.where(
Blocks.SPOC,
QNODE.p.in(mappedClass.getMappedPredicates()))
.set(QNODE.s, subject)
.construct(Blocks.SPOC);
try {
while (stmts.hasNext()) {
STMT stmt = stmts.next();
properties.put(stmt.getPredicate(), stmt);
}
} finally {
stmts.close();
}
} else {
for (STMT stmt : findStatements(subject, null, null, null, true)) {
properties.put(stmt.getPredicate(), stmt);
}
}
return properties;
}