merging basic union class support to trunk
This commit is contained in:
parent
881c937594
commit
14d6dc9b70
1 changed files with 18 additions and 9 deletions
|
@ -24,6 +24,7 @@ import org.joda.time.DateTime;
|
||||||
import com.hp.hpl.jena.ontology.OntClass;
|
import com.hp.hpl.jena.ontology.OntClass;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntResource;
|
import com.hp.hpl.jena.ontology.OntResource;
|
||||||
|
import com.hp.hpl.jena.ontology.UnionClass;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
import com.hp.hpl.jena.query.QueryExecution;
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
|
@ -153,15 +154,23 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
|
|
||||||
getOntModel().enterCriticalSection(Lock.READ);
|
getOntModel().enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
StmtIterator stmtIt = getOntModel().listStatements((Resource) null, RDF.type, theClass);
|
if (theClass.isAnon() && theClass.canAs(UnionClass.class)) {
|
||||||
try {
|
UnionClass u = (UnionClass) theClass.as(UnionClass.class);
|
||||||
while (stmtIt.hasNext()) {
|
for (OntClass operand : u.listOperands().toList()) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
VClass vc = new VClassJena(operand, getWebappDaoFactory());
|
||||||
OntResource ind = (OntResource) stmt.getSubject().as(OntResource.class);
|
ents.addAll(getIndividualsByVClass(vc));
|
||||||
ents.add(new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
}
|
||||||
}
|
} else {
|
||||||
} finally {
|
StmtIterator stmtIt = getOntModel().listStatements((Resource) null, RDF.type, theClass);
|
||||||
stmtIt.close();
|
try {
|
||||||
|
while (stmtIt.hasNext()) {
|
||||||
|
Statement stmt = stmtIt.nextStatement();
|
||||||
|
OntResource ind = (OntResource) stmt.getSubject().as(OntResource.class);
|
||||||
|
ents.add(new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
stmtIt.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
getOntModel().leaveCriticalSection();
|
getOntModel().leaveCriticalSection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue