Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Pellet doesn't include my SWRL rules

Tania Tudorache tudorache at stanford.edu
Mon Aug 22 16:32:28 PDT 2011


Viktor,

There are some confusions in your email.

Your code uses "pure" Jena API calls, so this is not really a Protege 
questions. It would be better answered on the Jena mailing list.

In your email you say that SQWRL queries work in Protege, but in your 
code you use a SPARQL query and access it through Jena. SQWRL and SPARQL 
are different query languages. SQWRL only works with Protege API. Jena 
has SPARQL support. So, you need to decide which query language you want 
to use.

If you want to use Jena and SPARQL, please post your question on the 
Jena mailing list (it is better to leave out the SQWRL part because it 
is not related in any way, and it will only confuse people).

Tania

On 08/22/2011 07:59 AM, Viktor Taneski wrote:
> I build an ontology which uses SWRL rules to inference. When I do a 
> SQWRL querying in Protege it works fine. The problem is, when i want 
> to use Pellet with Jena, it seems like Pellet doesn't include the SWRL 
> rules in the querying. I include Pellet like this:
>
> InputStream in = new FileInputStream(new 
> File("D:\\Fakultet\\WeatherHealthcast1.owl"));
> Model model = ModelFactory.createDefaultModel();
> model.read(in, null);
> OntModel ontology = 
> ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, model);
>
> // Create a new query
> String queryString =
>             "PREFIX WeatherHealthcast: 
> <http://www.semanticweb.org/ontologies/2011/2/WeatherHealthcast.owl#> " +
>             "PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
>             "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
>             "SELECT ?disease " +
>             "WHERE { " +
>             "      ?person rdf:type WeatherHealthcast:Person." +
>             "      ?person foaf:firstName ?fn." +
>             "      ?person foaf:lastName ?ln." +
>             "      FILTER regex(str(?fn), \"Viktor\")." +
>             "      FILTER regex(str(?ln), \"Taneski\")." +
>             "      ?disease rdf:type WeatherHealthcast:Disease. " +
>             "      ?person WeatherHealthcast:suffersFrom ?disease." +
>             "}";
>
> Query query = QueryFactory.create(queryString);
>
> // Execute the query and obtain results
> QueryExecution qe = QueryExecutionFactory.create(query, ontology);
> ResultSet resultSet = qe.execSelect();
> System.out.println("TEST");
>
> while (resultSet.hasNext())
> {
>     QuerySolution result = resultSet.next();
>     RDFNode disease = result.get("disease");
>     Resource resource = disease.asResource();
>
>     System.out.println(" { Suffers from: " + resource.getLocalName() + 
> " . }");
> }
>
> I also tried this:
>
> Reasoner r = PelletReasonerFactory.theInstance().create();
> InfModel inferenceModel = ModelFactory.createInfModel(r, model);
>
> but no progress. Any ideas? I need this for my diploma thesis. Thanks
>
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20110822/51e6d1e7/attachment.html>


More information about the protege-owl mailing list