Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'xml' prefix is ​​not omitted when generating a DTD subset in a file formatted as sorted RDF/XML #67

Closed
przemekgradzki opened this issue Mar 14, 2024 · 1 comment · Fixed by #68
Assignees
Labels

Comments

@przemekgradzki
Copy link
Contributor

The xml prefix is omitted when writing namespace declarations to the root element:

if ((USE_GENERATED_PREFIXES || !generatedNamespaceTable.containsKey(prefix)) && !"xml".equals(prefix)) {

but is not omitted when writing a DTD subset:

if (USE_GENERATED_PREFIXES || !generatedNamespaceTable.containsKey(prefix)) {


As a consequence, the result of the operation:

6. Format a Turtle file (`input.ttl`) as sorted RDF/XML (`output.rdf`), using entity references for URL shortening

executed with the command:

java -cp target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
  -s src/test/resources/ontologies/literal/test1.ttl \
  -tfmt rdf-xml -dtd

is the file containing the entry <!ENTITY xml "http://www.w3.org/XML/1998/namespace">:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
	<!ENTITY xml "http://www.w3.org/XML/1998/namespace">
	<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
	xmlns="https://example.com/test1#"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:Ontology rdf:about="https://example.com/test1">
	</owl:Ontology>
	
	<owl:Class rdf:about="https://example.com/test1#ClassA">
		<rdfs:label>label1</rdfs:label>
		<rdfs:label xml:lang="en">label2</rdfs:label>
		<rdfs:label xml:lang="pl">label3</rdfs:label>
		<rdfs:label>label4</rdfs:label>
		<rdfs:label rdf:datatype="&xsd;token">label5</rdfs:label>
		<rdfs:label>label6</rdfs:label>
	</owl:Class>

</rdf:RDF>

If you reapply the RDF/XML formatting operation to the resulting RDF/XML formatting using entity references for URL shortening:

java -cp target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
  -s src/test/resources/ontologies/literal/test1.ttl \
  -tfmt rdf-xml -dtd | \
  java -cp ./target/rdf-toolkit-1.14.2.jar org.edmcouncil.rdf_toolkit.RdfFormatter \
    -sfmt rdf-xml \
    -tfmt rdf-xml -dtd

is the file without the entry <!ENTITY xml "http://www.w3.org/XML/1998/namespace">:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
	<!ENTITY owl "http://www.w3.org/2002/07/owl#">
	<!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#">
]>
<rdf:RDF
	xmlns="https://example.com/test1#"
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
	
	<owl:Ontology rdf:about="https://example.com/test1">
	</owl:Ontology>
	
	<owl:Class rdf:about="https://example.com/test1#ClassA">
		<rdfs:label>label1</rdfs:label>
		<rdfs:label xml:lang="en">label2</rdfs:label>
		<rdfs:label xml:lang="pl">label3</rdfs:label>
		<rdfs:label>label4</rdfs:label>
		<rdfs:label rdf:datatype="&xsd;token">label5</rdfs:label>
		<rdfs:label>label6</rdfs:label>
	</owl:Class>

</rdf:RDF>
@ElisaKendall
Copy link
Contributor

@przemekgradzki @mereolog As far as I am concerned, the XML entity declaration can be omitted in both cases. It is not necessary and I would prefer that we leave it out altogether, regardless of which choice for retaining or eliminating the rest of the declarations.

@ElisaKendall ElisaKendall removed their assignment Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants