Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding Sub Children to RDF using Jena
    text
    copied!<p>Okay I've got a problem I'd appreciate someone spreading some light on. Basically I have the following example below</p> <pre><code>&lt;rdf:Description rdf:about="http://test.com"&gt; &lt;hasX&gt;&lt;/hasX&gt; &lt;hasY&gt;&lt;/hasY&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;/rdf:Description&gt; </code></pre> <p>I'm trying to produce the following: </p> <pre><code>&lt;rdf:Description rdf:about="http://test.com"&gt; &lt;hasX&gt;&lt;/hasX&gt; &lt;hasY&gt;&lt;/hasY&gt; &lt;hasZ&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;hasA&gt;&lt;/hasA&gt; &lt;/hasZ&gt; &lt;/rdf:Description&gt; </code></pre> <p>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.</p> <p>I really don't want another <code>&lt;rdf:Description rdf:about=""&gt;</code> to describe the <code>A</code> tags.</p> <p>Here's a small test example</p> <pre><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></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload