If I want to infer that "Obama bornIn USA" from these facts:
Obama bornIn Hawaii
Hawaii partOf USA
Are these two facts sufficient to make the inference? If yes, should RDFS or OWL be used to represent the facts? Is there some online SPARQL tool that I can quickly test those facts specification and inference based on the facts?
Nobody knows what is bornIn
or partOf
. You should find an appropriate ontology or model this stuff yourself. There are several ways to do it.
OWL 2 capabilities
OWL 2 DL capabilities are sufficient to make the inference you want.
All you need is a property chain.
Here below a sample ontology serialized into the RDF Turtle format.
@prefix : <http://www.semanticweb.org/ontologies/ontology#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.semanticweb.org/ontologies/ontology> rdf:type owl:Ontology .
:Obama rdf:type owl:NamedIndividual ; :bornIn :Honolulu .
:Honolulu rdf:type owl:NamedIndividual ; :partOf :Hawaii .
:Hawaii rdf:type owl:NamedIndividual ; :partOf :USA .
:USA rdf:type owl:NamedIndividual .
:bornIn rdf:type owl:ObjectProperty ; owl:propertyChainAxiom ( :bornIn :partOf ) .
:partOf rdf:type owl:ObjectProperty .
Common rule languages
You could replace the property chain axiom with the following SWRL rule.
bornIn(?person, ?place1) ^ partOf(?place1, ?place2) -> bornIn(?person, ?place2)
SWRL operates on ontological level. Other more or less common rule languages (e.g. SPIN) operate on RDF serialization level.
Triplestore-specific rule languages
In GraphDB, you could define a "ruleset" of this kind:
Prefices { obama: http://www.semanticweb.org/ontologies/ontology# }
Axioms { }
Rules
{
Id: custom
a <obama:bornIn> b
b <obama:partOf> c
-----------------------
a <obama:bornIn> c
}
Is there some online SPARQL tool that I can quickly test those facts
specification and inference based on the facts?
Questions asking to recommend or find a tool or other off-site resource are off-topic for SO. However, the table below compares some popular tools.
+---------+-----+------+-----+-------+
| | OWL | SWRL | … | rules |
+---------+-----+------+-----+-------+
| Protege | + | + | … | – |
| Stardog | + | + | … | + |
| GraphDB | ± | – | … | + |
| … | … | … | … | … |
+---------+-----+------+-----+-------+
I'd suggest you try GraphDB Cloud. When creating a repository:
- load the ruleset above, if you want to use GraphDB's rule language, or
- select the built-in OWL-RL ruleset, if you want to use OWL 2 capabilities.