Adding Sub Children to RDF using Jena

cudesnic

New Member
Okay I've got a problem I'd appreciate someone spreading some light on. Basically I have the following example below\[code\]<rdf:Description rdf:about="http://test.com"><hasX></hasX><hasY></hasY><hasA></hasA><hasA></hasA><hasA></hasA></rdf:Description>\[/code\]I'm trying to produce the following: \[code\]<rdf:Description rdf:about="http://test.com"><hasX></hasX><hasY></hasY><hasZ><hasA></hasA><hasA></hasA><hasA></hasA></hasZ></rdf:Description>\[/code\]I've tried adding Property to a Property then a Resource, declaring new Resource, adding Literals, every possible combination of these, however the close I've gotten is it to generate a new rdf:description block containing the data I want, outside of the original rdf:description making it worthless.I really don't want another \[code\]<rdf:Description rdf:about="">\[/code\] to describe the \[code\]A\[/code\] tags.Here's a small test example\[code\]String NS = "http://example.com/test"; Model m = ModelFactory.createDefaultModel();Resource r = m.createResource("http://meetup/nyc");Property p = m.createProperty(XmlParser.NS + "hasData");Property p2 = m.createProperty(XmlParser.NS + "hasData");Property p3 = m.createProperty(XmlParser.NS + "hasData");r.addProperty(p, "somedata");r.addProperty(p2, "somedata2");r.addProperty(p3, "somedata3");m.write(System.out);\[/code\]
 
Back
Top