sszuev opened a new issue, #2620:
URL: https://github.com/apache/jena/issues/2620
### Version
5.1.0
### What happened?
This time I expect failure (i.e. the behavior of Jena 4.x).
The document is OWL/XML, not RDF/XML.
It seems to be important: in owlcs/ONTAPI there is a loading mechanism that
iterates over formats (both Jena and OWLAPI).
If the document is parsed as RDF/XML successfully, than mechanism stops and
return ready Graph. In this case it contains rubbish.
--------------------
```java
String data = "<?xml version=\"1.0\"?>\n" +
"\n" +
"\n" +
"<!DOCTYPE Ontology [\n" +
" <!ENTITY xsd \"http://www.w3.org/2001/XMLSchema#\" >\n" +
" <!ENTITY xml \"http://www.w3.org/XML/1998/namespace\" >\n" +
" <!ENTITY rdfs \"http://www.w3.org/2000/01/rdf-schema#\" >\n" +
" <!ENTITY rdf \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
>\n" +
"]>\n" +
"\n" +
"\n" +
"<Ontology xmlns=\"http://www.w3.org/2002/07/owl#\"\n" +
"
xml:base=\"http://www.derivo.de/ontologies/examples/anonymous-individuals\"\n" +
" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n" +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"\n" +
" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"\n" +
"
ontologyIRI=\"http://www.derivo.de/ontologies/examples/anonymous-individuals\">\n"
+
" <Prefix name=\"\"
IRI=\"http://www.derivo.de/ontologies/examples/anonymous-individuals#\"/>\n" +
" <Prefix name=\"owl\"
IRI=\"http://www.w3.org/2002/07/owl#\"/>\n" +
" <Prefix name=\"rdf\"
IRI=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"/>\n" +
" <Prefix name=\"xsd\"
IRI=\"http://www.w3.org/2001/XMLSchema#\"/>\n" +
" <Prefix name=\"rdfs\"
IRI=\"http://www.w3.org/2000/01/rdf-schema#\"/>\n" +
" <Declaration>\n" +
" <Class IRI=\"#C\"/>\n" +
" </Declaration>\n" +
" <Declaration>\n" +
" <ObjectProperty IRI=\"#r\"/>\n" +
" </Declaration>\n" +
" <ClassAssertion>\n" +
" <Class IRI=\"#C\"/>\n" +
" <AnonymousIndividual nodeID=\"a\"/>\n" +
" </ClassAssertion>\n" +
" <ObjectPropertyAssertion>\n" +
" <ObjectProperty IRI=\"#r\"/>\n" +
" <AnonymousIndividual nodeID=\"a\"/>\n" +
" <AnonymousIndividual nodeID=\"a\"/>\n" +
" </ObjectPropertyAssertion>\n" +
"</Ontology>";
ModelFactory.createDefaultModel().read(new StringReader(data), null,
"rdf/xml")
.setNsPrefixes(PrefixMapping.Standard).write(System.out, "ttl");
```
### Relevant output and stacktrace
```shell
expected error, but got
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[ rdf:type owl:AnonymousIndividual ] .
[ rdf:type owl:AnonymousIndividual ] .
[ rdf:type owl:AnonymousIndividual ] .
[ rdf:type owl:Ontology;
owl:ClassAssertion [ rdf:type owl:Class ];
owl:Declaration [ rdf:type owl:ObjectProperty ];
owl:Declaration [ rdf:type owl:Class ];
owl:ObjectPropertyAssertion [ rdf:type owl:ObjectProperty ];
owl:Prefix ""
] .
```
```
### Are you interested in making a pull request?
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]