[tdwg-guid] How to create resource that is not defined in Jena's vocabulary

Chaohong Xie hamlinxie at gmail.com
Thu Aug 9 08:31:11 CEST 2007


Hi guys,
I met the same problem as Peter wrote in the following link:
http://lists.tdwg.org/pipermail/tdwg-guid/2006-September/000496.html.
Unfortunately, I didn't get the final solution in it.

I'm not sure Peter, Ben and Steve are still in this mail group or not.
Anyway, can anybody help me solve this problem? Thanks a lot.

My code is attached as well. What I want is outputing my vocabulary
"Manifest" instead of "rdf:Description".
    Map<String, String> ns = new HashMap<String, String>();
    ns.put("", "http://www.test.com/2007/08/test-vocabulary#");
    ns.put("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
    ns.put("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
    Model model = ModelFactory.createDefaultModel();
    model.setNsPrefixes(ns);
    Resource r = model.createResource("
http://www.test.com/2007/08/test_config#MyNodeID").addProperty(model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
"http://www.test.com/2007/08/test-vocabulary#Manifest");
    Property p = model.createProperty("
http://www.test.com/2007/08/test-vocabulary#created_by");
    Statement s = model.createStatement(r, p, "Chaohong");
    model.add(s);
    RDFWriter w = model.getWriter("RDF/XML-ABBREV");
    w.setProperty("showXMLDeclaration", "true");
    w.setProperty("tab", "2");
    w.setProperty("xmlbase", "http://www.test.com/2007/08/test_config#");
    w.write(model, System.out, "http://www.test.com/2007/08/test-vocabulary
#");

Chaohong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.tdwg.org/pipermail/tdwg-tag/attachments/20070809/972fa984/attachment.html 


More information about the tdwg-tag mailing list