Skip to content

Commit

Permalink
Srr qudt 2 1 37 (#631)
Browse files Browse the repository at this point in the history
* Copied over new QUDT files

* copy imports to imports/ folder

* import the graph (which removes owl:Ontology decls) after serializing to imports/

* fix small typos

* Cleaned up the QUDT imports graph

* add imports

---------

Co-authored-by: Gabe Fierro <gtfierro@mines.edu>
  • Loading branch information
steveraysteveray and gtfierro committed Apr 15, 2024
1 parent 21c451b commit c685f5b
Show file tree
Hide file tree
Showing 15 changed files with 25,671 additions and 6,729 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Brick.ttl: bricksrc/*.py bricksrc/*.ttl bricksrc/definitions.csv generate_brick.
python handle_extensions.py

clean:
rm Brick.ttl Brick+extensions.ttl
rm -r Brick.ttl Brick+extensions.ttl imports/

format:
black generate_brick.py
Expand Down
2 changes: 2 additions & 0 deletions bricksrc/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"qudtsou": "http://qudt.org/2.1/vocab/sou",
"qudtdv": "http://qudt.org/2.1/vocab/dimensionvector",
"qudtprefix": "http://qudt.org/2.1/vocab/prefix",
"qudtfacade": "http://qudt.org/2.1/schema/facade/qudt",
"qudtusertest": "http://qudt.org/2.1/collection/usertest",
}

shacl_namespace_declarations = [
Expand Down
2 changes: 1 addition & 1 deletion bricksrc/relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
relationships = {
"connectedTo": {
A: [OWL.ObjectProperty, OWL.SymmetricProperty, OWL.IrreflexivProperty],
A: [OWL.ObjectProperty, OWL.SymmetricProperty, OWL.IrreflexiveProperty],
RDFS.label: Literal("Connected To"),
},
"isReplacedBy": {
Expand Down
1 change: 1 addition & 0 deletions generate_brick.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ def handle_deprecations():
os.makedirs("imports", exist_ok=True)
for name, uri in ontology_imports.items():
graph, _ = env.resolve_uri(uri)
graph.serialize(f"imports/{name}.ttl", format="turtle")
env.import_graph(G, graph)

# add new Brick to ontology environment
Expand Down
122 changes: 122 additions & 0 deletions support/COLLECTION_QUDT_USER_TESTS-v2.1.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# baseURI: http://qudt.org/2.1/collection/usertest

@prefix creativecommons: <http://creativecommons.org/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix qkdv: <http://qudt.org/vocab/dimensionvector/> .
@prefix quantitykind: <http://qudt.org/vocab/quantitykind/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@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 skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix vaem: <http://www.linkedmodel.org/schema/vaem#> .
@prefix voag: <http://voag.linkedmodel.org/schema/voag#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://qudt.org/2.1/collection/usertest>
a owl:Ontology ;
rdfs:isDefinedBy <http://qudt.org/2.1/collection/usertest> ;
rdfs:label "QUDT Collection - USER TESTS - v 2.1.37" ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://purl.org/dc/terms/"^^xsd:anyURI ;
sh:prefix "dcterms" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://qudt.org/schema/qudt/"^^xsd:anyURI ;
sh:prefix "qudt" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://qudt.org/vocab/dimensionvector/"^^xsd:anyURI ;
sh:prefix "qkdv" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://qudt.org/vocab/quantitykind/"^^xsd:anyURI ;
sh:prefix "quantitykind" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://qudt.org/vocab/unit/"^^xsd:anyURI ;
sh:prefix "unit" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
sh:prefix "rdf" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI ;
sh:prefix "rdfs" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI ;
sh:prefix "owl" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ;
sh:prefix "skos" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/ns/shacl#"^^xsd:anyURI ;
sh:prefix "sh" ;
] ;
sh:declare [
a sh:PrefixDeclaration ;
sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ;
sh:prefix "xsd" ;
]
.
qudt:DeprecatedPropertyConstraint
a sh:NodeShape ;
rdfs:isDefinedBy <http://qudt.org/2.1/collection/usertest> ;
rdfs:label "Warning about use of a deprecated QUDT property" ;
sh:severity sh:Info ;
sh:sparql [
a sh:SPARQLConstraint ;
rdfs:comment "Warns if a deprecated QUDT property is used" ;
sh:message "Resource, '{$this}' uses the property '{?oldpstr}' which will be deprecated. Please use '{?newpstr}' instead." ;
sh:prefixes <http://qudt.org/2.1/collection/usertest> ;
sh:select """SELECT $this ?p ?oldpstr ?newpstr
WHERE {
?p qudt:deprecated true .
?p a rdf:Property .
$this ?p ?o .
?p dcterms:isReplacedBy ?newp .
BIND (STR(?newp) AS ?newpstr)
BIND (STR(?p) AS ?oldpstr)
}""" ;
] ;
sh:targetClass qudt:Concept ;
.
qudt:DeprecationConstraint
a sh:NodeShape ;
rdfs:isDefinedBy <http://qudt.org/2.1/collection/usertest> ;
rdfs:label "Warning about use of a deprecated QUDT resource" ;
sh:severity sh:Info ;
sh:sparql [
a sh:SPARQLConstraint ;
rdfs:comment "Warns if a deprecated QUDT resource is used" ;
sh:message "Resource, '{?s}' refers to '{?oldqstr}' which has been deprecated. Please refer to '{?newqstr}' instead." ;
sh:prefixes <http://qudt.org/2.1/collection/usertest> ;
sh:select """SELECT ?s $this ?oldqstr ?newqstr
WHERE {
$this qudt:deprecated true .
?s ?p $this .
FILTER (!STRSTARTS(STR(?s),'http://qudt.org')) .
$this dcterms:isReplacedBy ?newq .
BIND (STR(?newq) AS ?newqstr)
BIND (STR($this) AS ?oldqstr)
}""" ;
] ;
sh:targetClass qudt:Concept ;
.
6 changes: 4 additions & 2 deletions support/SCHEMA-FACADE_QUDT-v2.1.ttl
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# baseURI: http://qudt.org/2.1/schema/facade/qudt
# imports: http://qudt.org/2.1/schema/shacl/qudt
# imports: http://qudt.org/2.1/schema/extensions/functions
# imports: http://qudt.org/2.1/collection/qa/all

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@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 skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://qudt.org/2.1/schema/facade/qudt>
a owl:Ontology ;
owl:imports <http://qudt.org/2.1/schema/shacl/qudt> ;
owl:imports <http://qudt.org/2.1/schema/extensions/functions> ;
owl:imports <http://qudt.org/2.1/collection/usertest> ;
owl:versionInfo "Created with TopBraid Composer" ;
rdfs:comment "Facade graph for single place to redirect QUDT schema imports. Note that currently, the functions import uses SPIN and OWL.";
rdfs:label "QUDT SCHEMA Facade graph - v2.1.32" ;
rdfs:label "QUDT SCHEMA Facade graph - v2.1.37" ;
.
Loading

0 comments on commit c685f5b

Please sign in to comment.