IteratorAsTupleQueryResult cannot be cast to org.openrdf.query.GraphQueryResult

0 views
Skip to first unread message

Kanchana Padmanabhan

unread,
Oct 14, 2015, 4:09:20 PM10/14/15
to Stardog
com.complexible.stardog.StardogException: com.complexible.common.rdf.query.IteratorAsTupleQueryResult cannot be cast to org.openrdf.query.GraphQueryResult
    at com.complexible.stardog.protocols.snarl.client.AbstractSNARLClient.graph(AbstractSNARLClient.java:219)
    at com.complexible.stardog.protocols.snarl.client.AbstractSNARLClient.graph(AbstractSNARLClient.java:62)
    at com.complexible.stardog.api.impl.SPECGraphQuery.execute(SPECGraphQuery.java:46)
    at com.complexible.stardog.api.impl.SPECGraphQuery.execute(SPECGraphQuery.java:31)


Code snippet:

ConnectionConfiguration conConfig = ConnectionConfiguration
                .to("test")           // the name of the db to connect to
                .credentials("admin", "admin").server("snarl://localhost:5820/")          ;
        // credentials to use while connecting
        System.out.println("Test" + conConfig.getOptions());
        Connection aConn = conConfig.connect();

        String query = "Select * {?s <http://www.w3.org/2004/02/skos/core#broader> <http://dbpedia.org/resource/Category:Justin_Timberlake">}";
        GraphQueryResult  gquery = aConn.graph(query).execute();




Fernando Hernandez

unread,
Oct 14, 2015, 4:45:59 PM10/14/15
to sta...@clarkparsia.com
You're issuing a SELECT query with a method designed for CONSTRUCT queries. The last line should read:

TupleQueryResult aResult = aConn.select(query).execute();

Cheers,
Fernando
Reply all
Reply to author
Forward
0 new messages