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

@ -320,12 +320,14 @@ public class IndividualDaoSDB extends IndividualDaoJena {
*/
@Override
public List<Individual> 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<String,Individual> individualsMap =
new HashMap<String, Individual>();
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<Individual> rv = new ArrayList(individualsMap.size());