Hi Heiko,

If you move the qe.close() statement after the try/catch block it will
solve your exception. This type of errors  appear when you close
the QueryExecutionFactory before you access the resultset.
I've tested it and it works fine:

QueryExecution qe =
QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql","select
distinct ?p where {<http://dbpedia.org/resource/Darmstadt> ?p ?o}  ORDER BY
?p");
         ResultSet rs = qe.execSelect();
         try {
             for (; rs.hasNext();)
                 System.out.println(rs.next().get("p"));
         } catch (Exception e) {
             System.out.println(e);
         }
         qe.close();
}

Cheers,
Alexandru

On Thu, Nov 22, 2012 at 2:46 PM, Heiko Paulheim <[email protected]
> wrote:

>  Yes, the exception is still there. In fact, my test program only consists
> of those lines, so there is only one query issued.
>
> Best,
> Heiko
>
>
> Am 22.11.2012 14:37, schrieb Alexandru Todor:
>
> Hi Heiko,
>
>  I'm not sure, but could you try closing the QueryExecutionFactory after
> the try/catch block and see if you still have the same error ?
>
>  Regards,
> Alexandru
>
> On Thu, Nov 22, 2012 at 1:06 PM, Heiko Paulheim <
> [email protected]> wrote:
>
>> Dear DBpedians,
>>
>> this is a rather odd problem (see exception below) when querying DBpedia
>> via JENA+SPARQL (sample code below). The query itself seems sane and can
>> also be executed without any problems using the web interface:
>> select distinct ?p where {<http://dbpedia.org/resource/Darmstadt> ?p
>> ?o}  ORDER BY ?p
>>
>> The exception seems to occur when the iterator steps from
>> http://dbpedia.org/property/marHighC
>> to
>> http://dbpedia.org/property/marLowC
>> both of which do not contain any special characters or the like.
>>
>> Any ideas, anyone?
>>
>> Best,
>> Heiko
>>
>> The exception I get is (message translated: "XML document structures
>> have to begin and end with the same element"):
>> javax.xml.stream.XMLStreamException: ParseError at [row,col]:[232,57]
>> Message: XML-Dokumentstrukturen müssen innerhalb derselben Entität
>> beginnen und enden.
>>      at
>>
>> com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:592)
>>      at
>>
>> com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getElementText(XMLStreamReaderImpl.java:836)
>>      at
>>
>> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getOneSolution(XMLInputStAX.java:506)
>>      at
>>
>> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:231)
>>
>>
>>
>> My code:
>>          QueryExecution qe =
>> QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql";,
>>                  "select distinct ?p where
>> {<http://dbpedia.org/resource/Darmstadt> ?p ?o}  ORDER BY ?p");
>>          ResultSet rs = qe.execSelect();
>>
>>          qe.close();
>>
>>          try {
>>              for (; rs.hasNext();)
>>                  System.out.println(rs.next().get("p"));
>>          } catch (Exception e) {
>>              System.out.println(e);
>>          }
>>
>> --
>> Dr. Heiko Paulheim
>> Knowledge Engineering Group
>> Technische Universität Darmstadt
>> Phone: +49 6151 16 6634 <%2B49%206151%2016%206634>
>> Fax:   +49 6151 16 5482 <%2B49%206151%2016%205482>
>> http://www.ke.tu-darmstadt.de/staff/heiko-paulheim
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Monitor your physical, virtual and cloud infrastructure from a single
>> web console. Get in-depth insight into apps, servers, databases, vmware,
>> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
>> Pricing starts from $795 for 25 servers or applications!
>> http://p.sf.net/sfu/zoho_dev2dev_nov
>> _______________________________________________
>> Dbpedia-discussion mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
>>
>
>
> --
> Dr. Heiko Paulheim
> Knowledge Engineering Group
> Technische Universität Darmstadt
> Phone: +49 6151 16 6634
> Fax:   +49 6151 16 5482http://www.ke.tu-darmstadt.de/staff/heiko-paulheim
>
>
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to