[VIVO-1641] REPLACE jena afn with cross-platform regex (#105)

Resolves https://jira.duraspace.org/browse/VIVO-1641
This commit is contained in:
alessandroGalasso 2019-03-20 18:22:14 +01:00 committed by Andrew Woods
parent 12d703b4c8
commit 74b8f16aa2
6 changed files with 7 additions and 19 deletions

View file

@ -33,8 +33,6 @@ public class VitroVocabulary {
public static final String OWL_ONTOLOGY = OWL+"Ontology";
public static final String OWL_THING = OWL+"Thing";
public static final String AFN = "http://jena.apache.org/ARQ/function#";
public static final String label = vitroURI + "label";
// an OWL DL-compatible surrogate for rdf:value for use with boxing idiom

View file

@ -1164,13 +1164,6 @@ public class JenaBaseDao extends JenaBaseDaoCon {
String describeQueryStr = "DESCRIBE <" + res.getURI() + ">" ;
// ? "PREFIX afn: <http://jena.apache.org/ARQ/function#> \n\n" +
// "DESCRIBE ?bnode \n" +
// "WHERE { \n" +
// " FILTER(afn:bnode(?bnode) = \"" + res.getId().toString() + "\")\n" +
// " ?bnode ?p ?o \n" +
// "}"
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
qe.execDescribe(temp);

View file

@ -258,8 +258,7 @@ public class JenaModelUtils {
dataset.getLock().enterCriticalSection(Lock.READ);
try {
StringBuilder buff = new StringBuilder();
buff.append("PREFIX afn: <http://jena.apache.org/ARQ/function#> \n")
.append("CONSTRUCT { \n").append(" ?res <").append(property.getURI()).append("> ?o } WHERE { \n");
buff.append("CONSTRUCT { \n").append(" ?res <").append(property.getURI()).append("> ?o } WHERE { \n");
if (graphURI != null) {
buff.append(" GRAPH ").append(graphURI).append(" { \n");
}
@ -289,7 +288,6 @@ public class JenaModelUtils {
StringBuilder describeQueryStrBuff = new StringBuilder()
.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n")
.append("PREFIX afn: <http://jena.apache.org/ARQ/function#> \n")
.append("DESCRIBE ?res WHERE { \n");
if (graphURI != null) {
describeQueryStrBuff.append("GRAPH ").append(graphURI).append("{ \n");
@ -319,7 +317,7 @@ public class JenaModelUtils {
// exclude resources in the Vitro internal namespace or in the
// OWL namespace, but allow all others
buff
.append(" FILTER (afn:namespace(?res) != \"")
.append(" FILTER (REPLACE(STR(?res),\"^(.*)(#)(.*)$\", \"$1$2\") != \"")
.append("http://www.w3.org/2002/07/owl#")
.append("\") \n")
.append(" FILTER (?res != <")

View file

@ -55,7 +55,6 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
protected static final String FAUX_PROPERTY_FLAG = "FAUX";
private static final Map<String, String> NAMESPACES = new HashMap<String, String>() {{
put("afn", VitroVocabulary.AFN);
put("owl", VitroVocabulary.OWL);
put("rdf", VitroVocabulary.RDF);
put("rdfs", VitroVocabulary.RDFS);

View file

@ -7,7 +7,7 @@
<list-view-config>
<query-select>
PREFIX afn: &lt;http://jena.apache.org/ARQ/function#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
@ -17,7 +17,7 @@
?localName
WHERE {
?subject ?property ?object .
LET (?localName := afn:localname(?object))
LET (?localName := REPLACE(STR(?object),"^.*(#)(.*)$", "$2"))
OPTIONAL {
<precise-subquery>?subject ?property ?object .</precise-subquery>
@ -33,7 +33,7 @@
# Aug 9-10, 2011.
# ?subclass vitro:inClassGroup ?classgroup
}
FILTER ( afn:namespace(?subclass) != "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" )
FILTER ( REPLACE(STR(?subclass),"^(.*)(#)(.*)$", "$1$2") != "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#" )
</collated>
} ORDER BY <collated> ?subclass </collated> ASC( ?label ) ASC( ?label ) ASC( ?localName )

View file

@ -8,10 +8,10 @@
<list-view-config>
<query-select>
PREFIX display: &lt;http://vitro.mannlib.cornell.edu/ontologies/display/1.1#&gt;
PREFIX afn: &lt;http://jena.apache.org/ARQ/function#&gt;
SELECT ?menuItem
(afn:localname(?menuItem) AS ?menuItemName)
(REPLACE(STR(?menuItem),"^.*(#)(.*)$", "$2") AS ?menuItemName)
?linkText
?menuPosition
WHERE {