Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions patterns/change of qualities with TQCs/shape-data.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix si: <https://si-digital-framework.org/SI#> .
@prefix : <https://w3id.org/pmd/co/test#> .
@prefix ex: <https://www.example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <https://w3id.org/pmd/co/test#> .


<https://w3id.org/pmd/co/shapes/change_of_quality_with_tqc/> rdf:type owl:Ontology .

@prefix independent_continuant: <http://purl.obolibrary.org/obo/BFO_0000004> .
@prefix material: <https://w3id.org/pmd/co/PMD_0000000> .
@prefix object: <http://purl.obolibrary.org/obo/BFO_0000030> .
@prefix temporally_qualified_continuant: <https://w3id.org/pmd/co/PMD_0000068> .
@prefix exists_at: <http://purl.obolibrary.org/obo/BFO_0000108> .
@prefix temporal_region: <http://purl.obolibrary.org/obo/BFO_0000008> .
@prefix quality: <http://purl.obolibrary.org/obo/BFO_0000019> .
@prefix has_characteristic: <http://purl.obolibrary.org/obo/RO_0000053> .
@prefix has_state: <https://w3id.org/pmd/co/PMD_0000069> .
@prefix is_state_of: <https://w3id.org/pmd/co/PMD_0000070> .
@prefix thickness: <https://w3id.org/pmd/co/PMD_0050153> .
@prefix specified_by_value: <https://w3id.org/pmd/co/PMD_0000077> .
@prefix svs: <http://purl.obolibrary.org/obo/OBI_0001931> .
@prefix has_specified_numeric_value: <http://purl.obolibrary.org/obo/OBI_0001937> .
@prefix has_measurement_unit_label: <http://purl.obolibrary.org/obo/IAO_0000039> .


thickness: rdfs:subClassOf quality: .
material: rdfs:subClassOf independent_continuant: .

# Define anchor/base
ex:base_material a material: .
ex:base_material has_state: ex:object_at_t1 .
ex:base_material has_state: ex:object_at_t2 .

# tcq1 has quality thickness with value 40 mm
ex:object_at_t1 a temporally_qualified_continuant: .
ex:object_at_t1 a object: .
ex:object_at_t1 is_state_of: ex:base_material .
ex:object_at_t1 has_characteristic: ex:thickness_t1 .
ex:thickness_t1 a thickness: .
ex:thickness_t1 specified_by_value: ex:SVS_40_mm .
ex:SVS_40_mm a svs: ;
has_measurement_unit_label: <http://purl.obolibrary.org/obo/UO_0000016> ; # millimeter
has_specified_numeric_value: "40"^^xsd:float .



# tcq2 has quality thickness with value 2.5 mm
ex:object_at_t2 a temporally_qualified_continuant: .
ex:object_at_t2 a object: .
ex:object_at_t2 is_state_of: ex:base_material .
ex:object_at_t2 has_characteristic: ex:thickness_t2 .
ex:thickness_t2 a thickness: .
ex:thickness_t2 specified_by_value: ex:SVS_2.5_mm .
ex:SVS_2.5_mm a svs: ;
has_measurement_unit_label: <http://purl.obolibrary.org/obo/UO_0000016> ; # millimeter
has_specified_numeric_value: "2.5"^^xsd:float .
73 changes: 73 additions & 0 deletions patterns/change of qualities with TQCs/shape.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix pmd: <https://w3id.org/pmd/co/> .
@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#> .
@prefix shape: <https://w3id.org/pmd/co/shapes/change_of_quality_with_tqc/> .
@base shape: .

shape:tqc_pair_quality_change
a sh:NodeShape ;
sh:targetClass pmd:PMD_0000068 ; # temporally qualified continuant
sh:description """
For any TQC (tqc1) that is a state of some base individual, if there exists
another TQC (tqc2) that is also a state of the same individual, and both TQCs
bear qualities of the same lowest-level class, then those quality values must differ.
This captures that a change of quality actually occurred between two states.
""" ;

sh:severity sh:Violation ;
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." ;

sh:sparql
[
a sh:SPARQLConstraint ;
sh:select """
PREFIX pmd: <https://w3id.org/pmd/co/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT $this ?tqc2 ?sharedQualityClass ?svs1 ?svs2
WHERE {

# STEP 1. Both TQCs are states of the same base individual
?baseIndividual pmd:PMD_0000069 $this . # base -->has state--> tqc1
?baseIndividual pmd:PMD_0000069 ?tqc2 . # base -->has state--> tqc2
FILTER ( $this != ?tqc2 ) # they must be distinct TQCs

# STEP 2. tqc1 has quality; find its lowest-level class ─
$this obo:RO_0000053 ?quality1 . # has characteristic
?quality1 a ?sharedQualityClass .
FILTER NOT EXISTS {
?childClass1 rdfs:subClassOf ?sharedQualityClass .
?quality1 a ?childClass1
}

# STEP 3. tqc2 has quality of the same lowest-level class ─
?tqc2 obo:RO_0000053 ?quality2 . # has characteristic
?quality2 a ?sharedQualityClass . # same class as quality1
FILTER NOT EXISTS {
?childClass2 rdfs:subClassOf ?sharedQualityClass .
?quality2 a ?childClass2
}

# STEP 4. Get the concrete values of both qualities
?quality1 pmd:PMD_0000077 ?svs1 . # WARNING: THE PREDICATE MIGHT CHANGE SOON
?quality2 pmd:PMD_0000077 ?svs2 .

?svs1 obo:OBI_0001937 ?value1 ;
obo:IAO_0000039 ?unit1 .

?svs2 obo:OBI_0001937 ?value2 ;
obo:IAO_0000039 ?unit2 .

# STEP 5. The values must NOT be equal — violation if they are ─
FILTER ( ?value1 = ?value2 && ?unit1 = ?unit2)
}
""" ;
] ;

sh:closed false ;
sh:ignoredProperties ( rdf:type owl:topDataProperty owl:topObjectProperty ) .
3 changes: 3 additions & 0 deletions src/ontology/components/pmdco-shared.owl
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,7 @@ EquivalentClasses(:PMD_0080205 ObjectIntersectionOf(obo:OBI_0001931 <http://qudt


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")
AnnotationAssertion(<http://purl.obolibrary.org/obo/IAO_0000114> :PMD_0060001 <http://purl.obolibrary.org/obo/IAO_0000122>)
AnnotationAssertion(<http://purl.obolibrary.org/obo/IAO_0000114> :PMD_0060002 <http://purl.obolibrary.org/obo/IAO_0000122>)

)