Skip to content

Commit

Permalink
Deductive diff check, remap prov:insertedKeyEntityPair, fix Protege i…
Browse files Browse the repository at this point in the history
…mport, extra dev resources
  • Loading branch information
tmprd committed Jun 22, 2024
1 parent 0ebed41 commit ac147fc
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 16 deletions.
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
39 changes: 30 additions & 9 deletions prov-cco-directmappings.ttl
Original file line number Diff line number Diff line change
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
]
] .
15 changes: 14 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 +73,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.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.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
.
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
18 changes: 18 additions & 0 deletions src/sparql/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 .
}

0 comments on commit ac147fc

Please sign in to comment.