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.
This commit is contained in:
j2blake 2013-10-01 15:52:21 -04:00
parent 1db72b3397
commit dc3fa33402

View file

@ -321,11 +321,13 @@ public class IndividualDaoSDB extends IndividualDaoJena {
@Override @Override
public List<Individual> getIndividualsByDataProperty(String dataPropertyUri, public List<Individual> getIndividualsByDataProperty(String dataPropertyUri,
String value){ String value){
OntModel fullModel = getOntModelSelector().getFullModel();
Property prop = null; Property prop = null;
if( RDFS.label.getURI().equals( dataPropertyUri )){ if( RDFS.label.getURI().equals( dataPropertyUri )){
prop = RDFS.label; prop = RDFS.label;
}else{ }else{
prop = getOntModel().getProperty(dataPropertyUri); prop = fullModel.getProperty(dataPropertyUri);
} }
if( prop == null ) { if( prop == null ) {
@ -340,20 +342,20 @@ public class IndividualDaoSDB extends IndividualDaoJena {
return Collections.emptyList(); return Collections.emptyList();
} }
Literal litv1 = getOntModel().createLiteral(value); Literal litv1 = fullModel.createLiteral(value);
Literal litv2 = getOntModel().createTypedLiteral(value); Literal litv2 = fullModel.createTypedLiteral(value);
//warning: this assumes that any language tags will be EN //warning: this assumes that any language tags will be EN
Literal litv3 = getOntModel().createLiteral(value,"EN"); Literal litv3 = fullModel.createLiteral(value,"EN");
HashMap<String,Individual> individualsMap = HashMap<String,Individual> individualsMap =
new HashMap<String, Individual>(); new HashMap<String, Individual>();
getOntModel().enterCriticalSection(Lock.READ); fullModel.enterCriticalSection(Lock.READ);
int count = 0; int count = 0;
try{ try{
StmtIterator stmts StmtIterator stmts
= getOntModel().listStatements((Resource)null, prop, litv1); = fullModel.listStatements((Resource)null, prop, litv1);
while(stmts.hasNext()){ while(stmts.hasNext()){
count++; count++;
Statement stmt = stmts.nextStatement(); 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()){ while(stmts.hasNext()){
count++; count++;
Statement stmt = stmts.nextStatement(); 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()){ while(stmts.hasNext()){
count++; count++;
Statement stmt = stmts.nextStatement(); Statement stmt = stmts.nextStatement();
@ -425,7 +427,7 @@ public class IndividualDaoSDB extends IndividualDaoJena {
} }
} }
} finally { } finally {
getOntModel().leaveCriticalSection(); fullModel.leaveCriticalSection();
} }
List<Individual> rv = new ArrayList(individualsMap.size()); List<Individual> rv = new ArrayList(individualsMap.size());