fixing getAllPropInstByVClass() to look at TBox model

This commit is contained in:
bjl23 2010-11-29 19:14:47 +00:00
parent a9523b0e8d
commit 3323f9cd53

View file

@ -147,15 +147,17 @@ public class PropertyInstanceDaoJena extends JenaBaseDao implements
} }
allSuperclassURIs.addAll(vcDao.getAllSuperClassURIs(classURI)); allSuperclassURIs.addAll(vcDao.getAllSuperClassURIs(classURI));
OntModel ontModel = getOntModelSelector().getTBoxModel();
try { try {
getOntModel().enterCriticalSection(Lock.READ); ontModel.enterCriticalSection(Lock.READ);
Set<ObjectProperty> applicableProperties = new HashSet<ObjectProperty>(); Set<ObjectProperty> applicableProperties = new HashSet<ObjectProperty>();
try { try {
for (String VClassURI : allSuperclassURIs) { for (String VClassURI : allSuperclassURIs) {
OntClass ontClass = getOntClass(getOntModel(),VClassURI); OntClass ontClass = getOntClass(ontModel,VClassURI);
if (ontClass != null) { if (ontClass != null) {
if (ontClass.isRestriction()) { if (ontClass.isRestriction()) {
// TODO: check if restriction is something like // TODO: check if restriction is something like
@ -176,7 +178,7 @@ public class PropertyInstanceDaoJena extends JenaBaseDao implements
} }
HashSet allSuperclassURIset = new HashSet(allSuperclassURIs); HashSet allSuperclassURIset = new HashSet(allSuperclassURIs);
Iterator ops = getOntModel().listObjectProperties(); Iterator ops = ontModel.listObjectProperties();
while (ops.hasNext()) { while (ops.hasNext()) {
ObjectProperty op = (ObjectProperty) ops.next(); ObjectProperty op = (ObjectProperty) ops.next();
if (op.getNameSpace() != null && !NONUSER_NAMESPACES.contains(op.getNameSpace()) ) { if (op.getNameSpace() != null && !NONUSER_NAMESPACES.contains(op.getNameSpace()) ) {
@ -220,7 +222,7 @@ public class PropertyInstanceDaoJena extends JenaBaseDao implements
} }
} finally { } finally {
getOntModel().leaveCriticalSection(); ontModel.leaveCriticalSection();
} }
Collections.sort(propInsts, new PropInstSorter()); Collections.sort(propInsts, new PropInstSorter());