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] SQWRL API Error

Divino Ignacio Ribeiro Jr divino at telemedicina.ufsc.br
Wed Sep 1 14:45:56 PDT 2010


Dears,

I'm developing a java code with SQWRL API to execute an SWRL Rule in
ontology.

The code is:

public static void main(String[] args) {
        String uri = "file:///C:/Users/Divino/ontology.owl";
        String nmspace = "http://server.ufsc.br/ontology.owl#";
        JenaOWLModel ontologia = null;
        try {
            ontologia = ProtegeOWL.createJenaOWLModelFromURI(uri);
            ontologia.getNamespaceManager().setDefaultNamespace(nmspace);
            SQWRLQueryEngine queryEngine =
SQWRLQueryEngineFactory.create(ontologia);
            SQWRLResult result = queryEngine.runSQWRLQuery("Rule-1");
            while (result.hasNext()) {
                DataValue titulo = result.getDataValue("?titulo"); // line
37 where the error is raised
                DataValue ator = result.getDataValue("?ator");
                System.out.println("Nome: " + ator.getString());
                System.out.println("Titulacao: " + titulo.getString());
                result.next();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

The error code is:

edu.stanford.smi.protegex.owl.swrl.sqwrl.exceptions.InvalidColumnTypeException:
expecting DataValue type for column ?titulo
        at
edu.stanford.smi.protegex.owl.swrl.sqwrl.impl.SQWRLResultImpl.getDataValue(Unknown
Source)
        at prototiposbc.Main.main(Main.java:37)


The 'Rule-1' in Ontology is correct and runs in Protege; the variables
?titulo and ?ator are correct.

What is happening with code?

Divino.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20100901/5a4f2cc5/attachment.html>


More information about the protege-owl mailing list