Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conservativity verification #30

Merged
merged 3 commits into from
Jun 23, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
# This is where Makefile artifacts and dependencies go
build/lib

old-prov-triples.ttl
new-prov-triples.ttl

# Ontop files
*.properties
4 changes: 2 additions & 2 deletions prov-bfo-directmappings.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-bfo-directmappings.ttl>
a owl:Ontology;
rdfs:label "Basic Formal Ontology (BFO) ISO 21838-2:2020 mappings for W3C PROVenance Interchange Ontology (PROV-O)"@en ;
owl:versionInfo "2024-05-27"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-05-27> ;
owl:versionInfo "2024-06-23"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-06-23> ;
dc:contributor "Tim Prudhomme", "Giacomo De Colle" , "Austin Liebers" , "Alec Sculley" , "Peihong Karl Xie", "Sydney Cohen", "John Beverley" ;
dc:license <https://creativecommons.org/publicdomain/zero/1.0/> ;
prov:wasDerivedFrom <http://www.w3.org/ns/prov> ,
Expand Down
43 changes: 32 additions & 11 deletions prov-cco-directmappings.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-cco-directmappings.ttl>
a owl:Ontology;
rdfs:label "Common Core Ontologies (CCO) mappings for W3C PROVenance Interchange Ontology (PROV-O)"@en ;
owl:versionInfo "2024-05-27"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-05-27> ;
owl:versionInfo "2024-06-23"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-06-23> ;
owl:imports <https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-bfo-directmappings.ttl> ;
rdfs:comment "This mapping depends on the imported PROV-O to BFO mapping" ;
dc:contributor "Tim Prudhomme", "Giacomo De Colle" , "Austin Liebers" , "Alec Sculley" , "Peihong Karl Xie", "Sydney Cohen", "John Beverley" ;
Expand Down Expand Up @@ -265,15 +265,6 @@ prov:pairKey rdf:type owl:ObjectProperty .
rdfs:comment "A Key-Entity Pair is about a key because Key-Entity Pairs are Information Content Entities"@en .


prov:insertedKeyEntityPair rdf:type owl:ObjectProperty .
[] rdf:type owl:Axiom ;
owl:annotatedSource prov:insertedKeyEntityPair ;
owl:annotatedProperty rdfs:subPropertyOf ;
owl:annotatedTarget cco:has_output ;
sssom:object_label "has output" ;
rdfs:comment "Insertion of a Key-Entity Pair has output that Key-Entity Pair"@en .


# PROV-AQ object property mappings
prov:has_anchor rdf:type owl:ObjectProperty .
[] rdf:type owl:Axiom ;
Expand Down Expand Up @@ -518,4 +509,34 @@ prov:qualifiedInvalidation rdf:type owl:ObjectProperty .
] ;
rdf:rest rdf:nil
]
] .


# prov:insertedKeyEntityPair(?x,?y) ^ obo:BFO_0000015(?x) -> cco:has_output(?x,?y)
[ <http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean ;
rdfs:comment "If the Insertion of a Key-Entity Pair is a process, then that Insertion has output that Key-Entity Pair"@en ;
rdfs:label "Insertion insertedKeyEntityPair -> has_output" ;
rdf:type swrl:Imp ;
swrl:body [ rdf:type swrl:AtomList ;
rdf:first [ rdf:type swrl:IndividualPropertyAtom ;
swrl:propertyPredicate prov:insertedKeyEntityPair ;
swrl:argument1 :x ;
swrl:argument2 :y
] ;
rdf:rest [ rdf:type swrl:AtomList ;
rdf:first [ rdf:type swrl:ClassAtom ;
swrl:classPredicate obo:BFO_0000015 ;
swrl:argument1 :x
] ;
rdf:rest rdf:nil
]
] ;
swrl:head [ rdf:type swrl:AtomList ;
rdf:first [ rdf:type swrl:IndividualPropertyAtom ;
swrl:propertyPredicate cco:has_output ;
swrl:argument1 :x ;
swrl:argument2 :y
] ;
rdf:rest rdf:nil
]
] .
4 changes: 2 additions & 2 deletions prov-ro-directmappings.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-ro-directmappings.ttl>
a owl:Ontology;
rdfs:label "Relation Ontology (RO) mappings for W3C PROVenance Interchange Ontology (PROV-O)"@en ;
owl:versionInfo "2024-05-27"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-05-27> ;
owl:versionInfo "2024-06-23"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-06-23> ;
owl:imports <https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-bfo-directmappings.ttl> ;
rdfs:comment "This mapping depends on the imported PROV-O to BFO mapping." ;
dc:contributor "Tim Prudhomme", "Giacomo De Colle" , "Austin Liebers" , "Alec Sculley" , "Peihong Karl Xie", "Sydney Cohen", "John Beverley" ;
Expand Down
30 changes: 22 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ config.DEV_IRI := $(config.ONTOLOGY-IRI)/dev
config.MODULES_IRI := $(config.DEV_IRI)/modules

# Local project directories
config.SOURCE_DIR := /
config.TEMP_DIR := build/artifacts
config.RELEASE_DIR := /
config.REPORTS_DIR := $(config.TEMP_DIR)
config.QUERIES_DIR := sparql
config.IMPORTS_DIR := imports
config.LIBRARY_DIR := ../build/lib
config.SOURCE_DIR := /
config.TEMP_DIR := build/artifacts
config.RELEASE_DIR := /
config.REPORTS_DIR := $(config.TEMP_DIR)
config.QUERIES_DIR := sparql
config.CONSTRUCT_QUERIES_DIR := sparql/construct
config.IMPORTS_DIR := imports
config.LIBRARY_DIR := ../build/lib

# Settings
# These will cause targets run by a Github Action to fail, if desired
Expand Down Expand Up @@ -61,6 +62,9 @@ candidates-complex:
$(ROBOT) query --input $(EDITOR_BUILD_FILE) -q $(config.QUERIES_DIR)/candidate-superproperties-complex.rq $(config.TEMP_DIR)/candidate-superproperties-complex.tsv --use-graphs true ;


# Axioms to materialize in reasoning
AXIOM_GENERATORS = "SubClass EquivalentClass SubObjectProperty EquivalentObjectProperty InverseObjectProperties"

# Check for unmapped terms after materializing inferred mappings (after removing individuals)
unmapped:
$(ROBOT) remove --input $(EDITOR_BUILD_FILE) --select individuals \
Expand All @@ -70,9 +74,19 @@ unmapped:
# Materialize all mappings as a list
inferred-mappings:
$(ROBOT) remove --input $(EDITOR_BUILD_FILE) --select individuals \
reason --reasoner HermiT --axiom-generators "SubClass SubObjectProperty InverseObjectProperties" --include-indirect true \
reason --reasoner HermiT --axiom-generators $(AXIOM_GENERATORS) --include-indirect true \
query --output-dir $(config.TEMP_DIR) --queries $(config.QUERIES_DIR)/inferred-mappings.rq --use-graph true

# Materialize old and new entailments, then compare the differences. This doesn't include disjoint axioms.
deductive-diff:
$(ROBOT) remove --input $(EDITOR_BUILD_FILE) --select individuals \
reason --reasoner HermiT --axiom-generators $(AXIOM_GENERATORS) --include-indirect true \
query --query $(config.CONSTRUCT_QUERIES_DIR)/prov-triples.rq $(config.TEMP_DIR)/new-prov-triples.ttl --use-graph true

$(ROBOT) reason --input $(config.IMPORTS_DIR)/PROV/prov-ontologies.ttl --reasoner HermiT --axiom-generators $(AXIOM_GENERATORS) --include-indirect true \
query --query $(config.CONSTRUCT_QUERIES_DIR)/prov-triples.rq $(config.TEMP_DIR)/old-prov-triples.ttl --use-graph true
$(ROBOT) diff --left $(config.TEMP_DIR)/old-prov-triples.ttl --right $(config.TEMP_DIR)/new-prov-triples.ttl --output $(config.TEMP_DIR)/deductive-diff.txt


# Remove CCO individuals to speed up reasoner
config.CCO_FILENAME = ../MergedAllCoreOntology-v1.4-2023-04-07
Expand Down
1 change: 1 addition & 0 deletions src/build/artifacts/deductive-diff.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ontologies are identical
4 changes: 0 additions & 4 deletions src/build/artifacts/inferred-mappings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ End,http://www.w3.org/2000/01/rdf-schema#subClassOf,process boundary
Entity,http://www.w3.org/2000/01/rdf-schema#subClassOf,continuant
Generation,http://www.w3.org/2000/01/rdf-schema#subClassOf,process boundary
Influence,http://www.w3.org/2000/01/rdf-schema#subClassOf,occurrent
Insertion,http://www.w3.org/2000/01/rdf-schema#subClassOf,process
InstantaneousEvent,http://www.w3.org/2000/01/rdf-schema#subClassOf,occurrent
Invalidation,http://www.w3.org/2000/01/rdf-schema#subClassOf,process boundary
Key-Entity Pair,http://www.w3.org/2000/01/rdf-schema#subClassOf,generically dependent continuant
Expand All @@ -24,7 +23,6 @@ Person,http://www.w3.org/2000/01/rdf-schema#subClassOf,Person
Plan,http://www.w3.org/2000/01/rdf-schema#subClassOf,generically dependent continuant
Plan,http://www.w3.org/2000/01/rdf-schema#subClassOf,Information Content Entity
Publish,http://www.w3.org/2000/01/rdf-schema#subClassOf,process
Removal,http://www.w3.org/2000/01/rdf-schema#subClassOf,process
Replace,http://www.w3.org/2000/01/rdf-schema#subClassOf,process
RightsAssignment,http://www.w3.org/2000/01/rdf-schema#subClassOf,process
Role,http://www.w3.org/2000/01/rdf-schema#subClassOf,role
Expand Down Expand Up @@ -84,8 +82,6 @@ has_provenance,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,is subject of
influenced,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,causally related to
influencer,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,causally related to
informed,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,causally related to
insertedKeyEntityPair,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,has participant
insertedKeyEntityPair,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,has output
invalidated,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,has participant
invalidated,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,has participant
invalidated,http://www.w3.org/2000/01/rdf-schema#subPropertyOf,has participant
Expand Down
2 changes: 1 addition & 1 deletion src/catalog-v001.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<uri name="https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-ro-directmappings.ttl" uri="../prov-ro-directmappings.ttl"/>
<uri name="https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-cco-directmappings.ttl" uri="../prov-cco-directmappings.ttl"/>
<!-- Cached ontologies -->
<uri name="https://raw.githubusercontent.com/BFO-ontology/BFO-2020/master/src/owl/bfo-core.ttl" uri="imports/BFO/bfo-core.ttl"/>
<!-- <uri name="https://raw.githubusercontent.com/BFO-ontology/BFO-2020/master/src/owl/bfo-core.ttl" uri="imports/BFO/bfo-core.ttl"/> -->
<uri name="https://raw.githubusercontent.com/CommonCoreOntology/CommonCoreOntologies/master/cco-merged/MergedAllCoreOntology-v1.5-2024-02-14.ttl" uri="imports/BFO/MergedAllCoreOntology-v1.5-2024-02-14.ttl"/>
<uri name="https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/src/imports/RO-imports-extracted.ttl" uri="imports/RO-imports-extracted.ttl"/>
<!-- Other ontologies -->
Expand Down
16 changes: 16 additions & 0 deletions src/imports/BFO/bfo-ontologies.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@base <bfo-ontologies.ttl> .

<bfo-ontologies.ttl>
a owl:Ontology;
rdfs:comment "This file is used for analytics only"@en ;
owl:imports <https://raw.githubusercontent.com/BFO-ontology/BFO-2020/master/src/owl/bfo-core.ttl>, # BFO Core
# <http://purl.obolibrary.org/obo/bfo/2020/bfo.owl> , # BFO temporalized relations

# <http://purl.obolibrary.org/obo/ro/releases/2024-02-13/ro.owl> , # Don't import all of RO, only import dependent terms below:
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/src/imports/RO-imports-extracted.ttl>, # RO imports

<https://raw.githubusercontent.com/CommonCoreOntology/CommonCoreOntologies/master/cco-merged/MergedAllCoreOntology-v1.5-2024-02-14.ttl>, # CCO
.
4 changes: 2 additions & 2 deletions src/prov-mappings-edit.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
a owl:Ontology;
rdfs:label "Editor's file for PROV-BFO Mappings."@en ;
rdfs:comment "Open this in Protege to view the full mapping in context. Test the mapping with the imports in this file. This keeps imports out of the release version."@en ;
owl:versionInfo "2024-05-27"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-05-27> ;
owl:versionInfo "2024-06-23"@en ;
owl:versionIRI <https://github.com/BFO-Mappings/PROV-to-BFO/releases/tag/v2024-06-23> ;
owl:imports <https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-bfo-directmappings.ttl> , # Release version of PROV-BFO containing actual mappings
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-ro-directmappings.ttl> , # Release version of PROV-RO containing actual mappings
<https://raw.githubusercontent.com/BFO-Mappings/PROV-to-BFO/main/prov-cco-directmappings.ttl> , # Release version of PROV-CCO containing actual mappings
Expand Down
18 changes: 18 additions & 0 deletions src/sparql/constructs/prov-triples.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX bfo: <http://purl.obolibrary.org/obo/BFO_>

CONSTRUCT {
?targetTerm ?predicate ?sourceTerm
} WHERE {
FILTER (
STRSTARTS(STR(?targetTerm), STR(prov:)) &&
STRSTARTS(STR(?sourceTerm), STR(prov:))
)
?targetTerm ?predicate ?sourceTerm .
}
2 changes: 1 addition & 1 deletion src/sparql/inferred-mappings.rq
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PREFIX ro: <http://purl.obolibrary.org/obo/RO_>
PREFIX cco: <http://www.ontologyrepository.com/CommonCoreOntologies/>

# Note: filters only work when all referenced terms and their axioms are succesfully imported
# Note: this should be used after materializing all mappings, however this query does not necessarily show all mappings
# Note: this should be used after materializing all mappings, however this query does not necessarily show all mappings (ex. SWRL rules)
SELECT ?targetTermLabel ?predicate ?sourceTermLabel
WHERE {
VALUES ?termType { owl:Class owl:ObjectProperty } .
Expand Down
Loading