[VIVO-1641] REPLACE jena afn with cross-platform regex (#105)
Resolves https://jira.duraspace.org/browse/VIVO-1641
This commit is contained in:
parent
12d703b4c8
commit
74b8f16aa2
6 changed files with 7 additions and 19 deletions
|
@ -33,8 +33,6 @@ public class VitroVocabulary {
|
||||||
public static final String OWL_ONTOLOGY = OWL+"Ontology";
|
public static final String OWL_ONTOLOGY = OWL+"Ontology";
|
||||||
public static final String OWL_THING = OWL+"Thing";
|
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";
|
public static final String label = vitroURI + "label";
|
||||||
|
|
||||||
// an OWL DL-compatible surrogate for rdf:value for use with boxing idiom
|
// an OWL DL-compatible surrogate for rdf:value for use with boxing idiom
|
||||||
|
|
|
@ -1164,13 +1164,6 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
|
|
||||||
String describeQueryStr = "DESCRIBE <" + res.getURI() + ">" ;
|
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);
|
Query describeQuery = QueryFactory.create(describeQueryStr, Syntax.syntaxARQ);
|
||||||
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
|
QueryExecution qe = QueryExecutionFactory.create(describeQuery, ontModel);
|
||||||
qe.execDescribe(temp);
|
qe.execDescribe(temp);
|
||||||
|
|
|
@ -258,8 +258,7 @@ public class JenaModelUtils {
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
try {
|
try {
|
||||||
StringBuilder buff = new StringBuilder();
|
StringBuilder buff = new StringBuilder();
|
||||||
buff.append("PREFIX afn: <http://jena.apache.org/ARQ/function#> \n")
|
buff.append("CONSTRUCT { \n").append(" ?res <").append(property.getURI()).append("> ?o } WHERE { \n");
|
||||||
.append("CONSTRUCT { \n").append(" ?res <").append(property.getURI()).append("> ?o } WHERE { \n");
|
|
||||||
if (graphURI != null) {
|
if (graphURI != null) {
|
||||||
buff.append(" GRAPH ").append(graphURI).append(" { \n");
|
buff.append(" GRAPH ").append(graphURI).append(" { \n");
|
||||||
}
|
}
|
||||||
|
@ -289,7 +288,6 @@ public class JenaModelUtils {
|
||||||
|
|
||||||
StringBuilder describeQueryStrBuff = new StringBuilder()
|
StringBuilder describeQueryStrBuff = new StringBuilder()
|
||||||
.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n")
|
.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");
|
.append("DESCRIBE ?res WHERE { \n");
|
||||||
if (graphURI != null) {
|
if (graphURI != null) {
|
||||||
describeQueryStrBuff.append("GRAPH ").append(graphURI).append("{ \n");
|
describeQueryStrBuff.append("GRAPH ").append(graphURI).append("{ \n");
|
||||||
|
@ -319,7 +317,7 @@ public class JenaModelUtils {
|
||||||
// exclude resources in the Vitro internal namespace or in the
|
// exclude resources in the Vitro internal namespace or in the
|
||||||
// OWL namespace, but allow all others
|
// OWL namespace, but allow all others
|
||||||
buff
|
buff
|
||||||
.append(" FILTER (afn:namespace(?res) != \"")
|
.append(" FILTER (REPLACE(STR(?res),\"^(.*)(#)(.*)$\", \"$1$2\") != \"")
|
||||||
.append("http://www.w3.org/2002/07/owl#")
|
.append("http://www.w3.org/2002/07/owl#")
|
||||||
.append("\") \n")
|
.append("\") \n")
|
||||||
.append(" FILTER (?res != <")
|
.append(" FILTER (?res != <")
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
protected static final String FAUX_PROPERTY_FLAG = "FAUX";
|
protected static final String FAUX_PROPERTY_FLAG = "FAUX";
|
||||||
|
|
||||||
private static final Map<String, String> NAMESPACES = new HashMap<String, String>() {{
|
private static final Map<String, String> NAMESPACES = new HashMap<String, String>() {{
|
||||||
put("afn", VitroVocabulary.AFN);
|
|
||||||
put("owl", VitroVocabulary.OWL);
|
put("owl", VitroVocabulary.OWL);
|
||||||
put("rdf", VitroVocabulary.RDF);
|
put("rdf", VitroVocabulary.RDF);
|
||||||
put("rdfs", VitroVocabulary.RDFS);
|
put("rdfs", VitroVocabulary.RDFS);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<list-view-config>
|
<list-view-config>
|
||||||
<query-select>
|
<query-select>
|
||||||
PREFIX afn: <http://jena.apache.org/ARQ/function#>
|
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
?localName
|
?localName
|
||||||
WHERE {
|
WHERE {
|
||||||
?subject ?property ?object .
|
?subject ?property ?object .
|
||||||
LET (?localName := afn:localname(?object))
|
LET (?localName := REPLACE(STR(?object),"^.*(#)(.*)$", "$2"))
|
||||||
|
|
||||||
OPTIONAL {
|
OPTIONAL {
|
||||||
<precise-subquery>?subject ?property ?object .</precise-subquery>
|
<precise-subquery>?subject ?property ?object .</precise-subquery>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
# Aug 9-10, 2011.
|
# Aug 9-10, 2011.
|
||||||
# ?subclass vitro:inClassGroup ?classgroup
|
# ?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>
|
</collated>
|
||||||
|
|
||||||
} ORDER BY <collated> ?subclass </collated> ASC( ?label ) ASC( ?label ) ASC( ?localName )
|
} ORDER BY <collated> ?subclass </collated> ASC( ?label ) ASC( ?label ) ASC( ?localName )
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
<list-view-config>
|
<list-view-config>
|
||||||
<query-select>
|
<query-select>
|
||||||
PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#>
|
PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#>
|
||||||
PREFIX afn: <http://jena.apache.org/ARQ/function#>
|
|
||||||
|
|
||||||
SELECT ?menuItem
|
SELECT ?menuItem
|
||||||
(afn:localname(?menuItem) AS ?menuItemName)
|
(REPLACE(STR(?menuItem),"^.*(#)(.*)$", "$2") AS ?menuItemName)
|
||||||
?linkText
|
?linkText
|
||||||
?menuPosition
|
?menuPosition
|
||||||
WHERE {
|
WHERE {
|
||||||
|
|
Loading…
Add table
Reference in a new issue