From 2935dc1b23919efd80f3978d221de8ab3b695f53 Mon Sep 17 00:00:00 2001 From: bjl23 Date: Mon, 20 Dec 2010 20:53:18 +0000 Subject: [PATCH] improvement to direct/indirect type retrieval in IndividualSDB --- .../vitro/webapp/dao/jena/IndividualSDB.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualSDB.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualSDB.java index acaeb7182..83c5affce 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualSDB.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualSDB.java @@ -142,8 +142,8 @@ public class IndividualSDB extends IndividualImpl implements Individual { "UNION { <" + individualURI+"> <" + VitroVocabulary.MONIKER + "> ?moniker } \n" + - "} \n" + - "} UNION { GRAPH { <" + "} } \n" + + "UNION { GRAPH { <" + individualURI + "> a ?type } } \n" + "}"; model = QueryExecutionFactory.create( @@ -1060,15 +1060,14 @@ public class IndividualSDB extends IndividualImpl implements Individual { private List getMyVClasses(boolean direct) { List vClassList = new ArrayList(); Model tempModel = null; - if (ind.getModel().size() > 0) { + if (ind.getModel().contains((Resource) null, RDF.type, (RDFNode) null)){ tempModel = ind.getModel(); - } - else { - String getTypes = + } else { + String getTypes = "CONSTRUCT{ <" + this.individualURI + "> <" + RDF.type + "> ?types }\n" + "WHERE{ GRAPH " + - ((true) + ((direct) ? "" : "?g") + " { <" + this.individualURI +"> <" +RDF.type+ "> ?types \n" + @@ -1082,7 +1081,7 @@ public class IndividualSDB extends IndividualImpl implements Individual { } finally { dataset.getLock().leaveCriticalSection(); w.close(); - } + } } StmtIterator stmtItr = tempModel.listStatements( (Resource) null, RDF.type, (RDFNode) null);