On 13 Sep 2011, at 13:23, Olivier Mesnard wrote:

> Dear Everyone,

Hi Olivier,

> I have some difficulties with the load() operation of class  
> com.hp.hpl.jena.rdf.arp.DOM2Model.
> The operation seems to performs incompletely its task and I don't know what 
> is 
> wrong with my code. perhaps I miss some options of the parser.

I think there is an option for this

> Here is the code:

<snip>

>            DOM2Model arp = DOM2Model.createD2M("", _model);
>            arp.allowRelativeURIs();

Try:

arp.getOptions().setEmbedding(true);

From the javadoc: [1]

"Sets whether the XML document is only RDF, or contains RDF embedded in other 
XML. The default is non-embedded mode. Embedded mode also matches RDF documents 
that use the rdf:RDF tag at the top-level. Non-embeded mode matches RDF 
documents which omit that optional tag, and consist of a single rdf:Description 
or typed node. To find embedded RDF it is necessary to setEmbedding(true)."

Which sounds like what you want.

(As an alternative you could pass in the DOM node corresponding to the sub-tree 
you want to parse. Your issue is that you're trying to parse the whole thing as 
RDF/XML)

Damian

[1] 
<http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/rdf/arp/ARPOptions.html#setEmbedding(boolean)>

Reply via email to