How do I state Pat knows Mike's telephone number as a concept and not the concrete phone number 1112223333 in RDF/OWL?
Bonus points to be able to state Mary knows that Pat knows Mike's telephone number....
With a suitable property 'knows' you can use rdf reification:
:Pat :knows [
rdf:subject :Mike ;
rdf:predicate :telephoneNumber ;
rdf:object <tel:1112223333>
]
Few people like reification, but for this sort of thing it's ok. For the second case enjoy double reification:
:Mary :knows [
rdf:subject :Pat ;
rdf:predicate :knows ;
rdf:object [
rdf:subject _:b1 ;
rdf:predicate rdf:subject ;
rdf:object :Mike ;
rdf:subject _:b2 ;
rdf:predicate rdf:predicate ;
... sanity barrier exceeded ...
]
]
If you're happy to go outside a single graph life is simpler. You could just have a couple of files:
FILE1:
:Mary :knowsContentsOf <FILE2>
FILE2:
:Mike :telephoneNumber <tel:1112223333>
Or even stick both in a single file envelope and point to fragments of the file. This is essentially what named graphs give you in SPARQL.
What about the following (using valid OWL DL for fun):
# assume prefixes defined
<> a owl:Ontology .
:Person a owl:Class .
:PhoneNumber a owl:Class .
:knowsThing a owl:ObjectProperty;
rdfs:domain :Person .
:belongsTo a owl:ObjectProperty;
rdfs:range :Person .
:Mike a :Person .
:Pat a :Person;
:knowsThing [
a :PhoneNumber;
:belongsTo :Mike
] .
Your other statement about Mary is more difficult because we are not just speaking of knowing a "thing", we are talking about knowledge about knowledge, which is very inconvenient to do in OWL and RDF. But let us stick to the challenge of doing it in OWL DL, with the following ontology:
<> a owl:Ontology .
:Person a owl:Class .
:PhoneNumber a owl:Class .
:knowsThing a owl:ObjectProperty;
rdfs:domain :Person .
:knownBy a owl:AnnotationProperty;
rdfs:range :Person .
:belongsTo a owl:ObjectProperty;
rdfs:range :Person .
:Mike a :Person .
:Pat a :Person;
:knowsThing _:mikesnumber .
_:mikesnumber a :PhoneNumber;
:belongsTo :Mike .
:Mary a :Person .
[] a owl:Annotation;
owl:annotatedSource :Pat;
owl:annotatedProperty :knowsThing;
owl:annotatedTarget _:mikenumber;
:knownBy :Mary .
The problem is that it won't get you much in terms of reasoning. user205512 and cygri's answers are plausible alternatives but they don't get you much either in terms of reasoning.
For more reasoning capabilities, you could do some crazy stuff like (only works with OWL 2 DL or OWL Full):
:subject a owl:ObjectProperty;
rdfs:domain :Statement .
:predicate a owl:ObjectProperty;
rdfs:domain :Statement .
:object a owl:ObjectProperty;
rdfs:domain :ObjectStatement .
:dataObject a owl:DatatypeProperty;
rdfs:domain :DataStatement .
:hasPhone a owl:DatatypeProperty .
:knowsFact a owl:ObjectProperty;
rdfs:domain :Person;
rdfs:range :Statement .
:ObjectStatement a owl:Class;
rdfs:subClassOf [
owl:onProperty :object;
owl:cardinality 1
] .
:DataStatement a owl:Class;
rdfs:subClassOf [
owl:onProperty :dataObject;
owl:cardinality 1
] .
:Statement a owl:Class;
owl:unionOf ( :ObjectStatement :DataStatement );
rdfs:subClassOf [
owl:onProperty :subject;
owl:cardinality 1
], [
owl:onProperty :predicate;
owl:cardinality 1
] .
:Person a owl:Class .
:Pat :knowsFact [
:subject :Mike;
:predicate :hasPhone
] .
:Mary :knowsFact [
:subject :Pat;
:predicate :knowsFact;
:object [
:subject :Mike;
:predicate :hasPhone
] .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With