Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/101_shacl_w3c_tests
Browse files Browse the repository at this point in the history
* develop:
  eclipse-rdf4j/rdf4j#1362 normalised targets with SPARQL

Signed-off-by: Håvard Ottestad <hmottestad@gmail.com>
  • Loading branch information
hmottestad committed Mar 25, 2019
2 parents 728915d + be757f4 commit 3bb7afd
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public class ShaclSail extends NotifyingSailWrapper {
private static String SH_OR_UPDATE_QUERY;
private static String IMPLICIT_TARGET_CLASS_NODE_SHAPE;
private static String IMPLICIT_TARGET_CLASS_PROPERTY_SHAPE;
private static String PROPERTY_SHAPE_WITH_TARGET;

/**
* an initialized {@link Repository} for storing/retrieving Shapes data
Expand All @@ -160,6 +161,8 @@ public class ShaclSail extends NotifyingSailWrapper {
"shacl-sparql-inference/implicitTargetClassNodeShape.rq");
IMPLICIT_TARGET_CLASS_PROPERTY_SHAPE = resourceAsString(
"shacl-sparql-inference/implicitTargetClassPropertyShape.rq");
PROPERTY_SHAPE_WITH_TARGET = resourceAsString(
"shacl-sparql-inference/propertyShapeWithTarget.rq");
} catch (IOException e) {
throw new IllegalStateException(e);
}
Expand Down Expand Up @@ -357,6 +360,7 @@ private void runInferencingSparqlQueries(SailRepositoryConnection shaclSailConne
shaclSailConnection.prepareUpdate(IMPLICIT_TARGET_CLASS_PROPERTY_SHAPE).execute();
shaclSailConnection.prepareUpdate(IMPLICIT_TARGET_CLASS_NODE_SHAPE).execute();
shaclSailConnection.prepareUpdate(SH_OR_UPDATE_QUERY).execute();
shaclSailConnection.prepareUpdate(PROPERTY_SHAPE_WITH_TARGET).execute();
currentSize = shaclSailConnection.size();
} while (prevSize != currentSize);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


delete {

?a ?p ?target .
}

insert {

[
a sh:NodeShape ;
?p ?target ;
sh:property ?a ;
]

}

where {

?a
sh:path ?path ;
?p ?target ;
.

FILTER(?p in (sh:targetClass, sh:targetNode, sh:targetSubjectsOf, sh:targetObjectsOf ))
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ abstract public class AbstractShaclTest {
"test-cases/deactivated/or",
"test-cases/deactivated/propertyshape",
"test-cases/in/simple",
"test-cases/uniqueLang/simple"
"test-cases/uniqueLang/simple",
"test-cases/propertyShapeWithTarget/simple"
)
.distinct()
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA {

ex:bigCo a ex:Company ;
rdfs:label "Big Co", "Big Co"@en, "Big Company"@en, "Stor bedrift"@no.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@base <http://example.com/ns> .
@prefix ex: <http://example.com/ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[
sh:targetClass ex:Company ;
sh:path rdfs:label ;
sh:uniqueLang true ;
] .

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA {

ex:bigCo a ex:Company ;
rdfs:label "Big Co", "Big Co"@en, "Stor bedrift"@no.

}

0 comments on commit 3bb7afd

Please sign in to comment.