improvement to direct/indirect type retrieval in IndividualSDB
This commit is contained in:
parent
900caff315
commit
2935dc1b23
1 changed files with 7 additions and 8 deletions
|
@ -142,8 +142,8 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
"UNION { <" +
|
"UNION { <" +
|
||||||
individualURI+"> <" + VitroVocabulary.MONIKER +
|
individualURI+"> <" + VitroVocabulary.MONIKER +
|
||||||
"> ?moniker } \n" +
|
"> ?moniker } \n" +
|
||||||
"} \n" +
|
"} } \n" +
|
||||||
"} UNION { GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> { <"
|
"UNION { GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> { <"
|
||||||
+ individualURI + "> a ?type } } \n" +
|
+ individualURI + "> a ?type } } \n" +
|
||||||
"}";
|
"}";
|
||||||
model = QueryExecutionFactory.create(
|
model = QueryExecutionFactory.create(
|
||||||
|
@ -1060,15 +1060,14 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
private List<VClass> getMyVClasses(boolean direct) {
|
private List<VClass> getMyVClasses(boolean direct) {
|
||||||
List<VClass> vClassList = new ArrayList<VClass>();
|
List<VClass> vClassList = new ArrayList<VClass>();
|
||||||
Model tempModel = null;
|
Model tempModel = null;
|
||||||
if (ind.getModel().size() > 0) {
|
if (ind.getModel().contains((Resource) null, RDF.type, (RDFNode) null)){
|
||||||
tempModel = ind.getModel();
|
tempModel = ind.getModel();
|
||||||
}
|
} else {
|
||||||
else {
|
String getTypes =
|
||||||
String getTypes =
|
|
||||||
"CONSTRUCT{ <" + this.individualURI + "> <" + RDF.type +
|
"CONSTRUCT{ <" + this.individualURI + "> <" + RDF.type +
|
||||||
"> ?types }\n" +
|
"> ?types }\n" +
|
||||||
"WHERE{ GRAPH " +
|
"WHERE{ GRAPH " +
|
||||||
((true)
|
((direct)
|
||||||
? "<http://vitro.mannlib.cornell.edu/default/vitro-kb-2>"
|
? "<http://vitro.mannlib.cornell.edu/default/vitro-kb-2>"
|
||||||
: "?g")
|
: "?g")
|
||||||
+ " { <" + this.individualURI +"> <" +RDF.type+ "> ?types \n" +
|
+ " { <" + this.individualURI +"> <" +RDF.type+ "> ?types \n" +
|
||||||
|
@ -1082,7 +1081,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StmtIterator stmtItr = tempModel.listStatements(
|
StmtIterator stmtItr = tempModel.listStatements(
|
||||||
(Resource) null, RDF.type, (RDFNode) null);
|
(Resource) null, RDF.type, (RDFNode) null);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue