Skip to content

Commit b8bf622

Browse files
authored
Merge pull request #420 from materialdigital/417-create-pattern-for-change-of-qualities-in-tqcs
added new pattern to check if a quality of TQCs really changes.
2 parents 070e20d + 41bc754 commit b8bf622

5 files changed

Lines changed: 138 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@prefix mo: <http://purl.org/ontology/mo/> .
2+
@prefix si: <https://si-digital-framework.org/SI#> .
3+
@prefix : <https://w3id.org/pmd/co/test#> .
4+
@prefix ex: <https://www.example.org/> .
5+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
6+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
7+
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
8+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
9+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
10+
@base <https://w3id.org/pmd/co/test#> .
11+
12+
13+
<https://w3id.org/pmd/co/shapes/change_of_quality_with_tqc/> rdf:type owl:Ontology .
14+
15+
@prefix independent_continuant: <http://purl.obolibrary.org/obo/BFO_0000004> .
16+
@prefix material: <https://w3id.org/pmd/co/PMD_0000000> .
17+
@prefix object: <http://purl.obolibrary.org/obo/BFO_0000030> .
18+
@prefix temporally_qualified_continuant: <https://w3id.org/pmd/co/PMD_0000068> .
19+
@prefix exists_at: <http://purl.obolibrary.org/obo/BFO_0000108> .
20+
@prefix temporal_region: <http://purl.obolibrary.org/obo/BFO_0000008> .
21+
@prefix quality: <http://purl.obolibrary.org/obo/BFO_0000019> .
22+
@prefix has_characteristic: <http://purl.obolibrary.org/obo/RO_0000053> .
23+
@prefix has_state: <https://w3id.org/pmd/co/PMD_0000069> .
24+
@prefix is_state_of: <https://w3id.org/pmd/co/PMD_0000070> .
25+
@prefix thickness: <https://w3id.org/pmd/co/PMD_0050153> .
26+
@prefix specified_by_value: <https://w3id.org/pmd/co/PMD_0000077> .
27+
@prefix svs: <http://purl.obolibrary.org/obo/OBI_0001931> .
28+
@prefix has_specified_numeric_value: <http://purl.obolibrary.org/obo/OBI_0001937> .
29+
@prefix has_measurement_unit_label: <http://purl.obolibrary.org/obo/IAO_0000039> .
30+
31+
32+
thickness: rdfs:subClassOf quality: .
33+
material: rdfs:subClassOf independent_continuant: .
34+
35+
# Define anchor/base
36+
ex:base_material a material: .
37+
ex:base_material has_state: ex:object_at_t1 .
38+
ex:base_material has_state: ex:object_at_t2 .
39+
40+
# tcq1 has quality thickness with value 40 mm
41+
ex:object_at_t1 a temporally_qualified_continuant: .
42+
ex:object_at_t1 a object: .
43+
ex:object_at_t1 is_state_of: ex:base_material .
44+
ex:object_at_t1 has_characteristic: ex:thickness_t1 .
45+
ex:thickness_t1 a thickness: .
46+
ex:thickness_t1 specified_by_value: ex:SVS_40_mm .
47+
ex:SVS_40_mm a svs: ;
48+
has_measurement_unit_label: <http://purl.obolibrary.org/obo/UO_0000016> ; # millimeter
49+
has_specified_numeric_value: "40"^^xsd:float .
50+
51+
52+
53+
# tcq2 has quality thickness with value 2.5 mm
54+
ex:object_at_t2 a temporally_qualified_continuant: .
55+
ex:object_at_t2 a object: .
56+
ex:object_at_t2 is_state_of: ex:base_material .
57+
ex:object_at_t2 has_characteristic: ex:thickness_t2 .
58+
ex:thickness_t2 a thickness: .
59+
ex:thickness_t2 specified_by_value: ex:SVS_2.5_mm .
60+
ex:SVS_2.5_mm a svs: ;
61+
has_measurement_unit_label: <http://purl.obolibrary.org/obo/UO_0000016> ; # millimeter
62+
has_specified_numeric_value: "2.5"^^xsd:float .
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
@prefix obo: <http://purl.obolibrary.org/obo/> .
2+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
3+
@prefix pmd: <https://w3id.org/pmd/co/> .
4+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
5+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
6+
@prefix sh: <http://www.w3.org/ns/shacl#> .
7+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
8+
@prefix shape: <https://w3id.org/pmd/co/shapes/change_of_quality_with_tqc/> .
9+
@base shape: .
10+
11+
shape:tqc_pair_quality_change
12+
a sh:NodeShape ;
13+
sh:targetClass pmd:PMD_0000068 ; # temporally qualified continuant
14+
sh:description """
15+
For any TQC (tqc1) that is a state of some base individual, if there exists
16+
another TQC (tqc2) that is also a state of the same individual, and both TQCs
17+
bear qualities of the same lowest-level class, then those quality values must differ.
18+
This captures that a change of quality actually occurred between two states.
19+
""" ;
20+
21+
sh:severity sh:Violation ;
22+
sh:message "Two TQCs that are states of the same individual bear qualities of the same lowest-level class, but their quality values are identical — no change of quality occurred." ;
23+
24+
sh:sparql
25+
[
26+
a sh:SPARQLConstraint ;
27+
sh:select """
28+
PREFIX pmd: <https://w3id.org/pmd/co/>
29+
PREFIX obo: <http://purl.obolibrary.org/obo/>
30+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
31+
32+
SELECT DISTINCT $this ?tqc2 ?sharedQualityClass ?svs1 ?svs2
33+
WHERE {
34+
35+
# STEP 1. Both TQCs are states of the same base individual
36+
?baseIndividual pmd:PMD_0000069 $this . # base -->has state--> tqc1
37+
?baseIndividual pmd:PMD_0000069 ?tqc2 . # base -->has state--> tqc2
38+
FILTER ( $this != ?tqc2 ) # they must be distinct TQCs
39+
40+
# STEP 2. tqc1 has quality; find its lowest-level class ─
41+
$this obo:RO_0000053 ?quality1 . # has characteristic
42+
?quality1 a ?sharedQualityClass .
43+
FILTER NOT EXISTS {
44+
?childClass1 rdfs:subClassOf ?sharedQualityClass .
45+
?quality1 a ?childClass1
46+
}
47+
48+
# STEP 3. tqc2 has quality of the same lowest-level class ─
49+
?tqc2 obo:RO_0000053 ?quality2 . # has characteristic
50+
?quality2 a ?sharedQualityClass . # same class as quality1
51+
FILTER NOT EXISTS {
52+
?childClass2 rdfs:subClassOf ?sharedQualityClass .
53+
?quality2 a ?childClass2
54+
}
55+
56+
# STEP 4. Get the concrete values of both qualities
57+
?quality1 pmd:PMD_0000077 ?svs1 . # WARNING: THE PREDICATE MIGHT CHANGE SOON
58+
?quality2 pmd:PMD_0000077 ?svs2 .
59+
60+
?svs1 obo:OBI_0001937 ?value1 ;
61+
obo:IAO_0000039 ?unit1 .
62+
63+
?svs2 obo:OBI_0001937 ?value2 ;
64+
obo:IAO_0000039 ?unit2 .
65+
66+
# STEP 5. The values must NOT be equal — violation if they are ─
67+
FILTER ( ?value1 = ?value2 && ?unit1 = ?unit2)
68+
}
69+
""" ;
70+
] ;
71+
72+
sh:closed false ;
73+
sh:ignoredProperties ( rdf:type owl:topDataProperty owl:topObjectProperty ) .

patterns/change of quality with tqc/shape-data.ttl renamed to patterns/qualities of TQC vs Anchor (base)/shape-data.ttl

File renamed without changes.
File renamed without changes.

src/ontology/components/pmdco-shared.owl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,7 @@ EquivalentClasses(:PMD_0080205 ObjectIntersectionOf(obo:OBI_0001931 <http://qudt
478478

479479

480480
AnnotationAssertion(:PMD_0000064 obo:OBI_0000417 "https://github.com/search?q=repo%3Amaterialdigital%2Fcore-ontology+path%3A%2F%5Epatterns%5C%2F%2F+OBI_0000417&type=code")
481+
AnnotationAssertion(<http://purl.obolibrary.org/obo/IAO_0000114> :PMD_0060001 <http://purl.obolibrary.org/obo/IAO_0000122>)
482+
AnnotationAssertion(<http://purl.obolibrary.org/obo/IAO_0000114> :PMD_0060002 <http://purl.obolibrary.org/obo/IAO_0000122>)
483+
481484
)

0 commit comments

Comments
 (0)