Giter Site home page Giter Site logo

Conversion Exception about openllet HOT 7 CLOSED

galigator avatar galigator commented on May 24, 2024
Conversion Exception

from openllet.

Comments (7)

LorenzBuehmann avatar LorenzBuehmann commented on May 24, 2024 2

I don't know what you guys are trying to achieve, but neither

?onClass owl:Class 'x'

nor

?onClass owl:Class ?x

are useful triple patterns in SPARQL and won't match any RDF data. owl:Class is never used as predicate and I guess you mean something different.

Please understand that an individual is assigned to a class by rdf:type relation.

If I assume that you want to find the classes of a given individual, the query should look like

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?cls WHERE {
 <THE_URI_OF_THE_INDIVIDUAL> rdf:type ?cls
}

from openllet.

Galigator avatar Galigator commented on May 24, 2024

Thx for your example.

The problem is in .as(Individual.class) , because sparql answer of sparql don't have OWL type, you can directly cast an Resource (an answer) into an Individual.
Looking at the query there is no way to tell if 'x' is an Individual, Property, or Class.
Imagine a different ontology, you could have more than one result, first could be an Individual and second an Property.

So to get the classes of the Resource 'x' you may need another query in the form :
?onClass owl:Class 'x'

The openllet-query artifact, don't have dependency on Jena. So It will never be able to convert Resource into Individual for you.

from openllet.

greeny277 avatar greeny277 commented on May 24, 2024

Thanks a lot.
I've written another query as you told:

 SELECT ?onClass
 WHERE { ?onClass owl:Class ?x}

It is invoked with the first QuerySolution. Sadly it returns an empty set and the following warning:

openllet.jena.graph.query.GraphQueryHandler findTriple No query handler found for * http://www.w3.org/2002/07/owl#Class http://www8.cs.fau.de/research:cgm/schizophrenia#R_AcuteSchizophrenia

Any idea what I'm still missing?

from openllet.

greeny277 avatar greeny277 commented on May 24, 2024

Thanks a lot @LorenzBuehmann . This does it for me.

from openllet.

greeny277 avatar greeny277 commented on May 24, 2024

Dave Reynolds suggests on the Dashboard that

[...] SparqlDLExecutionFactory is returning resources that aren't in the expected model [...]

His workaround does it for me either:
Individual in = qs.getResource("x").inModel(m).as(Individual.class);

So I'm not sure if it is a bug or desired behavior. Let me know and I close the issue.

from openllet.

Galigator avatar Galigator commented on May 24, 2024

After doing some tracing in the code, I found where the model change.
I belive, the model change because the result is build from the KB not from the original model.
The result could can contains resources that aren't part of the original model but are created by reasoning : like "Inv(property)".

I am not sure of the expected behaviour.
By the way none of the examples using Sparql(neither in pellet-2.3.6-ansell) are working, so I have to repairs them before tagging this as a bug or a feature.

from openllet.

Galigator avatar Galigator commented on May 24, 2024

I just commit a correction for the sparql example.

Dave Reynolds say the issue is in Openllet... he's opinion.

All the classes involve in the construction of the Resource are from Jena.
The logical chain is the following :

Dataset dataset = DatasetFactory.create(modelFromUser);
 //Here reasoning on the dataset take place.
Model model = dataset.getDefaultModel();
new org.apache.jena.sparql.core.ResultBinding(model, binding); // this is the result.

This look clear to me, I see no reason to change it; issue is in Jena way to interact with world.

from openllet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.