Hello,
I have a model which contains a reified statement. Depending on what URLs I
use for resources, I get different outputs.

I would be thankful if someone could explain if this behavior is valid or a
bug.
Thanks.


Sample 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>
---------
********************************************

Reply via email to