Competency Questions
The requirements for the information model can be expressed as queries in natural language form called competency questions (CQ).
Below are a subset of such competency questions.
Info
Examples used throughout these competency questions were randomly generated for documentation and test purpose.
Provision
What are the types of Provision ? For each type, retrieve its defnition and related resources including its source from the ISO/IEC Directives part 2.

The full Provision type hierarchy is defined in the Core Ontology.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ex: <https://example.org/>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX spdx: <http://spdx.org/rdf/terms#>
SELECT ?provision_type ?provision_type_definition ?source_in_directive_part2
WHERE {
?provision_type rdfs:subClassOf+ smart:Provision ;
skos:definition ?provision_type_definition ;
rdfs:seeAlso ?source_in_directive_part2 .
} Group by ?provision_type
The results of the query looks like the following:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix saf: <https://www.iso.org/sites/smart/ontologies/smart-addressing-framework#> .
@prefix i: <https://smart-demo.iso.org/data/rdf/entity/> .
@prefix gramm: <https://w3id.org/standards/smart/ontologies/gramm#> . # Extraction of data from the grammatical structure of sentences.
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
smart:ProvisionShape
a sh:NodeShape ;
sh:targetClass smart:Provision ;
sh:property [
sh:path dcterms:isPartOf ;
sh:nodeKind sh:IRI ;
sh:or (
[
sh:class smart:Clause ;
sh:node smart:ClauseShape ;
]
[
sh:class smart:PublicationDocument ;
sh:node smart:PublicationDocumentShape ;
]
) ;
] ;
sh:property [
sh:path dcat:distribution ;
sh:nodeKind sh:IRI ;
sh:class dcat:Distribution ;
] ;
.
smart:ClauseShape
a sh:NodeShape ;
sh:targetClass smart:Clause ;
sh:property [
sh:path smart:hasSectionNumber ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path dcterms:title ;
sh:datatype rdf:langString ;
] ;
.
smart:PublicationDocumentShape
a sh:NodeShape ;
sh:targetClass smart:PublicationDocument ;
sh:property [
sh:path dcterms:hasVersion ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
] ;
sh:property [
sh:path dcterms:replaces ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
sh:maxCount 1;
] ;
sh:property [
sh:path dcterms:issued ;
sh:datatype xsd:date ;
] ;
.
What is the bindingness of a Provision, to which PublicationDocument does it belong, is it governing or assertional and which supplementary elements (notes, examples, figures, etc.) are associated with it?
These competency questions ask for:
- a Provision's BindingnessType,
- the PublicationDocument the Provision is part of along with the PublicationDocumentType,
- whether the Provision is governing or assertional (ProvisionType) and
- its associated ProvisionSupplements classified by types.

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <https://example.org/> .
@prefix publication-type: <https://w3id.org/standards/smart/taxonomies/publication-type/> .
@prefix bindingness-type: <https://w3id.org/standards/smart/taxonomies/bindingness-type/> .
@prefix provision-type: <https://w3id.org/standards/smart/taxonomies/provision-type/> .
@prefix provision-supplement-type: <https://w3id.org/standards/smart/taxonomies/provision-supplement-type/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix publication-component-type: <https://w3id.org/standards/smart/taxonomies/publication-component-type/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ex:annotation_1
a oa:Annotation ;
oa:hasBody ex:provision_1 ;
oa:hasTarget ex:content_fragment_1 .
ex:provision_1
a smart:Provision ;
dcterms:isPartOf ex:iso_std_iso_9000_ed_2_v2 ;
smart:hasBindingnessType bindingness-type:normative ;
smart:hasProvisionType provision-type:governingProvision ;
smart:hasSupplement ex:supplement_1 ;
dcat:distribution ex:content_fragment_1.
ex:iso_std_iso_9000_ed_2_v2
a smart:PublicationDocument ;
smart:hasPublicationType publication-type:standard.
ex:supplement_1
a smart:ProvisionSupplement ;
smart:hasSupplementType provision-supplement-type:note .
ex:content_fragment_1
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:iso_std_iso_9000_ed_2_v2 ;
oa:hasSelector ex:selector_1 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "8";
spdx:checksum [
a spdx:Checksum ;
spdx:algorithm <http://spdx.org/rdf/terms#checksumAlgorithm_sha256> ;
spdx:checksumValue "a9a66978f378456c818fb8a3e7c6ad3d2c83e62724ccbdea7b36253fb8df5edd"
];
rdf:value "Lorem ipsum"@en .
ex:selector_1
a oa:XPathSelector ;
rdf:value "/standard/body/sec[4]/sec[1]/p[1]/text()" .
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ex: <https://example.org/>
# CQ: What is the bindingness of a Provision, to which PublicationDocument does it belong, is it governing or assertional and which supplementary elements (notes, examples, figures, etc.) are associated with it?
SELECT ?provision ?provision_type ?bindingness_type ?publication ?publication_type ?supplement ?supplementType
WHERE {
?provision a smart:Provision ;
smart:hasBindingnessType ?bindingness_type ;
dcterms:isPartOf ?publication .
?publication smart:hasPublicationType ?publication_type.
?provision smart:hasProvisionType ?provision_type.
OPTIONAL {
?provision smart:hasSupplement ?supplement .
?supplement smart:hasSupplementType ?supplementType .
}
}
| provision | provision_type | bindingness_type | publication | publication_type | supplement | supplementType |
|---|---|---|---|---|---|---|
| https://example.org/provision_1 | https://w3id.org/standards/smart/taxonomies/provision-type/governingProvision | https://w3id.org/standards/smart/taxonomies/bindingness-type/normative | https://example.org/iso_std_iso_9000_ed_2_v2 | https://w3id.org/standards/smart/taxonomies/publication-type/standard | https://example.org/supplement_1 | https://w3id.org/standards/smart/taxonomies/provision-supplement-type/note |
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
smart:ProvisionShape
a sh:NodeShape ;
sh:targetClass smart:Provision ;
sh:property [
sh:path dcterms:isPartOf ;
sh:class smart:PublicationDocument ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path smart:hasBindingnessType ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path smart:hasStatement ;
sh:datatype rdf:langString ;
sh:minCount 1 ;
] ;
sh:property [
sh:path smart:hasSupplement ;
sh:class smart:ProvisionSupplement ;
sh:nodeKind sh:IRI ;
sh:minCount 0 ;
] .
From which identified fragment in the authoritative file is the Provision derived? Is the extracted content within the core ontology congruous with the original?
A Standard in an NISO STS XML format is considered an authoritative file.

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex: <https://example.org/> .
@prefix publication-type: <https://w3id.org/standards/smart/taxonomies/publication-type/> .
@prefix bindingness-type: <https://w3id.org/standards/smart/taxonomies/bindingness-type/> .
@prefix provision-type: <https://w3id.org/standards/smart/taxonomies/provision-type/> .
@prefix provision-supplement-type: <https://w3id.org/standards/smart/taxonomies/provision-supplement-type/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix publication-component-type: <https://w3id.org/standards/smart/taxonomies/publication-component-type/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ex:annotation_1
a oa:Annotation ;
oa:hasBody ex:provision_1 ;
oa:hasTarget ex:content_fragment_1 .
ex:provision_1
a smart:Provision ;
dcterms:isPartOf ex:iso_std_iso_9000_ed_2_v2 ;
smart:hasBindingnessType bindingness-type:normative ;
smart:hasProvisionType provision-type:governingProvision ;
smart:hasSupplement ex:supplement_1 ;
dcat:distribution ex:content_fragment_1.
ex:iso_std_iso_9000_ed_2_v2
a smart:PublicationDocument ;
smart:hasPublicationType publication-type:standard.
ex:supplement_1
a smart:ProvisionSupplement ;
smart:hasSupplementType provision-supplement-type:note .
ex:content_fragment_1
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:iso_std_iso_9000_ed_2_v2 ;
oa:hasSelector ex:selector_1 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "8";
spdx:checksum [
a spdx:Checksum ;
spdx:algorithm <http://spdx.org/rdf/terms#checksumAlgorithm_sha256> ;
spdx:checksumValue "a9a66978f378456c818fb8a3e7c6ad3d2c83e62724ccbdea7b36253fb8df5edd"
];
rdf:value "Lorem ipsum"@en .
ex:selector_1
a oa:XPathSelector ;
rdf:value "/standard/body/sec[4]/sec[1]/p[1]/text()" .
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ex: <https://example.org/>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX spdx: <http://spdx.org/rdf/terms#>
# CQ1: From which identified fragment in the authoritative file is the Provision derived?
# CQ2: Is the extracted content within the core ontology congruous with the original?
SELECT ?provision (?standard AS ?authoritative_file) ?fragment_selector_type ?fragment_selector ?checksum_match
WHERE {
# CQ1
VALUES ?provision { ex:provision_1 }
VALUES ?externally_extracted_content_checksum { "a9a66978f378456c818fb8a3e7c6ad3d2c83e62724ccbdea7b36253fb8df5edd" }
?annotation a oa:Annotation ;
oa:hasBody ?provision ;
oa:hasTarget ?specific_resource .
?specific_resource a oa:SpecificResource ;
oa:hasSelector ?selector ;
oa:hasSource ?standard ;
spdx:checksum/spdx:algorithm ?checksum_algorithm ;
spdx:checksum/spdx:checksumValue ?checksum .
?selector a ?fragment_selector_type ;
rdf:value ?fragment_selector .
# Compare checksums (CQ2)
BIND((?checksum = ?externally_extracted_content_checksum) AS ?checksum_match) .
}
Running this query on the example will return the following result:
| provision | authoritative_file | fragment_selector_type | fragment_selector | checksum_match |
|---|---|---|---|---|
| https://example.org/provision_1 | https://example.org/iso_std_iso_9000_ed_2_v2 | http://www.w3.org/ns/oa#XPathSelector | /standard/body/sec[4]/sec[1]/p[1]/text() | true |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix oa: <http://www.w3.org/ns/oa#> .
smart:AnnotationShape
a sh:NodeShape ;
sh:targetClass oa:Annotation ;
sh:property [
sh:path oa:hasTarget ;
sh:nodeKind sh:IRI ;
sh:class oa:SpecificResource ;
] ;
sh:property [
sh:path oa:hasBody ;
sh:nodeKind sh:IRI ;
sh:class smart:Provision ;
] ;
.
smart:SpecificResourceShape
a sh:NodeShape ;
sh:targetClass oa:SpecificResource ;
sh:property [
sh:path oa:hasSource ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
] ;
sh:property [
sh:path oa:hasSelector ;
sh:nodeKind sh:IRI ;
sh:class oa:Selector ;
sh:node smart:SelectorShape ;
] ;
sh:property [
sh:path smart:isSuccessorOf ;
sh:nodeKind sh:IRI ;
sh:class oa:SpecificResource ;
sh:node smart:SpecificResourceShape ;
] ;
sh:property [
sh:path rdf:value ;
sh:datatype rdf:langString ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path dcterms:format ;
sh:datatype xsd:string ;
sh:maxCount 1 ;
] ;
.
smart:SelectorShape
a sh:NodeShape ;
sh:targetClass oa:Selector ;
sh:property [
sh:path rdf:value ;
sh:datatype xsd:string ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
.
Clause and Publication Document
Which Clauses are part of Document X ? Which Provisions are part of Clause 3.1 of Document X

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix ex: <https://example.org/> .
@prefix publication-type: <https://w3id.org/standards/smart/taxonomies/publication-type/> .
@prefix bindingness-type: <https://w3id.org/standards/smart/taxonomies/bindingness-type/> .
@prefix publication-component-type: <https://w3id.org/standards/smart/taxonomies/publication-component-type/> .
smart:Requirement rdfs:subClassOf smart:Provision .
smart:Clause rdfs:subClassOf smart:ProvisionSet .
ex:document_1
a smart:PublicationDocument ;
dcterms:title "Sample publication document"@en ;
smart:hasPublicationType publication-type:standard .
ex:forword
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_9 .
ex:introduction
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_10 .
ex:technical_specification
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_11 .
ex:technical_detail
a smart:Clause ;
dcterms:isPartOf ex:technical_specification ;
dcat:distribution ex:content_fragment_12 .
ex:prov1
a smart:Provision ;
dcterms:isPartOf ex:forword ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_1 .
ex:prov2
a smart:Provision ;
dcterms:isPartOf ex:forword ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_2 .
ex:prov3
a smart:Requirement ;
dcterms:isPartOf ex:introduction ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_3 .
ex:prov4
a smart:Provision ;
dcterms:isPartOf ex:introduction ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_4 .
ex:prov5
a smart:Requirement ;
dcterms:isPartOf ex:technical_specification ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_5 .
ex:prov6
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_6 .
ex:prov7
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_7 .
ex:prov8
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_8 .
ex:annotation_1
a oa:Annotation ;
oa:hasBody ex:prov1 ;
oa:hasTarget ex:content_fragment_1 .
ex:annotation_2
a oa:Annotation ;
oa:hasBody ex:prov2 ;
oa:hasTarget ex:content_fragment_2 .
ex:annotation_3
a oa:Annotation ;
oa:hasBody ex:prov3 ;
oa:hasTarget ex:content_fragment_3 .
ex:annotation_4
a oa:Annotation ;
oa:hasBody ex:prov4 ;
oa:hasTarget ex:content_fragment_4 .
ex:annotation_5
a oa:Annotation ;
oa:hasBody ex:prov5 ;
oa:hasTarget ex:content_fragment_5 .
ex:annotation_6
a oa:Annotation ;
oa:hasBody ex:prov6 ;
oa:hasTarget ex:content_fragment_6 .
ex:annotation_7
a oa:Annotation ;
oa:hasBody ex:prov7 ;
oa:hasTarget ex:content_fragment_7 .
ex:annotation_8
a oa:Annotation ;
oa:hasBody ex:prov8 ;
oa:hasTarget ex:content_fragment_8 .
ex:annotation_9
a oa:Annotation ;
oa:hasBody ex:forword ;
oa:hasTarget ex:content_fragment_9 .
ex:annotation_10
a oa:Annotation ;
oa:hasBody ex:introduction ;
oa:hasTarget ex:content_fragment_10 .
ex:annotation_11
a oa:Annotation ;
oa:hasBody ex:technical_specification ;
oa:hasTarget ex:content_fragment_11 .
ex:annotation_12
a oa:Annotation ;
oa:hasBody ex:technical_detail ;
oa:hasTarget ex:content_fragment_12 .
ex:content_fragment_1
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_1 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_1 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_2
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_2 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_2 ;
smart:isSuccessorOf ex:content_fragment_1 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_3
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_3 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_3 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_4
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_4 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_4 ;
smart:isSuccessorOf ex:content_fragment_3 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_5
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_5 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_5 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_6
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_6 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_6 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_7
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_7 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_7 ;
smart:isSuccessorOf ex:content_fragment_6 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_8
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_8 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_8 ;
smart:isSuccessorOf ex:content_fragment_7 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_9
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_9 ;
dcterms:title "FORWORD"@en ;
smart:hasSectionNumber "1"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "7"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_9 .
ex:content_fragment_10
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_10 ;
dcterms:title "INTRODUCTION"@en ;
smart:hasSectionNumber "2"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "12"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_10 ;
smart:isSuccessorOf ex:content_fragment_9 .
ex:content_fragment_11
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_11 ;
dcterms:title "Technical Specification"@en ;
smart:hasSectionNumber "3"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "23"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_11 ;
smart:isSuccessorOf ex:content_fragment_10 .
ex:content_fragment_12
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_12 ;
dcterms:title "Technical Detail"@en ;
smart:hasSectionNumber "3.1"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "16"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_12 ;
smart:isSuccessorOf ex:content_fragment_5 .
ex:selector_1
a oa:XPathSelector ;
rdf:value "/document/front/foreword/p[1]/text()" .
ex:selector_2
a oa:XPathSelector ;
rdf:value "/document/front/foreword/p[2]/text()" .
ex:selector_3
a oa:XPathSelector ;
rdf:value "/document/front/introduction/p[1]/text()" .
ex:selector_4
a oa:XPathSelector ;
rdf:value "/document/front/introduction/p[2]/text()" .
ex:selector_5
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/p[1]/text()" .
ex:selector_6
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[1]/text()" .
ex:selector_7
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[2]/text()" .
ex:selector_8
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[3]/text()" .
ex:selector_9
a oa:XPathSelector ;
rdf:value "/document/front/foreword/title/text()" .
ex:selector_10
a oa:XPathSelector ;
rdf:value "/document/front/introduction/title/text()" .
ex:selector_11
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/title/text()" .
ex:selector_12
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/title/text()" .
ex:checksum_1
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000001"^^xsd:hexBinary .
ex:checksum_2
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000002"^^xsd:hexBinary .
ex:checksum_3
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000003"^^xsd:hexBinary .
ex:checksum_4
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000004"^^xsd:hexBinary .
ex:checksum_5
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000005"^^xsd:hexBinary .
ex:checksum_6
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000006"^^xsd:hexBinary .
ex:checksum_7
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000007"^^xsd:hexBinary .
ex:checksum_8
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000008"^^xsd:hexBinary .
ex:checksum_9
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000009"^^xsd:hexBinary .
ex:checksum_10
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000010"^^xsd:hexBinary .
ex:checksum_11
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000011"^^xsd:hexBinary .
ex:checksum_12
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000012"^^xsd:hexBinary .
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dcat: <http://www.w3.org/ns/dcat#>
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
PREFIX ex: <https://example.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
# CQ1: Which Clauses are part of Document X ?
# CQ2: Which Provisions are part of Clause 3.1 of Document X
SELECT ?document_X ?clause ?provision ?clause_section_number
WHERE {
VALUES ?document_X { ex:document_1 }
VALUES ?clause_section_number {"3.1"^^xsd:string}
?clause dcterms:isPartOf* ?document_X ;
a smart:Clause .
?clause dcat:distribution/smart:hasSectionNumber ?clause_section_number.
?provision dcterms:isPartOf ?clause ;
rdf:type / rdfs:subClassOf* smart:Provision .
}
Running this query on the example will return the following result:
| document_X | clause | provision | clause_section_number |
|---|---|---|---|
| https://example.org/document_1 | https://example.org/technical_detail | https://example.org/prov7 | 3.1 |
| https://example.org/document_1 | https://example.org/technical_detail | https://example.org/prov6 | 3.1 |
| https://example.org/document_1 | https://example.org/technical_detail | https://example.org/prov8 | 3.1 |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix saf: <https://www.iso.org/sites/smart/ontologies/smart-addressing-framework#> .
@prefix i: <https://smart-demo.iso.org/data/rdf/entity/> .
@prefix gramm: <https://w3id.org/standards/smart/ontologies/gramm#> . # Extraction of data from the grammatical structure of sentences.
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
smart:ProvisionShape
a sh:NodeShape ;
sh:targetClass smart:Provision ;
sh:property [
sh:path dcterms:isPartOf ;
sh:nodeKind sh:IRI ;
sh:or (
[
sh:class smart:Clause ;
sh:node smart:ClauseShape ;
]
[
sh:class smart:PublicationDocument ;
sh:node smart:PublicationDocumentShape ;
]
) ;
] ;
sh:property [
sh:path dcat:distribution ;
sh:nodeKind sh:IRI ;
sh:class dcat:Distribution ;
] ;
.
smart:ClauseShape
a sh:NodeShape ;
sh:targetClass smart:Clause ;
sh:property [
sh:path smart:hasSectionNumber ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path dcterms:title ;
sh:datatype rdf:langString ;
] ;
.
smart:PublicationDocumentShape
a sh:NodeShape ;
sh:targetClass smart:PublicationDocument ;
sh:property [
sh:path dcterms:hasVersion ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
] ;
sh:property [
sh:path dcterms:replaces ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
sh:maxCount 1;
] ;
sh:property [
sh:path dcterms:issued ;
sh:datatype xsd:date ;
] ;
.
How do I reconstruct a a readable document from its information model entities?
In order to rebuild a document's structure using the information model entities, the user needs to go through the annotations of clauses and provisions.
The logical order of the annotated resources (oa:SpecificResource, dcat:Distribution) is denoted with relationship smart:isSuccessorOf .
Since SPARQL cannot return results in a tree structure, one would need to use Python (or other scripting language) to rebuild the document structure as a tree. An example of such a script is provided here.

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix ex: <https://example.org/> .
@prefix publication-type: <https://w3id.org/standards/smart/taxonomies/publication-type/> .
@prefix bindingness-type: <https://w3id.org/standards/smart/taxonomies/bindingness-type/> .
@prefix publication-component-type: <https://w3id.org/standards/smart/taxonomies/publication-component-type/> .
smart:Requirement rdfs:subClassOf smart:Provision .
smart:Clause rdfs:subClassOf smart:ProvisionSet .
ex:document_1
a smart:PublicationDocument ;
dcterms:title "Sample publication document"@en ;
smart:hasPublicationType publication-type:standard .
ex:forword
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_9 .
ex:introduction
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_10 .
ex:technical_specification
a smart:Clause ;
dcterms:isPartOf ex:document_1 ;
dcat:distribution ex:content_fragment_11 .
ex:technical_detail
a smart:Clause ;
dcterms:isPartOf ex:technical_specification ;
dcat:distribution ex:content_fragment_12 .
ex:prov1
a smart:Provision ;
dcterms:isPartOf ex:forword ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_1 .
ex:prov2
a smart:Provision ;
dcterms:isPartOf ex:forword ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_2 .
ex:prov3
a smart:Requirement ;
dcterms:isPartOf ex:introduction ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_3 .
ex:prov4
a smart:Provision ;
dcterms:isPartOf ex:introduction ;
smart:hasBindingnessType bindingness-type:informative ;
dcat:distribution ex:content_fragment_4 .
ex:prov5
a smart:Requirement ;
dcterms:isPartOf ex:technical_specification ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_5 .
ex:prov6
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_6 .
ex:prov7
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_7 .
ex:prov8
a smart:Requirement ;
dcterms:isPartOf ex:technical_detail ;
smart:hasBindingnessType bindingness-type:normative ;
dcat:distribution ex:content_fragment_8 .
ex:annotation_1
a oa:Annotation ;
oa:hasBody ex:prov1 ;
oa:hasTarget ex:content_fragment_1 .
ex:annotation_2
a oa:Annotation ;
oa:hasBody ex:prov2 ;
oa:hasTarget ex:content_fragment_2 .
ex:annotation_3
a oa:Annotation ;
oa:hasBody ex:prov3 ;
oa:hasTarget ex:content_fragment_3 .
ex:annotation_4
a oa:Annotation ;
oa:hasBody ex:prov4 ;
oa:hasTarget ex:content_fragment_4 .
ex:annotation_5
a oa:Annotation ;
oa:hasBody ex:prov5 ;
oa:hasTarget ex:content_fragment_5 .
ex:annotation_6
a oa:Annotation ;
oa:hasBody ex:prov6 ;
oa:hasTarget ex:content_fragment_6 .
ex:annotation_7
a oa:Annotation ;
oa:hasBody ex:prov7 ;
oa:hasTarget ex:content_fragment_7 .
ex:annotation_8
a oa:Annotation ;
oa:hasBody ex:prov8 ;
oa:hasTarget ex:content_fragment_8 .
ex:annotation_9
a oa:Annotation ;
oa:hasBody ex:forword ;
oa:hasTarget ex:content_fragment_9 .
ex:annotation_10
a oa:Annotation ;
oa:hasBody ex:introduction ;
oa:hasTarget ex:content_fragment_10 .
ex:annotation_11
a oa:Annotation ;
oa:hasBody ex:technical_specification ;
oa:hasTarget ex:content_fragment_11 .
ex:annotation_12
a oa:Annotation ;
oa:hasBody ex:technical_detail ;
oa:hasTarget ex:content_fragment_12 .
ex:content_fragment_1
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_1 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_1 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_2
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_2 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_2 ;
smart:isSuccessorOf ex:content_fragment_1 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_3
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_3 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_3 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_4
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_4 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_4 ;
smart:isSuccessorOf ex:content_fragment_3 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_5
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_5 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_5 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_6
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_6 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_6 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_7
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_7 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_7 ;
smart:isSuccessorOf ex:content_fragment_6 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_8
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_8 ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "128"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_8 ;
smart:isSuccessorOf ex:content_fragment_7 ;
rdf:value "Lorem ipsum dolor sit amet, consectetur adipiscing elit."@en .
ex:content_fragment_9
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_9 ;
dcterms:title "FORWORD"@en ;
smart:hasSectionNumber "1"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "7"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_9 .
ex:content_fragment_10
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_10 ;
dcterms:title "INTRODUCTION"@en ;
smart:hasSectionNumber "2"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "12"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_10 ;
smart:isSuccessorOf ex:content_fragment_9 .
ex:content_fragment_11
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_11 ;
dcterms:title "Technical Specification"@en ;
smart:hasSectionNumber "3"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "23"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_11 ;
smart:isSuccessorOf ex:content_fragment_10 .
ex:content_fragment_12
a oa:SpecificResource, dcat:Distribution ;
oa:hasSource ex:document_1 ;
dcat:downloadURL ex:document_1 ;
oa:hasSelector ex:selector_12 ;
dcterms:title "Technical Detail"@en ;
smart:hasSectionNumber "3.1"^^xsd:string ;
dcat:mediaType "text/plain"^^xsd:string ;
smart:hasPublicationComponentType publication-component-type:textual ;
dcat:byteSize "16"^^xsd:nonNegativeInteger ;
spdx:checksum ex:checksum_12 ;
smart:isSuccessorOf ex:content_fragment_5 .
ex:selector_1
a oa:XPathSelector ;
rdf:value "/document/front/foreword/p[1]/text()" .
ex:selector_2
a oa:XPathSelector ;
rdf:value "/document/front/foreword/p[2]/text()" .
ex:selector_3
a oa:XPathSelector ;
rdf:value "/document/front/introduction/p[1]/text()" .
ex:selector_4
a oa:XPathSelector ;
rdf:value "/document/front/introduction/p[2]/text()" .
ex:selector_5
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/p[1]/text()" .
ex:selector_6
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[1]/text()" .
ex:selector_7
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[2]/text()" .
ex:selector_8
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/p[3]/text()" .
ex:selector_9
a oa:XPathSelector ;
rdf:value "/document/front/foreword/title/text()" .
ex:selector_10
a oa:XPathSelector ;
rdf:value "/document/front/introduction/title/text()" .
ex:selector_11
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/title/text()" .
ex:selector_12
a oa:XPathSelector ;
rdf:value "/document/body/sec[1]/sec[1]/title/text()" .
ex:checksum_1
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000001"^^xsd:hexBinary .
ex:checksum_2
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000002"^^xsd:hexBinary .
ex:checksum_3
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000003"^^xsd:hexBinary .
ex:checksum_4
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000004"^^xsd:hexBinary .
ex:checksum_5
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000005"^^xsd:hexBinary .
ex:checksum_6
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000006"^^xsd:hexBinary .
ex:checksum_7
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000007"^^xsd:hexBinary .
ex:checksum_8
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000008"^^xsd:hexBinary .
ex:checksum_9
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000009"^^xsd:hexBinary .
ex:checksum_10
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000010"^^xsd:hexBinary .
ex:checksum_11
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000011"^^xsd:hexBinary .
ex:checksum_12
a spdx:Checksum ;
spdx:algorithm spdx:checksumAlgorithm_sha256 ;
spdx:checksumValue "0000000000000000000000000000000000000000000000000000000000000012"^^xsd:hexBinary .
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
PREFIX ex: <https://example.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?depth ?type ?item ?parent ?previous ?next ?annotation ?target ?section ?title ?value
WHERE {
VALUES ?root { ex:document_1 }
VALUES ?supertype {
smart:Clause
smart:Provision
}
?type rdfs:subClassOf* ?supertype .
?item dcterms:isPartOf+ ?root ;
dcterms:isPartOf ?parent ;
a ?type .
?annotation oa:hasBody ?item ;
oa:hasTarget ?target .
OPTIONAL {
?target smart:isSuccessorOf ?previousTarget .
?previousAnnotation oa:hasBody ?previous ;
oa:hasTarget ?previousTarget .
}
OPTIONAL {
?nextTarget smart:isSuccessorOf ?target .
?nextAnnotation oa:hasBody ?next ;
oa:hasTarget ?nextTarget .
}
OPTIONAL { ?target rdf:value ?value . }
OPTIONAL { ?target dcterms:title ?title . }
OPTIONAL { ?target smart:hasSectionNumber ?section . }
{
SELECT ?item (COUNT(DISTINCT ?ancestor) AS ?depth)
WHERE {
VALUES ?root { ex:document_1 }
?item dcterms:isPartOf+ ?root .
?item dcterms:isPartOf+ ?ancestor .
?ancestor dcterms:isPartOf* ?root .
}
GROUP BY ?item
}
}
ORDER BY ?depth ?parent ?previous ?item
Running this query on the example will return the following result:
| depth | type | item | parent | previous | next | annotation | target | section | title | value |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | https://w3id.org/standards/smart/ontologies/core/Clause | https://example.org/forword | https://example.org/document_1 | https://example.org/introduction | https://example.org/annotation_9 | https://example.org/content_fragment_9 | 1 | FORWORD | ||
| 1 | https://w3id.org/standards/smart/ontologies/core/Clause | https://example.org/introduction | https://example.org/document_1 | https://example.org/forword | https://example.org/technical_specification | https://example.org/annotation_10 | https://example.org/content_fragment_10 | 2 | INTRODUCTION | |
| 1 | https://w3id.org/standards/smart/ontologies/core/Clause | https://example.org/technical_specification | https://example.org/document_1 | https://example.org/introduction | https://example.org/annotation_11 | https://example.org/content_fragment_11 | 3 | Technical Specification | ||
| 2 | https://w3id.org/standards/smart/ontologies/core/Provision | https://example.org/prov1 | https://example.org/forword | https://example.org/prov2 | https://example.org/annotation_1 | https://example.org/content_fragment_1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 2 | https://w3id.org/standards/smart/ontologies/core/Provision | https://example.org/prov2 | https://example.org/forword | https://example.org/prov1 | https://example.org/annotation_2 | https://example.org/content_fragment_2 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 2 | https://w3id.org/standards/smart/ontologies/core/Requirement | https://example.org/prov3 | https://example.org/introduction | https://example.org/prov4 | https://example.org/annotation_3 | https://example.org/content_fragment_3 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 2 | https://w3id.org/standards/smart/ontologies/core/Provision | https://example.org/prov4 | https://example.org/introduction | https://example.org/prov3 | https://example.org/annotation_4 | https://example.org/content_fragment_4 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 2 | https://w3id.org/standards/smart/ontologies/core/Requirement | https://example.org/prov5 | https://example.org/technical_specification | https://example.org/technical_detail | https://example.org/annotation_5 | https://example.org/content_fragment_5 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 2 | https://w3id.org/standards/smart/ontologies/core/Clause | https://example.org/technical_detail | https://example.org/technical_specification | https://example.org/prov5 | https://example.org/annotation_12 | https://example.org/content_fragment_12 | 3.1 | Technical Detail | ||
| 3 | https://w3id.org/standards/smart/ontologies/core/Requirement | https://example.org/prov6 | https://example.org/technical_detail | https://example.org/prov7 | https://example.org/annotation_6 | https://example.org/content_fragment_6 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |||
| 3 | https://w3id.org/standards/smart/ontologies/core/Requirement | https://example.org/prov7 | https://example.org/technical_detail | https://example.org/prov6 | https://example.org/prov8 | https://example.org/annotation_7 | https://example.org/content_fragment_7 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
| 3 | https://w3id.org/standards/smart/ontologies/core/Requirement | https://example.org/prov8 | https://example.org/technical_detail | https://example.org/prov7 | https://example.org/annotation_8 | https://example.org/content_fragment_8 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. |
import json
from collections import defaultdict
from pathlib import Path
from rdflib import Graph, Namespace, RDF
EX = Namespace("https://example.org/")
SMART = Namespace("https://w3id.org/standards/smart/ontologies/core/")
DCTERMS = Namespace("http://purl.org/dc/terms/")
ROOT = EX.document_1
SAMPLE_PATH = Path(__file__).with_name("document_sample.ttl")
QUERY_PATH = Path(__file__).with_name("cq_query.sparql")
def compact_uri(uri):
text = str(uri)
if text.startswith(str(EX)):
return f"ex:{text.removeprefix(str(EX))}"
if text.startswith(str(SMART)):
return f"smart:{text.removeprefix(str(SMART))}"
return text
def binding_value(binding, name):
value = binding.get(name)
if value is None:
return None
return value["value"]
def quoted_text(value):
if value is None:
return None
return json.dumps(str(value), ensure_ascii=False)
def load_query_json(graph, query_path):
query = query_path.read_text(encoding="utf-8")
results = graph.query(query)
return json.loads(results.serialize(format="json"))
def rows_from_json(query_json):
rows = []
for binding in query_json["results"]["bindings"]:
rows.append(
{
"item": binding_value(binding, "item"),
"parent": binding_value(binding, "parent"),
"type": binding_value(binding, "type"),
"depth": int(binding_value(binding, "depth")),
"previous": binding_value(binding, "previous"),
"next": binding_value(binding, "next"),
"title": binding_value(binding, "title"),
"value": binding_value(binding, "value"),
}
)
return rows
def order_siblings(rows):
by_item = {row["item"]: row for row in rows}
heads = [row for row in rows if not row["previous"] or row["previous"] not in by_item]
ordered = []
visited = set()
for head in sorted(heads, key=lambda row: row["item"]):
current = head
while current and current["item"] not in visited:
ordered.append(current)
visited.add(current["item"])
current = by_item.get(current["next"])
ordered.extend(
sorted((row for row in rows if row["item"] not in visited), key=lambda row: row["item"])
)
return ordered
def children_by_parent(rows):
grouped = defaultdict(list)
for row in rows:
grouped[row["parent"]].append(row)
return {parent: order_siblings(children) for parent, children in grouped.items()}
def row_text(row):
class_name = compact_uri(row["type"]).split(":")[-1]
if class_name == "Clause":
return row["title"]
return row["value"]
def item_label(item, item_type, text=None):
label_parts = [compact_uri(item_type)]
quoted = quoted_text(text)
if quoted:
label_parts.append(quoted)
return f"{compact_uri(item)} [{', '.join(label_parts)}]"
def print_tree(parent, grouped, prefix=""):
children = grouped.get(str(parent), [])
for index, child in enumerate(children):
is_last = index == len(children) - 1
connector = "`-- " if is_last else "|-- "
child_label = item_label(child["item"], child["type"], row_text(child))
print(f"{prefix}{connector}{child_label}")
extension = " " if is_last else "| "
print_tree(child["item"], grouped, prefix + extension)
def main():
graph = Graph()
graph.parse(SAMPLE_PATH, format="turtle")
query_json = load_query_json(graph, QUERY_PATH)
rows = rows_from_json(query_json)
grouped = children_by_parent(rows)
root_type = graph.value(ROOT, RDF.type)
root_title = graph.value(ROOT, DCTERMS.title)
print(item_label(ROOT, root_type, root_title))
print_tree(ROOT, grouped)
if __name__ == "__main__":
main()
The results printed by this script look like the following:
ex:document_1 [smart:PublicationDocument, "Sample publication document"]
|-- ex:forword [smart:Clause, "FORWORD"]
| |-- ex:prov1 [smart:Provision, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
| `-- ex:prov2 [smart:Provision, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
|-- ex:introduction [smart:Clause, "INTRODUCTION"]
| |-- ex:prov3 [smart:Requirement, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
| `-- ex:prov4 [smart:Provision, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
`-- ex:technical_specification [smart:Clause, "Technical Specification"]
|-- ex:prov5 [smart:Requirement, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
`-- ex:technical_detail [smart:Clause, "Technical Detail"]
|-- ex:prov6 [smart:Requirement, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
|-- ex:prov7 [smart:Requirement, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
`-- ex:prov8 [smart:Requirement, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix saf: <https://www.iso.org/sites/smart/ontologies/smart-addressing-framework#> .
@prefix i: <https://smart-demo.iso.org/data/rdf/entity/> .
@prefix gramm: <https://w3id.org/standards/smart/ontologies/gramm#> . # Extraction of data from the grammatical structure of sentences.
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
smart:ProvisionShape
a sh:NodeShape ;
sh:targetClass smart:Provision ;
sh:property [
sh:path dcterms:isPartOf ;
sh:nodeKind sh:IRI ;
sh:or (
[
sh:class smart:Clause ;
sh:node smart:ClauseShape ;
]
[
sh:class smart:PublicationDocument ;
sh:node smart:PublicationDocumentShape ;
]
) ;
] ;
sh:property [
sh:path dcat:distribution ;
sh:nodeKind sh:IRI ;
sh:class dcat:Distribution ;
] ;
.
smart:ClauseShape
a sh:NodeShape ;
sh:targetClass smart:Clause ;
sh:property [
sh:path smart:hasSectionNumber ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path dcterms:title ;
sh:datatype rdf:langString ;
] ;
.
smart:PublicationDocumentShape
a sh:NodeShape ;
sh:targetClass smart:PublicationDocument ;
sh:property [
sh:path dcterms:hasVersion ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
] ;
sh:property [
sh:path dcterms:replaces ;
sh:nodeKind sh:IRI ;
sh:class smart:PublicationDocument ;
sh:maxCount 1;
] ;
sh:property [
sh:path dcterms:issued ;
sh:datatype xsd:date ;
] ;
.
Terms Definition
How do I refer to technical concept X in language Y?
Terms from standards are captured as smart:TermEntry entities, which associate with one or more smart:Term entities. The language tags of the smart:Term literal form can be used to denote the language of a term.
Language tags used in this model conform to BCP 47 (IETF Best Current Practice 47), as defined in RFC 5646, in accordance with the RDF standard, which specifies the use of BCP 47 for language-tagged strings.

@prefix ex: <https://example.org#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix term-form-type: <https://w3id.org/standards/smart/taxonomies/term-form-type/> .
@prefix part-of-speech-type: <https://w3id.org/standards/smart/taxonomies/part-of-speech-type/> .
ex:concept_x
a smart:TermEntry, skos:Concept ;
skosxl:prefLabel ex:label_1, ex:label_3 ;
skosxl:altLabel ex:label_2, ex:label_4 ;
skos:definition "use of a product, process or service in accordance with the specifications, instructions and information provided by the manufacturer"@en ;
skos:definition "utilisation d'un produit, d'un processus ou d'un service conformément aux spécifications, instructions et informations fournies par le fabricant"@fr ;
skos:scopeNote "intended use should not be confused with normal use. While both include the concept of use as intended by the manufacturer, intended use focuses on the medical purpose while normal use incorporates not only the medical purpose, but maintenance, service, transport, etc. as well"@en ;
prov:qualifiedDerivation [
a prov:Derivation ;
prov:entity ex:concept_y ;
skos:changeNote "urn:iec:std:iso:14971:2000-12:::#con-2.5 ISO 14971:2000, definition 2.5"
] .
ex:label_1
a smart:Term, skosxl:Label ;
skosxl:literalForm "intended use"@en ;
smart:hasTermForm term-form-type:fullForm ;
smart:usedInCountry "GB", "US" ;
smart:isPartOfSpeech part-of-speech-type:noun .
ex:label_2
a smart:Term, skosxl:Label ;
skosxl:literalForm "intended purpose"@en ;
smart:hasTermForm term-form-type:fullForm ;
smart:usedInCountry "GB", "US" ;
smart:isPartOfSpeech part-of-speech-type:noun .
ex:label_3
a smart:Term, skosxl:Label ;
skosxl:literalForm "utilisation prévue"@fr ;
smart:hasTermForm term-form-type:fullForm ;
smart:usedInCountry "FR" ;
smart:isPartOfSpeech part-of-speech-type:noun .
ex:label_4
a smart:Term, skosxl:Label ;
skosxl:literalForm "finalité prévue"@fr ;
smart:hasTermForm term-form-type:fullForm ;
smart:usedInCountry "FR" ;
smart:isPartOfSpeech part-of-speech-type:noun .
ex:concept_y
a smart:TermEntry, skos:Concept .
PREFIX ex: <https://example.org#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX smart: <https://w3id.org/standards/smart/ontologies/core/>
# CQ: How do I refer to technical concept X in french?
SELECT ?concept ?definition ?term ?language ?term_type ?term_form ?term_pos ?used_in_country
WHERE {
VALUES ?language { "en" }
VALUES (?has_label ?term_type) {
(skosxl:prefLabel "Preferred term")
(skosxl:altLabel "Admitted term")
(ex:deprecatedLabel "Deprecated term")
}
?concept rdf:type smart:TermEntry ;
?has_label ?label ;
skos:definition ?definition.
?label rdf:type smart:Term ;
skosxl:literalForm ?term ;
smart:hasTermForm ?term_form ;
smart:isPartOfSpeech ?term_pos .
FILTER(LANG(?term) = ?language)
FILTER(LANG(?definition) = ?language)
OPTIONAL {
?label smart:usedInCountry ?used_in_country .
}
} ORDER BY ?term
Running this query on the example will return the following result:
| concept | definition | term | language | term_type | term_form | term_pos | used_in_country |
|---|---|---|---|---|---|---|---|
| https://example.org#concept_x | use of a product, process or service in accordance with the specifications, instructions and information provided by the manufacturer | intended purpose | en | Admitted term | https://w3id.org/standards/smart/taxonomies/term-form-type/fullForm | https://w3id.org/standards/smart/taxonomies/part-of-speech-type/noun | GB |
| https://example.org#concept_x | use of a product, process or service in accordance with the specifications, instructions and information provided by the manufacturer | intended purpose | en | Admitted term | https://w3id.org/standards/smart/taxonomies/term-form-type/fullForm | https://w3id.org/standards/smart/taxonomies/part-of-speech-type/noun | US |
| https://example.org#concept_x | use of a product, process or service in accordance with the specifications, instructions and information provided by the manufacturer | intended use | en | Preferred term | https://w3id.org/standards/smart/taxonomies/term-form-type/fullForm | https://w3id.org/standards/smart/taxonomies/part-of-speech-type/noun | GB |
| https://example.org#concept_x | use of a product, process or service in accordance with the specifications, instructions and information provided by the manufacturer | intended use | en | Preferred term | https://w3id.org/standards/smart/taxonomies/term-form-type/fullForm | https://w3id.org/standards/smart/taxonomies/part-of-speech-type/noun | US |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix smart: <https://w3id.org/standards/smart/ontologies/core/> .
smart:TermEntryShape
a sh:NodeShape ;
sh:targetClass smart:TermEntry ;
sh:property [
sh:path skosxl:prefLabel ;
sh:nodeKind sh:IRI ;
sh:class smart:Term ;
sh:class skosxl:Label ;
sh:minCount 1 ;
sh:node smart:TermShape ;
] ;
sh:property [
sh:path ( skosxl:prefLabel skosxl:literalForm ) ;
sh:minCount 1 ;
sh:uniqueLang true ;
sh:datatype rdf:langString ;
] ;
sh:property [
sh:path skosxl:altLabel ;
sh:nodeKind sh:IRI ;
sh:class smart:Term ;
sh:class skosxl:Label ;
sh:node smart:TermShape ;
] ;
sh:property [
sh:path smart:deprecatedLabel ;
sh:nodeKind sh:IRI ;
sh:class smart:Term ;
sh:class skosxl:Label ;
sh:node smart:TermShape ;
] ;
sh:property [
sh:path prov:qualifiedDerivation ;
sh:nodeKind sh:BlankNodeOrIRI ;
sh:class prov:Derivation ;
sh:node smart:DerivationShape ;
] ;
sh:property [
sh:path skos:scopeNote ;
sh:datatype rdf:langString ;
] ;
sh:property [
sh:path skos:definition ;
sh:datatype rdf:langString ;
sh:minCount 1 ;
sh:uniqueLang true ;
] ;
sh:property [
sh:path dcterms:identifier ;
sh:datatype xsd:string ;
] ;
.
smart:TermShape
a sh:NodeShape ;
sh:targetClass smart:Term ;
sh:property [
sh:path smart:hasTermFormType ;
sh:nodeKind sh:IRI ;
sh:class smart:TermFormType ;
sh:class skos:Concept ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path smart:hasPartOfSpeechType ;
sh:nodeKind sh:IRI ;
sh:class smart:PartOfSpeechType ;
sh:class skos:Concept ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
.
smart:DerivationShape
a sh:NodeShape ;
sh:targetClass prov:Derivation ;
sh:property [
sh:path prov:entity ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path skos:changeNote ;
sh:datatype rdf:langString ;
] ;
.