NIHVIVO-2959 improvement to data property statement retrieval by property for individuals
This commit is contained in:
parent
36a9dc22e6
commit
df5d11e60d
2 changed files with 18 additions and 7 deletions
|
@ -172,14 +172,27 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
|||
public Collection<DataPropertyStatement> getDataPropertyStatementsForIndividualByDataPropertyURI(Individual entity,
|
||||
String datapropURI) {
|
||||
Collection<DataPropertyStatement> edList = new ArrayList<DataPropertyStatement>();
|
||||
if (entity.getURI() == null) {
|
||||
if (entity.getURI() == null || datapropURI == null) {
|
||||
return edList;
|
||||
}
|
||||
// do something nicer if we're not dealing with a blank node
|
||||
Resource res = ResourceFactory.createResource(entity.getURI());
|
||||
if (!VitroVocabulary.PSEUDO_BNODE_NS.equals(entity.getNamespace())) {
|
||||
for (Literal lit : this.getDataPropertyValuesForIndividualByProperty(res.getURI(), datapropURI)) {
|
||||
DataPropertyStatement ed = new DataPropertyStatementImpl();
|
||||
fillDataPropertyStatementWithJenaLiteral(ed, lit);
|
||||
ed.setIndividualURI(entity.getURI());
|
||||
ed.setIndividual(entity);
|
||||
ed.setDatapropURI(datapropURI);
|
||||
edList.add(ed);
|
||||
}
|
||||
return edList;
|
||||
}
|
||||
// do something annoying if we are dealing with a blank node
|
||||
try {
|
||||
getOntModel().enterCriticalSection(Lock.READ);
|
||||
OntResource ontRes = (VitroVocabulary.PSEUDO_BNODE_NS.equals(entity.getNamespace()))
|
||||
? (OntResource) getOntModel().createResource(new AnonId(entity.getLocalName())).as(OntResource.class)
|
||||
: getOntModel().getOntResource(entity.getURI());
|
||||
OntResource ontRes = (OntResource) getOntModel().createResource(
|
||||
new AnonId(entity.getLocalName())).as(OntResource.class);
|
||||
if (ontRes == null) {
|
||||
return edList;
|
||||
}
|
||||
|
|
|
@ -129,9 +129,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
String getStatements =
|
||||
"CONSTRUCT " +
|
||||
"{ <"+individualURI+"> <" + RDFS.label.getURI() +
|
||||
"> ?ooo. \n" +
|
||||
"<"+individualURI+"> <" + VitroVocabulary.MONIKER +
|
||||
"> ?moniker \n" +
|
||||
"> ?ooo \n" +
|
||||
"} WHERE {" +
|
||||
"{ <"+individualURI+"> <" + RDFS.label.getURI() +
|
||||
"> ?ooo } \n" +
|
||||
|
|
Loading…
Add table
Reference in a new issue