From dc3fa33402d24a8325530307b405105e65bc87d6 Mon Sep 17 00:00:00 2001 From: j2blake Date: Tue, 1 Oct 2013 15:52:21 -0400 Subject: [PATCH] VIVO-305 Look in the full model for the matching property. Looking in the abox means only looking in kb-2 and its sub-models (filegraphs). Looking in the full model means abox and tbox and all named graphs. --- .../webapp/dao/jena/IndividualDaoSDB.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java index 6ddec9a32..4e0d11b77 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java @@ -320,12 +320,14 @@ public class IndividualDaoSDB extends IndividualDaoJena { */ @Override public List getIndividualsByDataProperty(String dataPropertyUri, - String value){ + String value){ + OntModel fullModel = getOntModelSelector().getFullModel(); + Property prop = null; if( RDFS.label.getURI().equals( dataPropertyUri )){ prop = RDFS.label; }else{ - prop = getOntModel().getProperty(dataPropertyUri); + prop = fullModel.getProperty(dataPropertyUri); } if( prop == null ) { @@ -340,20 +342,20 @@ public class IndividualDaoSDB extends IndividualDaoJena { return Collections.emptyList(); } - Literal litv1 = getOntModel().createLiteral(value); - Literal litv2 = getOntModel().createTypedLiteral(value); + Literal litv1 = fullModel.createLiteral(value); + Literal litv2 = fullModel.createTypedLiteral(value); //warning: this assumes that any language tags will be EN - Literal litv3 = getOntModel().createLiteral(value,"EN"); + Literal litv3 = fullModel.createLiteral(value,"EN"); HashMap individualsMap = new HashMap(); - getOntModel().enterCriticalSection(Lock.READ); + fullModel.enterCriticalSection(Lock.READ); int count = 0; try{ StmtIterator stmts - = getOntModel().listStatements((Resource)null, prop, litv1); + = fullModel.listStatements((Resource)null, prop, litv1); while(stmts.hasNext()){ count++; Statement stmt = stmts.nextStatement(); @@ -377,7 +379,7 @@ public class IndividualDaoSDB extends IndividualDaoJena { } } - stmts = getOntModel().listStatements((Resource)null, prop, litv2); + stmts = fullModel.listStatements((Resource)null, prop, litv2); while(stmts.hasNext()){ count++; Statement stmt = stmts.nextStatement(); @@ -401,7 +403,7 @@ public class IndividualDaoSDB extends IndividualDaoJena { } } - stmts = getOntModel().listStatements((Resource)null, prop, litv3); + stmts = fullModel.listStatements((Resource)null, prop, litv3); while(stmts.hasNext()){ count++; Statement stmt = stmts.nextStatement(); @@ -425,7 +427,7 @@ public class IndividualDaoSDB extends IndividualDaoJena { } } } finally { - getOntModel().leaveCriticalSection(); + fullModel.leaveCriticalSection(); } List rv = new ArrayList(individualsMap.size());