You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Dave Reynolds (JIRA)" <ji...@apache.org> on 2018/02/28 09:04:00 UTC

[jira] [Comment Edited] (JENA-1496) Inference with SPARQL and GenericRuleReasoner gives different results

    [ https://issues.apache.org/jira/browse/JENA-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16379980#comment-16379980 ] 

Dave Reynolds edited comment on JENA-1496 at 2/28/18 9:03 AM:
--------------------------------------------------------------

This seems to be a question for the email list rather than a bug report.

In both the sparql and rule cases you are attempting to assert a triple whose *subject* is a literal, that's not allowed by the RDF data model.

Under the hood Jena does allow generalized triples (i.e. no restrictions on what can be in the subject or predicate position) in the Graph/Node layer but those are not allow in the Model/Resource/Literal layer. So SPARQL is correctly not constructing the illegal triples. The rule engine is inferring them in the Graph layer but it hides them from the Model interface so as to be conformant with the RDF specs.

Basically you can't express something like:

  "my literal" rdf:type rdf:PlainLiteral

in RDF directly.

 


was (Author: der):
This seems to be a question for the email list rather than a bug report.

In both the sparql and rule cases you are attempting to assert a triple whose *subject* is a literal, that's not allowed by the RDF data model.

Under the hood Jena does allow generalized triples (i.e. no restrictions on what can be in the subject or predicate position) in the Graph/Node layer but those are not allow in the Model/Resource/Literal layer. So SPARQL is correctly not constructing the illegal triples. The rule engine is inferring them in the Graph layer but it hides them from the Model interface so as to be conformant with the RDF specs.

Basically you can't express something like:

  "my literal" rdf:type rdf:PlainLiteral

in RDF at all.

 

> Inference with SPARQL and GenericRuleReasoner gives different results
> ---------------------------------------------------------------------
>
>                 Key: JENA-1496
>                 URL: https://issues.apache.org/jira/browse/JENA-1496
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: Jena 3.6.0
>            Reporter: Arhs Team
>            Priority: Minor
>         Attachments: DemoApplication.java
>
>
> Hi,
> we are trying to manually infer some properties based on the SKOS definition. Some of our models are huge and cannot be handled by Jena.
> We tried OWL reasoner (+micro, +mini) and binding the SKOS definition with bindSchema, we also tried the GenericRuleReasoner with OWL reasoning capabilities but nothing worked. Some inference never finished, was too slow or the memory consumption was too big.
> We are now trying to do a lightweight inference of some properties with SPARQL queries or Rules defined in the GenericRuleReasoner (without OWL reasoning). In the rules, we manually create the triples we need : a skos:narrower b -> b skos:broader a, we don't define skos:narrower owl:subPropertyOf skos:broader since we don't have reasoning capabilities enabled.
> We tried a few things and we found some inconsistencies between how a model is updated with SPARQL queries and the GenericRuleReasoner if the object is a resource or a literal.
> The attached DemoApplication.java gives the following result:
> ---------------------------------------------------------------------
> ==== Test adding reasoner inferred object literal - not added
> Size model 1, print : 
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> "http://url.com/two" .
> Size inf 2, print : 
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> "http://url.com/two" .
> Add inf to model
> Size new model 1, print : 
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> "http://url.com/two" .
> Size deduction model : 1
> ==== Test adding reasoner inferred object resource - added
> Size model 1, print : 
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> <http://url.com/two> .
> Size inf 2, print : 
> <http://url.com/two>  a  <http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> .
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> <http://url.com/two> .
> Add inf to model
> Size new model 2, print : 
> <http://url.com/one>  <http://www.w3.org/2008/05/skos-xl#literalForm> <http://url.com/two> .
> <http://url.com/two>  a  <http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral> .
> Size deduction model : 1
> ==== Test adding sparql inferred object literal - construct model empty
> Size model 1
> Size construct model 0
> Add construct model to model
> Size new model 1
> ==== Test adding sparql inferred object resource - added 
> Size model 1
> Size construct model 1
> Add construct model to model
> Size new model 2
> ---------------------------------------------------------------------
> When the object is a resource, a new triple is inferred, visible and can be added to another model for both SPARQL update or GenericRuleReasoner.
> When the object is a literal, the SPARQL construct query doesn't return anything, the GenericRuleReasoner infers a triple but it is not visible when printing the model and we cannot add the triple to another model. With the generic rule reasoner, we can still see that there is a triple inferred in the deduction model but we cannot do anything with it.
> This is causing some troubles for us because we don't know how to handle that kind of scenarios based on invalid initial query/rule. 
> Thank you.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)