Different outputs when using Stmt.createReifiedStatement()
----------------------------------------------------------
Key: JENA-183
URL: https://issues.apache.org/jira/browse/JENA-183
Project: Jena
Issue Type: Bug
Components: RDF/XML
Environment: Jena 2.6.4
Reporter: Srimanth
I have a model which contains a reified statement. Depending on what URLs I use
for the resources, I get different valid outputs - which is inconsistent.
I need to consistently generate one format as I have to document in our
specification how it will be. There could be simple XML parsers which consume
it.
Code:
===================================================
public class JenaReifiedProblem {
private static final String someBase = "http://someserver/myapp";
public static void main(String[] args) {
generate1("http://localhost:8080");
System.out.println("---------");
generate1("http://localhost:8080/app");
System.out.println("---------");
}
public static void generate1(String serverURL) {
Model model = ModelFactory.createDefaultModel();
model.setNsPrefix("dcterms", DCTerms.NS);
Resource agent = model.createResource(serverURL+"/agent1",
DCTerms.Agent);
Resource fileFormat =
model.createResource("http://formatsite.org/fileformat", DCTerms.FileFormat);
fileFormat.addProperty(DCTerms.title, "TXT");
agent.addProperty(DCTerms.format, fileFormat);
agent.addProperty(DCTerms.relation,
model.createResource(serverURL+"/agent2"));
ReifiedStatement rs =
agent.getProperty(DCTerms.relation).createReifiedStatement(someBase+"#relationship");
rs.addProperty(DCTerms.title, "My releationship");
model.write(System.out, "RDF/XML-ABBREV", someBase);
}
}
===================================================
Output:
===================================================
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<dcterms:Agent rdf:about="http://localhost:8080/agent1">
<dcterms:relation rdf:ID="relationship"
rdf:resource="http://localhost:8080/agent2"/>
<dcterms:format>
<dcterms:FileFormat rdf:about="http://formatsite.org/fileformat">
<dcterms:title>TXT</dcterms:title>
</dcterms:FileFormat>
</dcterms:format>
</dcterms:Agent>
<rdf:Statement rdf:about="#relationship">
<dcterms:title>My releationship</dcterms:title>
</rdf:Statement>
</rdf:RDF>
---------
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<dcterms:FileFormat rdf:about="http://formatsite.org/fileformat">
<dcterms:title>TXT</dcterms:title>
</dcterms:FileFormat>
<rdf:Statement rdf:ID="relationship">
<rdf:subject>
<dcterms:Agent rdf:about="http://localhost:8080/app/agent1">
<dcterms:relation rdf:resource="http://localhost:8080/app/agent2"/>
<dcterms:format rdf:resource="http://formatsite.org/fileformat"/>
</dcterms:Agent>
</rdf:subject>
<rdf:predicate rdf:resource="http://purl.org/dc/terms/relation"/>
<rdf:object rdf:resource="http://localhost:8080/app/agent2"/>
<dcterms:title>My releationship</dcterms:title>
</rdf:Statement>
</rdf:RDF>
---------
===================================================
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira