You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Michael Brunnbauer <br...@netestate.de> on 2013/06/06 15:41:24 UTC

java.lang.NullPointerException caused by unqualified property elements in RDF/XML

hi all

is the NullPointerException expected behaviour ?

chianti:~/apache-jena-2.10.1$ cat test.rdf
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:foaf="http://xmlns.com/foaf/0.1/">
 <foaf:Person rdf:ID="me">
  <PubKey rdf:nodeID="KeyA">
   <foaf:name>key A</foaf:name> 
  </PubKey>
 </foaf:Person>
</rdf:RDF>
chianti:~/apache-jena-2.10.1$ ./bin/rdfparse test.rdf 
<file:///home/java/apache-jena-2.10.1/test.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
Warning: file:///home/java/apache-jena-2.10.1/test.rdf(line 5 column 29): {W104} Unqualified property elements are not allowed. Treated as a relative URI.
Warning: file:///home/java/apache-jena-2.10.1/test.rdf(line 5 column 29): {W136} Relative URIs are not permitted in RDF: specifically <PubKey>
<file:///home/java/apache-jena-2.10.1/test.rdf#me> <PubKey> _:jUKeyA .
Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 4): {E201} The attributes on this property element, are not permitted with any content; expecting end element tag.
Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 15): {E201} XML element <foaf:name> inside an empty property element, whose attributes prohibit any content.
Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 20): {E201} The attributes on this property element, are not permitted with any content; expecting end element tag.
Exception in thread "main" java.lang.NullPointerException
	at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.endElement(XMLHandler.java:133)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLNamespaceBinder.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:151)
	at com.hp.hpl.jena.rdf.arp.ARP.load(ARP.java:119)
	at com.hp.hpl.jena.rdf.arp.NTriple.process(NTriple.java:431)
	at com.hp.hpl.jena.rdf.arp.NTriple.process(NTriple.java:424)
	at com.hp.hpl.jena.rdf.arp.NTriple.mainEh(NTriple.java:139)
	at com.hp.hpl.jena.rdf.arp.NTriple.main(NTriple.java:97)
	at jena.rdfparse.main(rdfparse.java:89)

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: java.lang.NullPointerException caused by unqualified property elements in RDF/XML

Posted by Andy Seaborne <an...@apache.org>.
Ignoring the wanrings which are just warning (no base in force so 
relative URIs not resolved: use "-b" to set the base)

this is RDF/XML striped syntax:

<foaf:Person rdf:ID="me">         class (and bnode id)
   <PubKey rdf:nodeID="KeyA">      so this is a property
    <foaf:name>key A</foaf:name>   has to be a class ... but isn't
   </PubKey>
  </foaf:Person>

I don't think you can have both rdf:nodeID on a property and also have 
content.  But as the content suggests a property, there is striping 
misalignment.

	Andy


On 06/06/13 14:41, Michael Brunnbauer wrote:
>
> hi all
>
> is the NullPointerException expected behaviour ?
>
> chianti:~/apache-jena-2.10.1$ cat test.rdf
> <rdf:RDF
>   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>   xmlns:foaf="http://xmlns.com/foaf/0.1/">
>   <foaf:Person rdf:ID="me">
>    <PubKey rdf:nodeID="KeyA">
>     <foaf:name>key A</foaf:name>
>    </PubKey>
>   </foaf:Person>
> </rdf:RDF>
> chianti:~/apache-jena-2.10.1$ ./bin/rdfparse test.rdf
> <file:///home/java/apache-jena-2.10.1/test.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
> Warning: file:///home/java/apache-jena-2.10.1/test.rdf(line 5 column 29): {W104} Unqualified property elements are not allowed. Treated as a relative URI.
> Warning: file:///home/java/apache-jena-2.10.1/test.rdf(line 5 column 29): {W136} Relative URIs are not permitted in RDF: specifically <PubKey>
> <file:///home/java/apache-jena-2.10.1/test.rdf#me> <PubKey> _:jUKeyA .
> Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 4): {E201} The attributes on this property element, are not permitted with any content; expecting end element tag.
> Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 15): {E201} XML element <foaf:name> inside an empty property element, whose attributes prohibit any content.
> Error: file:///home/java/apache-jena-2.10.1/test.rdf(line 6 column 20): {E201} The attributes on this property element, are not permitted with any content; expecting end element tag.
> Exception in thread "main" java.lang.NullPointerException
> 	at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.endElement(XMLHandler.java:133)
> 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> 	at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(Unknown Source)
> 	at org.apache.xerces.impl.XMLNamespaceBinder.endElement(Unknown Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> 	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> 	at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:151)
> 	at com.hp.hpl.jena.rdf.arp.ARP.load(ARP.java:119)
> 	at com.hp.hpl.jena.rdf.arp.NTriple.process(NTriple.java:431)
> 	at com.hp.hpl.jena.rdf.arp.NTriple.process(NTriple.java:424)
> 	at com.hp.hpl.jena.rdf.arp.NTriple.mainEh(NTriple.java:139)
> 	at com.hp.hpl.jena.rdf.arp.NTriple.main(NTriple.java:97)
> 	at jena.rdfparse.main(rdfparse.java:89)
>
> Regards,
>
> Michael Brunnbauer
>