[Pellet-users] Error: "Unresolved prefixed name: rdf:type"

João Paulo Sousa jpaulo at ipb.pt
Fri Jan 4 17:29:04 UTC 2008


Hi,

When I try to run this query bellow, I got he fowlling error:  
"Unresolved prefixed name: rdf:type".
The domains bellow are on-line.

Please help me to solve this problem.

Regards,

João Paulo

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package icasv01;

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import org.mindswap.pellet.jena.PelletQueryExecution;
import org.mindswap.pellet.jena.PelletReasonerFactory;

/**
*
* @author Administrator
*/
public class NewMain {

    static Boolean debug = true;
    static String queryBegin = "PREFIX actor: <http://icas.ipb.pt/myontologies/actor.owl# 
 > \r\n" +
                               "PREFIX space: <http://icas.ipb.pt/myontologies/spatial.owl# 
 >";
    static String actordata = "http://icas.ipb.pt/myontologies/icasactordata.owl# 
";
    static String spatialdata = "http://icas.ipb.pt/myontologies/icasspatialdata.owl# 
";
    static String ns = "http://icas.ipb.pt/myontologies/actor.owl";

    static OntModel model;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        FriendsAroundMe();
    }

    public static void FriendsAroundMe() {
        model =  
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
        model.read(actordata);
        model.read(spatialdata);

        String queryStr7 = queryBegin + "SELECT ?Person \r\n" +
                " WHERE {\r\n" +
                "?x rdf:type Person .\r\n" +
                "}";

        RunQuery(queryStr7);
    }

    public static void RunQuery(String queryStr) {
        Query query = QueryFactory.create(queryStr);
        QueryExecution queryExec = new PelletQueryExecution(query,  
model);
        ResultSet results = queryExec.execSelect();

        if (debug) {
            try {
                printQueryResults("Query knows: ", queryExec, query);
            } catch (Exception e) {
                System.out.println(e);
            }
        }
    }

    public static void printQueryResults(String header, QueryExecution  
qe, Query query) throws Exception {
        System.out.println("\n" + header);
        ResultSet results = qe.execSelect();
        ResultSetFormatter.out(System.out, results, query);
        System.out.println();
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20080104/28883c2c/attachment.htm 


More information about the Pellet-users mailing list