From d82f7a118f4f0e92ce4b3699ad217d4afe59bf6b Mon Sep 17 00:00:00 2001 From: brianjlowe Date: Thu, 1 Dec 2011 14:46:50 +0000 Subject: [PATCH] NIHVIVO-3377 ensure owl:Ontology resource is included in export when exported ontology uses a hash namespace --- .../mannlib/vitro/webapp/dao/jena/JenaModelUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java index 03b269620..711360d42 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/JenaModelUtils.java @@ -141,13 +141,14 @@ public class JenaModelUtils { // if we're using to a hash namespace, the URI of the Ontology resource will be // that namespace minus the final hash mark. if ( namespace != null && namespace.endsWith("#") ) { - queryStrList.add( makeDescribeQueryStr( OWL.Ontology.getURI(), namespace.substring(0,namespace.length()-2), graphURI ) ); + queryStrList.add( makeDescribeQueryStr( OWL.Ontology.getURI(), namespace.substring(0,namespace.length()-1), graphURI ) ); } else { queryStrList.add( makeDescribeQueryStr( OWL.Ontology.getURI(), namespace, graphURI ) ); } // Perform the SPARQL DESCRIBEs for ( String queryStr : queryStrList ) { + log.info(queryStr + "\n\n"); Query tboxSparqlQuery = QueryFactory.create(queryStr); QueryExecution qe = QueryExecutionFactory.create(tboxSparqlQuery,dataset); try { @@ -303,9 +304,9 @@ public class JenaModelUtils { } else { // limit resources to those in the supplied namespace buff - .append(" FILTER (afn:namespace(?res) = \"") + .append(" FILTER (regex(str(?res), \"^") .append(namespace) - .append("\") \n"); + .append("\")) \n"); } return buff.toString(); }