This discussion is archived
4 Replies Latest reply: Dec 20, 2012 8:08 PM by user571093 RSS

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

user571093 Newbie
Currently Being Moderated
hi all,

while testing the first example query using the Jena Adapter from chap 7 in the developer guide, i hit the error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0". I can't see any bugs in this example. Can anybody pls give me some advice? thanks in advance. the code is as follows:

import oracle.spatial.rdf.client.jena.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.graph.*;
import com.hp.hpl.jena.query.*;
public class Test {
public static void main(String[] args) throws Exception
{

String szJdbcURL = args[0];
String szUser = args[1];
String szPasswd = args[2];
String szModelName = args[3];

Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
Model model = ModelOracleSem.createOracleSemModel(
oracle, szModelName);
model.getGraph().add(Triple.create(
Node.createURI("http://example.com/John"),
Node.createURI("http://example.com/fatherOf"),
Node.createURI("http://example.com/Mary")));
Query query = QueryFactory.create(
"select ?f ?k WHERE {?f <http://example.com/fatherOf> ?k .}");
QueryExecution qexec = QueryExecutionFactory.create(query, model);
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out, results, query);
model.close();
oracle.dispose();
}
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points