Hi Olaf,
On Thu, Nov 19, 2009 at 2:59 PM, Olaf Hartig <hartig@...
> wrote:
> Hey,
>
> On Thursday 19 November 2009 08:57:26 Arun Rao wrote:
> > Hi,
> >
> > I am trying to create an InfModel object using a NG4J NamedGraphModel and
> > when I get the raw model from the InfModel, I expect to get back the
> > original NamedGraphModel.
>
> So? Do you get it?
> (i.e. is infModel.getRawModel() an instance of NamedGraphModel?)
>
No, and that's the issue.
Here is some code:
System.out.println("rawModel instanceof NamedGraphModel?: ");
System.out.println(infModel.getRawModel() instanceof NamedGraphModel);
NamedGraphSet ngSet = ((NamedGraphModel)
infModel.getRawModel()).getNamedGraphSet();
Output:
rawModel instanceof NamedGraphModel?:
false
java.lang.ClassCastException: com.hp.hpl.jena.rdf.model.impl.ModelCom cannot
be cast to de.fuberlin.wiwiss.ng4j.NamedGraphModel
at com.test.NG4JTest.main(NG4JTest.java:52)
>
> > While this comparison returns true:
> > infModel.getRawModel().equals(ngModel)
> >
> > I am not able to cast infModel.getRawModel().getGraph() to NamedGraphSet
> > since infModel.getRawModel().getGraph() seems to be an instance of an
> inner
> > class of NamedGraphSetImpl.
>
> That's true.
>
> > There does not seem to be a simple way in which I can get NamedGraphModel
> > back.
>
> I would expect you get the NamedGraphModel by calling getRawModel() - at
> least
> that's what the Jena Javadoc says.
>
> The problem seems to be (I assume based on your use of the getGraph()
> method)
> that you are not interested in the NamedGraphModel that backs the infModel
> but
> you are interested in the NamedGraphSet that backs the NamedGraphModel.
> Right?
> If so, you should be able to call
>
> ( (NamedGraphModel) infModel.getRawModel() ).getNamedGraphSet()
>
Frankly, either would do. All I want is a way to get back the provenance
information.
>
> Greetings,
> Olaf
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> ng4j-namedgraphs mailing list
> ng4j-namedgraphs@...
> https://lists.sourceforge.net/lists/listinfo/ng4j-namedgraphs
>
Thanks,
Arun
|