diff --git a/shacl12-profiling/examples/01.ttl b/shacl12-profiling/examples/01.ttl new file mode 100644 index 00000000..0f138da9 --- /dev/null +++ b/shacl12-profiling/examples/01.ttl @@ -0,0 +1,8 @@ +ex:ont-M + a sh:ShapesGraph ; +. + +ex:shape-1 + a sh:NodeShape ; + rdfs:isDefinedBy ex:ont-M ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/02.ttl b/shacl12-profiling/examples/02.ttl new file mode 100644 index 00000000..0da29780 --- /dev/null +++ b/shacl12-profiling/examples/02.ttl @@ -0,0 +1,14 @@ +# 'Ontology M' uses a Shape defined by 'Ontology Other' +ex:ont-M + a sh:ShapesGraph ; + rdfs:member ex:shape-1 ; +. + +ex:ont-Other + a sh:ShapesGraph ; +. + +ex:shape-1 + a sh:NodeShape ; + rdfs:isDefinedBy ex:ont-Other ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/03.ttl b/shacl12-profiling/examples/03.ttl new file mode 100644 index 00000000..60382046 --- /dev/null +++ b/shacl12-profiling/examples/03.ttl @@ -0,0 +1,9 @@ +# 'Ontology N' imports 'Ontology M' +ex:ont-M + a owl:Ontology ; +. + +ex:ont-N + a owl:Ontology ; + owl:imports ex:ont-M ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/04.ttl b/shacl12-profiling/examples/04.ttl new file mode 100644 index 00000000..5fda95d2 --- /dev/null +++ b/shacl12-profiling/examples/04.ttl @@ -0,0 +1,26 @@ +# declaration of the Core profile + + a prof:Profile ; + prof:isProfileOf ; + prof:hasResource + , + ; +. + +# Core specification + + a prof:ResourceDescriptor ; + prof:hasRole role:Specification ; + dcterms:format "text/html" ; + dcterms:conformsTo ; + prof:hasArtifact ; +. + +# Core validator + + a prof:ResourceDescriptor ; + prof:hasRole role:Validation ; + dcterms:format "text/turtle" ; + dcterms:conformsTo ; + prof:hasArtifact ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/05.ttl b/shacl12-profiling/examples/05.ttl new file mode 100644 index 00000000..e04e4ea9 --- /dev/null +++ b/shacl12-profiling/examples/05.ttl @@ -0,0 +1,4 @@ + + a prof:Profile ; + prof:isProfileOf ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/06.ttl b/shacl12-profiling/examples/06.ttl new file mode 100644 index 00000000..75200e4c --- /dev/null +++ b/shacl12-profiling/examples/06.ttl @@ -0,0 +1,8 @@ + + a prof:Profile ; + prof:isProfileOf ; + prof:hasResource [ + prof:hasArtifact ; + prof:hasRole role:validation ; + ] ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/07.ttl b/shacl12-profiling/examples/07.ttl new file mode 100644 index 00000000..b5d6be20 --- /dev/null +++ b/shacl12-profiling/examples/07.ttl @@ -0,0 +1,10 @@ + + a prof:Profile ; + prof:isProfileOf ; + prof:hasResource [ + prof:hasArtifact ; + prof:hasRole role:validation ; + dcterms:conformsTo ; + dcterms:format "text/turtle" ; + ] ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/08.ttl b/shacl12-profiling/examples/08.ttl new file mode 100644 index 00000000..b4f628de --- /dev/null +++ b/shacl12-profiling/examples/08.ttl @@ -0,0 +1,13 @@ + + a prof:Profile ; + prof:isProfileOf ; + prof:hasResource [ + prof:hasArtifact ; + prof:hasRole + role:constraints , + role:specification , + role:validation ; + dcterms:conformsTo ; + dcterms:format "text/turtle" ; + ] ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/09.ttl b/shacl12-profiling/examples/09.ttl new file mode 100644 index 00000000..f6c74a1a --- /dev/null +++ b/shacl12-profiling/examples/09.ttl @@ -0,0 +1 @@ + dcterms:conformsTo . # via RDFS or OWL-RL reasoning \ No newline at end of file diff --git a/shacl12-profiling/examples/10.ttl b/shacl12-profiling/examples/10.ttl new file mode 100644 index 00000000..71b21056 --- /dev/null +++ b/shacl12-profiling/examples/10.ttl @@ -0,0 +1 @@ + dcterms:conformsTo . \ No newline at end of file diff --git a/shacl12-profiling/examples/11.ttl b/shacl12-profiling/examples/11.ttl new file mode 100644 index 00000000..4202efba --- /dev/null +++ b/shacl12-profiling/examples/11.ttl @@ -0,0 +1 @@ + prof:isProfileOf . \ No newline at end of file diff --git a/shacl12-profiling/examples/12.ttl b/shacl12-profiling/examples/12.ttl new file mode 100644 index 00000000..59eb67ca --- /dev/null +++ b/shacl12-profiling/examples/12.ttl @@ -0,0 +1 @@ + dcterms:conformsTo . \ No newline at end of file diff --git a/shacl12-profiling/examples/13.ttl b/shacl12-profiling/examples/13.ttl new file mode 100644 index 00000000..a874dd20 --- /dev/null +++ b/shacl12-profiling/examples/13.ttl @@ -0,0 +1,19 @@ + + a + owl:Ontology , + prof:Profile ; + prof:isProfileOf sh: ; + rdfs:label "CD1 Profile of SHACL"@en ; + rdfs:comment """This is a Profile of SHACL 1.2 that excludes shapes found to +be computationally intensive. + +Vocabulary elements of SHACL that are not listed as members of this profile may +not be used for implementations claiming conformance to this profile."""@en ; + rdfs:member + sh:AbstractResult , + sh:AndConstraintComponent , + # ... many skipped members + sh:xone , + sh:zeroOrMorePath , + sh:zeroOrOnePath ; +. \ No newline at end of file diff --git a/shacl12-profiling/examples/README.md b/shacl12-profiling/examples/README.md new file mode 100644 index 00000000..d72ad539 --- /dev/null +++ b/shacl12-profiling/examples/README.md @@ -0,0 +1,17 @@ +# Examples + +This directory contains example files in pseudo-Turtle format used within the Profiling HTML document. + +All examples are included using ReSpec commands like this: + +`
` + +## Validation + +To validate an example you will need Python installed and the [rdflib](https://pypi.org/project/rdflib/) package installed. You cna then run `validate.py` with any example file as an argument, e.g.: + +```bash +python check-rdf.py 01.ttl +``` + +The script will print "OK" if there are no syntax errors or else an error message. diff --git a/shacl12-profiling/examples/_prefixes.ttl b/shacl12-profiling/examples/_prefixes.ttl new file mode 100644 index 00000000..7316220f --- /dev/null +++ b/shacl12-profiling/examples/_prefixes.ttl @@ -0,0 +1,8 @@ +PREFIX dcterms: +PREFIX ex: +PREFIX owl: +PREFIX prof: +PREFIX rdfs: +PREFIX role: +PREFIX sh: +PREFIX shpr: \ No newline at end of file diff --git a/shacl12-profiling/examples/check-rdf.py b/shacl12-profiling/examples/check-rdf.py new file mode 100644 index 00000000..a123f438 --- /dev/null +++ b/shacl12-profiling/examples/check-rdf.py @@ -0,0 +1,11 @@ +import sys +from rdflib import Graph + +prefixes = open("_prefixes.ttl").read() +example_data = open(sys.argv[1]).read() + +total = prefixes + "\n\n" + example_data + +# print(total) +g = Graph().parse(data=total, format="turtle") +print("ok") \ No newline at end of file diff --git a/shacl12-profiling/index.html b/shacl12-profiling/index.html index 32fdd160..57806028 100644 --- a/shacl12-profiling/index.html +++ b/shacl12-profiling/index.html @@ -653,18 +653,7 @@

Indicating Element definition

This recommendation suggests that the creator of a SHACL element SHOULD indicate the group within which the SHACL element is defined. An example of such an assertion in RDF is as follows:

-
-ex:ont-M - a owl:Ontology ; -ex:ont-M - a sh:ShapesGraph ; -. - -ex:shape-1 - a sh:NodeShape ; - rdfs:isDefinedBy ex:ont-M ; -. -
+

In Section 2.5 Syntactic Variations of Shapes and Classes of [[[shacl12-core]]], a warning is issued that while property shapes may be declared @@ -689,22 +678,7 @@

Indicating Element use

An example of the use of the rdfs:member predicate to indicate inclusion of a SHACL element in a group that does not define it, as well use of rdfs:isDefinedBy, as in the example above, is as follows:

-
-# 'Ontology M' uses a Shape defined by 'Ontology Other' -ex:ont-M - a sh:ShapesGraph ; - rdfs:member ex:shape-1 ; -. - -ex:ont-Other - a sh:ShapesGraph ; -. - -ex:shape-1 - a sh:NodeShape ; - rdfs:isDefinedBy ex:ont-Other ; -. -
+

Indicating group dependence

@@ -723,16 +697,7 @@

Indicating group dependence

An example of owl:imports is as per the example below.

-
-# 'Ontology N' imports 'Ontology M' -ex:ont-M - a owl:Ontology ; -. - -ex:ont-N - a owl:Ontology ; - owl:imports ex:ont-M ; -.
+

Calculating Dependencies

@@ -772,34 +737,7 @@

Defining Profiles of SHACL

Profiles of SHACL should be declared using [[[dx-prof]]]. The declaration of the Core profile of SHACL 1.2 is as follows:

-
-# declaration of the Core profile -<http://www.w3.org/ns/shacl/profile/core> - a prof:Profile ; - prof:isProfileOf <https://www.w3.org/TR/shacl/> - prof:hasResource - <https://www.w3.org/TR/shacl12-core/> , - <http://www.w3.org/ns/shacl-shacl/core> ; -. - -# Core specification -<https://www.w3.org/TR/shacl12-core/> - a prof:ResourceDescriptor ; - prof:hasRole role:Specification ; - dcterms:format "text/html" ; - dcterms:conformsTo <http://www.w3.org/TR/html5/> ; - prof:hasArtifact <https://www.w3.org/TR/shacl12-core/> ; -. - -# Core validator -<http://www.w3.org/ns/shacl-shacl/core> - a prof:ResourceDescriptor ; - prof:hasRole role:Validation ; - dcterms:format "text/turtle" ; - dcterms:conformsTo <https://www.w3.org/TR/shacl/> ; - prof:hasArtifact <http://www.w3.org/ns/shacl-shacl/core> ; -. -
+

This declaration identifies the Core profile with the IRI <http://www.w3.org/ns/shacl/profile/core> and indicates it is an instance of prof:Profile, that it is a profile of the original SHACL publication from @@ -929,26 +867,12 @@

Characterizing the profiling situation

If a Shapes Graph SG1 is profiling a specification S1 then, following the characterisation of [[[dx-prof]]]:

-
- <SG1> - a prof:Profile ; - prof:isProfileOf <S1> ; - . -
+

However, SG1 is also playing the role of Validation, so a more complete [[[dx-prof]]] characterisation of the situation would be:

-
- <SG1> - a prof:Profile ; - prof:isProfileOf <S1> ; - prof:hasResource [ - prof:hasArtifact <SG1> ; - prof:hasRole role:validation ; - ] ; - . -
+

This is an unexpected use of [[[dx-prof]]], where the profile is also playing a role usually performed by a part of, or one of, the resources of the profile, rather than having a single profile resource playing all roles, but it is legitimate, @@ -959,18 +883,7 @@

Characterizing the profiling situation

To indicate that a profile resource is using [[[shacl12-core]]] and available in Turtle, the following can also be added to the characterisation:

-
- <SG1> - a prof:Profile ; - prof:isProfileOf <S1> ; - prof:hasResource [ - prof:hasArtifact <S1> ; - prof:hasRole role:validation ; - dcterms:conformsTo <https://www.w3.org/TR/shacl12-core/> ; - dcterms:format "text/turtle" ; - ] ; - . -
+

If SG1 is also considered the normative expression of the profile's requirements, as opposed to perhaps a separate human language document containing them, then the prof:hasRole value of role:constraints @@ -982,21 +895,7 @@

Characterizing the profiling situation

role:specification is specified to "[define] the profile in human-readable form" and while SHACL is human-readable, natural language prose is expected.

-
- <SG1> - a prof:Profile ; - prof:isProfileOf <S1> ; - prof:hasResource [ - prof:hasArtifact <S1> ; - prof:hasRole - role:constraints , - role:specification , - role:validation ; - dcterms:conformsTo <https://www.w3.org/TR/shacl12-core/> ; - dcterms:format "text/turtle" ; - ] ; - . -
+

What Use Cases does this reasoning address?

@@ -1013,27 +912,19 @@

Implications for data

have been asserted after testing the conformance of the Data Graph to the Shapes Graph by validation we can infer that:

-
-<DG1> dcterms:conformsTo <SG1> . # via RDFS or OWL-RL reasoning -
+

Following the [[[dx-prof]]] axiom of dcterms:conformsTo owl:propertyChainAxiom ( dcterms:conformsTo prof:isProfileOf ) then, if given

-
-<DG1> dcterms:conformsTo <SG1> . -
+

and

-
-<SG1> prof:isProfileOf <S1> . -
+

we can conclude that

-
-<DG1> dcterms:conformsTo <S1> . -
+

This reasoning allows for static conformance claims of data to profiles of specifications and specifications themselves to be made which will have utility for data whose conformance to these things must be known but which @@ -1615,27 +1506,7 @@

CD1 Profile

This profile is defined in the resource http://www.w3.org/ns/shacl/profile/cd1, a portion of which is as follows:

-
-<http://www.w3.org/ns/shacl/profile/cd1> - a - owl:Ontology , - prof:Profile ; - prof:isProfileOf sh: ; - rdfs:label "CD1 Profile of SHACL"@en ; - rdfs:comment """This is a Profile of SHACL 1.2 that excludes shapes found to -be computationally intensive. - -Vocabulary elements of SHACL that are not listed as members of this profile may -not be used for implementations claiming conformance to this profile."""@en ; - rdfs:member - sh:AbstractResult , - sh:AndConstraintComponent , - # ... many skipped members - sh:xone , - sh:zeroOrMorePath , - sh:zeroOrOnePath ; -. -
+

All the class and property elements of SHACL 1.2 are listed where ... many skipped members is indicated above except for: