You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2012/12/18 11:26:15 UTC
[jira] [Resolved] (JENA-183) Different outputs when using
Stmt.createReifiedStatement()
[ https://issues.apache.org/jira/browse/JENA-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andy Seaborne resolved JENA-183.
--------------------------------
Resolution: Won't Fix
See http://jena.apache.org/documentation/io/iohowto.html#advanced-rdfxml-output for controlling output (you may be able to turn of using rdf:ID on properties for compact reification)
Consider using "RDF/XML" for simpler output of RDF.
> Different outputs when using Stmt.createReifiedStatement()
> ----------------------------------------------------------
>
> Key: JENA-183
> URL: https://issues.apache.org/jira/browse/JENA-183
> Project: Apache Jena
> Issue Type: Wish
> Components: RDF/XML
> Environment: Jena 2.6.4
> Reporter: Srimanth
> Priority: Minor
>
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira