Hi there,
There are two ways (maybe more!)
1/ Query with SPARQL the inference model.
The Jena reasoners all provide an "inf model" which is the base data and
all the inferred triples.
Not all inference can be done this way (some cases of OWL-DL with
disjunction can't be turned into triples) but Jena reasoners don't
support that level of inference.
2/ Some things can be done in SPARQL:
SELECT * {
?x rdf:type/rdfs:subClassOf* ?Type
}
is all ?x and its types, including up the subClass hierarchy.
SELECT * { ?x ?p ?v . ?p rdfs:subPropertyOf* :property }
is subPropertyOf (and quite inefficient!)
Pre-computing the transitive rdfs:subClassOf* improves performance.
It is hard to write queries that cover multiple inference rules - e.g.
using mixed domain/range and also subClassOf - because they mutually
depend on each other.
3/ And you can create data with assignments:
SELECT ?s ?w { ?s :p ?v . BIND( ?v +1 AS ?w) }
That's more like a simple business rule than ontology.
Andy
On 05/12/2018 16:15, Manuel Enrique Puebla Martinez wrote:
Hello:
Is it possible to infer new knowledge about an ontology only from a query in
SPARQL?
I have a question about the use of the SPARQL language about ontologies. So far
I have thought that SPARQL is the equivalent to the SQL language in the
relational databases, that is to say, that with SPARQL it is only possible to
consult the data that are explicitly in the ontology, without having access to
the data that can be inferred , leaving the responsibility of the inference to
the reasoners.
However, I have read documents from which I infer that SPARQL does have the capacity to infer implicit and non-explicit knowledge in the ontology. Is my inference true? That is, is it possible to infer knowledge through a SPARQL query without the need for a reasoner? If the answer is true, then what advantages does the use of a reasoner have over the use of SPARQL?
Greetings, Manuel Puebla.