improvement to direct/indirect type retrieval in IndividualSDB

This commit is contained in:
bjl23 2010-12-20 20:53:18 +00:00
parent 900caff315
commit 2935dc1b23

View file

@ -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" +