Okay I’ve got a problem I’d appreciate someone spreading some light on. Basically I have the following example below
<rdf:Description rdf:about="http://test.com">
<hasX></hasX>
<hasY></hasY>
<hasA></hasA>
<hasA></hasA>
<hasA></hasA>
</rdf:Description>
I’m trying to produce the following:
<rdf:Description rdf:about="http://test.com">
<hasX></hasX>
<hasY></hasY>
<hasZ>
<hasA></hasA>
<hasA></hasA>
<hasA></hasA>
</hasZ>
</rdf:Description>
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 <rdf:Description rdf:about=""> to describe the A tags.
Here’s a small test example
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);
Creating a
Resourcefrom a model doesn’t automatically add it to that model. I generally add triples to a model via one of theaddmethods of the Model class:This will create: