Last active
July 4, 2025 16:17
-
-
Save niklasl/cf8871f82564749153d929f747228ef3 to your computer and use it in GitHub Desktop.
OWL-powered truth generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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#> | |
prefix : <http://example.org/ns#> | |
base <http://example.org/> | |
# TBox: | |
:Truth rdfs:subClassOf [ owl:onProperty rdf:reifies ; owl:allValuesFrom :Fact ] . | |
:Fact owl:equivalentClass [ owl:onProperty _:selfOfTypeFact ; owl:hasSelf true ] , | |
[ owl:onProperty rdf:predicate ; | |
owl:allValuesFrom [ owl:onProperty owl:propertyChainAxiom ; | |
owl:hasValue ( | |
[ owl:inverseOf rdf:subject ] | |
_:selfOfTypeFact | |
rdf:object | |
) ] ] . | |
# ABox: | |
[] a :Truth ; | |
rdf:reifies [ rdf:subject <some> ; rdf:predicate :such ; rdf:object <thing> ] , | |
[ rdf:subject <other> ; rdf:predicate :such ; rdf:object <stuff> ] . | |
# Entails: | |
# <some> :such <thing> . | |
# <other> :such <stuff> . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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#> | |
prefix : <http://example.org/ns#> | |
base <http://example.org/> | |
# TBox: | |
:Truth rdfs:subClassOf [ owl:onProperty rdf:reifies ; owl:allValuesFrom :Fact ] . | |
[ owl:onProperty _:a_Fact ; owl:hasSelf true ] owl:equivalentClass :Fact . | |
_:factSubject | |
rdfs:subPropertyOf [ owl:inverseOf rdf:type ] ; | |
owl:propertyChainAxiom ( _:a_Fact rdf:tripleSubject ) . | |
_:factPredicate | |
rdfs:subPropertyOf owl:onProperty ; | |
owl:propertyChainAxiom ( _:a_Fact rdf:triplePredicate ) . | |
_:factObject | |
rdfs:subPropertyOf owl:hasValue ; | |
owl:propertyChainAxiom ( _:a_Fact rdf:tripleObject ) . | |
# ABox: | |
[] a :Truth ; | |
rdf:reifies [ rdf:tripleSubject <some> ; rdf:triplePredicate :such1 ; rdf:tripleObject <thing> ] , | |
[ rdf:tripleSubject <other> ; rdf:triplePredicate :such2 ; rdf:tripleObject <stuff> ] . | |
# Entails: | |
# <some> :such1 <thing> . | |
# <other> :such2 <stuff> . |
Also, I am not sure that your example complies with OWL-RL. More precisely, I suspect that using owl:propertyChainAxiom
as the value of owl:onProperty
does not fit in the syntactic restrictions of OWL-RL, or even the syntactic structure of OWL as such.
Thank you @pchampin for noting this!
You're absolutely right; this appears to say that any property used as a reified predicate in any of these "facts" hold between all subject, objects pairs of every "fact"! That's certainly not desired. (Never use an all-quantifier without checking for more false positives!)
Also yes, that is an important caveat: this may very well be "ill-formed" OWL. Entailing more OWL rules like this is rather hazardous...
Added variant which seems to fare better.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow, that's super clever :-)
However, I don't think it really works as you expect.
If you replaced your Abox with the following (replacing
:such
with:such1
and:such2
):I believe it wouldn't it entail all the following: