You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Philipp <ph...@web.de> on 2015/11/16 12:33:08 UTC
Spurious warning when using exotic XML names?
Hi,
it seems to me that Jena gives a spurious warning ("Not an XML Name:"), when the Ͱ character (Ͱ) - and presumably other exotic characters - is used in XML names, for example rdf:IDs.
According to the XML definition it's even a valid NameStartChar: http://www.w3.org/TR/xml/#NT-NameStartChar
Also, it's not restricted in the rdf-id production rule: http://www.w3.org/TR/rdf-syntax-grammar/#rdf-id
If this seems like a bug to you, please forward this to the dev list.
Regards
Philipp
Re: Spurious warning when using exotic XML names?
Posted by Philipp Martis <ph...@web.de>.
Hi,
thanks for attending to this, Andy.
Regards
Philipp
On Tue, 17 Nov 2015 20:02:43 +0000 UTC,
Andy Seaborne <an...@apache.org> wrote:
> It turns out that it is not so simple :-)
>
> Where did this XML come from?
>
> tl;dr
> JENA-1071 : https://issues.apache.org/jira/browse/JENA-1071
>
> Xerces support XML 1.0 - 4th edition which does not include codepoint
> U+0370.
>
> Workarounds
> * Turn off the warning.
> * Use rdf:about, not rdf:ID.
>
> The long story:
>
> http://www.w3.org/TR/xml/#NT-NameStartChar is a reference to "XML 1.0 (Fifth
> edition)" and even that is only Unicode 5.0.0. Greek Heta [Ͱ], or U+0370
> was added Unicode version 5.1 but is in the codepoint ranges for the 5th
> edition.
>
> "XML 1.0 (Fourth Edition)" does not include U+0370.
>
> The Xerces 2.11.0 implements XML 1.0 Fourth Edition (and you are using the
> earlier 2.10.0 - so simply upgrading will not help here though a good idea
> for lots of other reasons).
>
> The XML parser in the Java8 JDK (which happens to be fork of Xerces from way
> back (2.7.1) also seems to be 4th edition. IBM Java7 is a fork of 2.9.
>
> Now both Xerces 2.11.0 and Java8 JDK do happen to support a check for XML11
> chars where XML11Char.isXML11ValidNCName. That is not XML 1.1 support.
>
> Andy
>
> [Ͱ]
> https://en.wikipedia.org/wiki/Heta
>
Re: Spurious warning when using exotic XML names?
Posted by Andy Seaborne <an...@apache.org>.
It turns out that it is not so simple :-)
Where did this XML come from?
tl;dr
JENA-1071 : https://issues.apache.org/jira/browse/JENA-1071
Xerces support XML 1.0 - 4th edition which does not include codepoint
U+0370.
Workarounds
* Turn off the warning.
* Use rdf:about, not rdf:ID.
The long story:
http://www.w3.org/TR/xml/#NT-NameStartChar is a reference to "XML 1.0
(Fifth edition)" and even that is only Unicode 5.0.0. Greek Heta [Ͱ],
or U+0370 was added Unicode version 5.1 but is in the codepoint ranges
for the 5th edition.
"XML 1.0 (Fourth Edition)" does not include U+0370.
The Xerces 2.11.0 implements XML 1.0 Fourth Edition (and you are using
the earlier 2.10.0 - so simply upgrading will not help here though a
good idea for lots of other reasons).
The XML parser in the Java8 JDK (which happens to be fork of Xerces from
way back (2.7.1) also seems to be 4th edition. IBM Java7 is a fork of 2.9.
Now both Xerces 2.11.0 and Java8 JDK do happen to support a check for
XML11 chars where XML11Char.isXML11ValidNCName. That is not XML 1.1
support.
Andy
[Ͱ]
https://en.wikipedia.org/wiki/Heta
Re: Spurious warning when using exotic XML names?
Posted by Andy Seaborne <an...@apache.org>.
Thanks for the example,. It looks like "exotic" means "added in Unicode
5.1 or later". The Greek alphabet works where the codepoints are in earlier
unicode (which is more than can be said for this Android keyboard). I guess
some lookup table isn't up to date but whether that is in Xerces or Jena
will take investigation.
Andy
On Mon, 16 Nov 2015, 13:56 Philipp Martis <ph...@web.de> wrote:
> Hi,
>
>
> sure:
>
> <?xml version="1.0"?>
> <!DOCTYPE rdf:RDF [
> <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
> <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
> <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
> <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
> <!ENTITY ont "http://example.com/myontology#" >
> ]>
>
> <rdf:RDF
> xmlns:owl ="&owl;"
> xmlns:rdf ="&rdf;"
> xmlns:rdfs="&rdfs;"
> xmlns ="&ont;"
> xml:base ="&ont;"
> xmlns:ont ="&ont;"
> >
>
>
> <owl:Class rdf:ID="ClassͰ">
> </owl:Class>
>
>
> </rdf:RDF>
>
> Code:
>
> Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
> Logger.getRootLogger().addAppender(new ConsoleAppender(new SimpleLayout(),
> ConsoleAppender.SYSTEM_ERR));
> final OntModel model =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MINI_RULE_INF);
> model.read("file:///home/phil/test_minimal.xml", "RDF/XML");
>
> Classpath:
>
> mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar
> owlapi-osgidistribution-4.1.0.jar
> apache-jena-2.7.4/lib/commons-codec-1.5.jar
> apache-jena-2.7.4/lib/httpclient-4.1.2.jar
> apache-jena-2.7.4/lib/httpcore-4.1.3.jar
> apache-jena-2.7.4/lib/jcl-over-slf4j-1.6.4.jar
> apache-jena-2.7.4/lib/jena-arq-2.9.4.jar
> apache-jena-2.7.4/lib/jena-core-2.7.4.jar
> apache-jena-2.7.4/lib/jena-iri-0.9.4.jar
> apache-jena-2.7.4/lib/jena-tdb-0.9.4.jar
> apache-jena-2.7.4/lib/xercesImpl-2.10.0.jar
> apache-jena-2.7.4/lib/xml-apis-1.4.01.jar
> apache-jena-2.7.4/lib/log4j-1.2.16.jar
> apache-jena-2.7.4/lib/slf4j-api-1.6.4.jar
> apache-jena-2.7.4/lib/slf4j-log4j12-1.6.4.jar
>
>
> Kind regards
> Philipp
>
>
> On Mon, 16 Nov 2015 13:47:11 +0000 UTC,
> Andy Seaborne <an...@apache.org> wrote:
> > On 16/11/15 11:33, Philipp wrote:
> > >Hi,
> > >
> > >it seems to me that Jena gives a spurious warning ("Not an XML Name:"),
> when the Ͱ character (Ͱ) - and presumably other exotic characters -
> is used in XML names, for example rdf:IDs.
> > >According to the XML definition it's even a valid NameStartChar:
> http://www.w3.org/TR/xml/#NT-NameStartChar
> > >Also, it's not restricted in the rdf-id production rule:
> http://www.w3.org/TR/rdf-syntax-grammar/#rdf-id
> > >
> > >If this seems like a bug to you, please forward this to the dev list.
> > >
> > >Regards
> > >Philipp
> > >
> >
> > Hi Philipp,
> >
> > Do you have a complete minimal example for a test case? i.e. a short
> RDF/XML
> > that illustrates the issue, and how you are reading the file with Jena.
> >
> > Also, which version of Jena are you using?
> >
> > Andy
> >
>
Re: Spurious warning when using exotic XML names?
Posted by Philipp Martis <ph...@web.de>.
Hi,
sure:
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY ont "http://example.com/myontology#" >
]>
<rdf:RDF
xmlns:owl ="&owl;"
xmlns:rdf ="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns ="&ont;"
xml:base ="&ont;"
xmlns:ont ="&ont;"
>
<owl:Class rdf:ID="ClassͰ">
</owl:Class>
</rdf:RDF>
Code:
Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
Logger.getRootLogger().addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_ERR));
final OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MINI_RULE_INF);
model.read("file:///home/phil/test_minimal.xml", "RDF/XML");
Classpath:
mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar
owlapi-osgidistribution-4.1.0.jar
apache-jena-2.7.4/lib/commons-codec-1.5.jar
apache-jena-2.7.4/lib/httpclient-4.1.2.jar
apache-jena-2.7.4/lib/httpcore-4.1.3.jar
apache-jena-2.7.4/lib/jcl-over-slf4j-1.6.4.jar
apache-jena-2.7.4/lib/jena-arq-2.9.4.jar
apache-jena-2.7.4/lib/jena-core-2.7.4.jar
apache-jena-2.7.4/lib/jena-iri-0.9.4.jar
apache-jena-2.7.4/lib/jena-tdb-0.9.4.jar
apache-jena-2.7.4/lib/xercesImpl-2.10.0.jar
apache-jena-2.7.4/lib/xml-apis-1.4.01.jar
apache-jena-2.7.4/lib/log4j-1.2.16.jar
apache-jena-2.7.4/lib/slf4j-api-1.6.4.jar
apache-jena-2.7.4/lib/slf4j-log4j12-1.6.4.jar
Kind regards
Philipp
On Mon, 16 Nov 2015 13:47:11 +0000 UTC,
Andy Seaborne <an...@apache.org> wrote:
> On 16/11/15 11:33, Philipp wrote:
> >Hi,
> >
> >it seems to me that Jena gives a spurious warning ("Not an XML Name:"), when the Ͱ character (Ͱ) - and presumably other exotic characters - is used in XML names, for example rdf:IDs.
> >According to the XML definition it's even a valid NameStartChar: http://www.w3.org/TR/xml/#NT-NameStartChar
> >Also, it's not restricted in the rdf-id production rule: http://www.w3.org/TR/rdf-syntax-grammar/#rdf-id
> >
> >If this seems like a bug to you, please forward this to the dev list.
> >
> >Regards
> >Philipp
> >
>
> Hi Philipp,
>
> Do you have a complete minimal example for a test case? i.e. a short RDF/XML
> that illustrates the issue, and how you are reading the file with Jena.
>
> Also, which version of Jena are you using?
>
> Andy
>
Re: Spurious warning when using exotic XML names?
Posted by Andy Seaborne <an...@apache.org>.
On 16/11/15 11:33, Philipp wrote:
> Hi,
>
> it seems to me that Jena gives a spurious warning ("Not an XML Name:"), when the Ͱ character (Ͱ) - and presumably other exotic characters - is used in XML names, for example rdf:IDs.
> According to the XML definition it's even a valid NameStartChar: http://www.w3.org/TR/xml/#NT-NameStartChar
> Also, it's not restricted in the rdf-id production rule: http://www.w3.org/TR/rdf-syntax-grammar/#rdf-id
>
> If this seems like a bug to you, please forward this to the dev list.
>
> Regards
> Philipp
>
Hi Philipp,
Do you have a complete minimal example for a test case? i.e. a short
RDF/XML that illustrates the issue, and how you are reading the file
with Jena.
Also, which version of Jena are you using?
Andy