virajpu / androjena

Automatically exported from code.google.com/p/androjena
0 stars 0 forks source link

Running code generates SAXException #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Created project
2. Ran the following code
String sQuery = "select distinct ?x " + 
"from <http://data.open.ac.uk/context/course> " +
"where {?x a <http://purl.org/vocab/aiiso/schema#Module>. " +
"?x <http://data.open.ac.uk/saou/ontology#courseLevel> 
<http://data.open.ac.uk/saou/ontology#postgraduate>. " +
"?x <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/computing> 
" +
"}";

          Query query = QueryFactory.create(sQuery);
          QueryExecution qexec = QueryExecutionFactory.sparqlService("http://data.open.ac.uk/query",query) ;
          try {
            ResultSet results = qexec.execSelect() ;
            for ( ; results.hasNext() ; )
            {
              QuerySolution soln = results.nextSolution() ;
              RDFNode x = soln.get("varName") ;       // Get a result variable by name.
              Resource r = soln.getResource("VarR") ; // Get a result variable - must be a resource
              Literal l = soln.getLiteral("VarL") ;   // Get a result variable - must be a literal
            }
          }
          catch (Exception e) {
                Log.e("ERROR", e.toString());
                e.printStackTrace();
          }
          finally { qexec.close() ; }

What is the expected output? What do you see instead?

I expected to see a query result set. Instead I see the following error

12-03 22:10:43.805: WARN/System.err(300): 
com.hp.hpl.jena.sparql.resultset.ResultSetException: Problems parsing file 
(SAXException)
12-03 22:10:43.964: WARN/System.err(300): Caused by: org.xml.sax.SAXException: 
Can't create default XMLReader; is system property org.xml.sax.driver set?

If you're using a real device and not the emulated AVD, what is the device
model?

What version of Android runs on your device/emulated AVD? (please put an X
next to the correct version)

Android 1.1
Android 1.5 (Cupcake)
Android 1.6 (Donut)
Android 2.0/2.1 (Eclair)
Android 2.2 (Froyo)
Android 2.3 (Gingerbread)
Android 3.0 (Honeycomb)

What version of Android is your application targeting? (please put an X
next to the correct version)

Android 1.1
Android 1.5 (Cupcake)
Android 1.6 (Donut)
Android 2.0/2.1 (Eclair)
Android 2.2 (Froyo)
Android 2.3 (Gingerbread)
Android 3.0 (Honeycomb)

What IDE/environment are you developing with? (Eclipse w/ ADT, Android SDK
w/ Apache Ant, ...)

What operating system and hardware is your IDE/development environment
running on?

Please attach the following application files (when applicable):

- AndroidManifest.xml
- .classpath
- default.properties
- a full LogCat dump from application launch to exception/crash
- a meaningful portion of the source code where the exception is thrown

Please provide any additional detail below

Original issue reported on code.google.com by stuart.c...@gmail.com on 3 Dec 2010 at 10:21

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r80.

Original comment by loreca...@gmail.com on 4 Dec 2010 at 5:57

GoogleCodeExporter commented 8 years ago
There was a problem in XMLReader instantiation in ARQoid (for obscure reasons, 
Android has no default XMLReader implementation, it must be specified 
explicitly or via org.xml.sax.driver system property). 
Now it should be ok, I've tried to run your code and it retrieves the resultset 
fine. Please let me know if it works for you too.

Original comment by loreca...@gmail.com on 4 Dec 2010 at 5:59

GoogleCodeExporter commented 8 years ago
I forgot: the patched code can be found in the new Androjena and ARQoid release 
(0.5). See downloads list.

Original comment by loreca...@gmail.com on 4 Dec 2010 at 6:00