You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by ajs6f <aj...@apache.org> on 2018/04/24 12:10:54 UTC
Re: Question about Jena Indexing
Hello, Anuj--
I may be missing something about your question, but wouldn't Model.add(Model) [1] work here?
ajs6f
[1] https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/Model.html#add-org.apache.jena.rdf.model.Model-
> On Apr 24, 2018, at 7:14 AM, anuj kumar <an...@gmail.com> wrote:
>
> Hi,
> I have a scenario, where I have an instance of a Model Object that contains
> multiple Statements.
> Now I want to index the statements in this Model in Jena Text ES indexing
> implementation.
>
> *Question is*: How can i do that. :)
>
> Until now I was indexing data by reading the data from a file into a model
> instance using RDFDataMgr which automatically binds the read with the index
> lifecycle. This was done like this:
>
>> dataset.begin(ReadWrite.WRITE) ;
>> try {
>> Model m = dataset.getDefaultModel() ;
>> RDFDataMgr.read(m, file) ;
>> dataset.commit() ;
>> } finally { dataset.end() ; }
>>
>>
>> But now, instead of reading the triples from a file (or Inputstream), i
> want to read the triples from a Model Instance.
>
> Can someone help me with this please.
>
> Thanks,
> Anuj Kumar
>
> --
> *Anuj Kumar*
Re: Question about Jena Indexing
Posted by anuj kumar <an...@gmail.com>.
Hey Ajs6f,
Thats what I also thought but I tried the approach and it didn't work.
This is how i did it
> dataset.begin(ReadWrite.WRITE) ;
> try {
> Model m = dataset.getDefaultModel() ;
> Model m2 = ModelFactory.createDefaultModel();
> m2.read(file);
> m2.write(System.out);
> m.add(m2);
> // RDFDataMgr.read(m, file) ;
> dataset.commit() ;
>
> I may be doing something stupid here, i know.
I will keep digging.
Thanks,
Anuj Kumar
On Tue, Apr 24, 2018 at 2:10 PM, ajs6f <aj...@apache.org> wrote:
> Hello, Anuj--
>
> I may be missing something about your question, but wouldn't
> Model.add(Model) [1] work here?
>
> ajs6f
>
> [1] https://jena.apache.org/documentation/javadoc/jena/
> org/apache/jena/rdf/model/Model.html#add-org.apache.jena.rdf.model.Model-
>
> > On Apr 24, 2018, at 7:14 AM, anuj kumar <an...@gmail.com> wrote:
> >
> > Hi,
> > I have a scenario, where I have an instance of a Model Object that
> contains
> > multiple Statements.
> > Now I want to index the statements in this Model in Jena Text ES indexing
> > implementation.
> >
> > *Question is*: How can i do that. :)
> >
> > Until now I was indexing data by reading the data from a file into a
> model
> > instance using RDFDataMgr which automatically binds the read with the
> index
> > lifecycle. This was done like this:
> >
> >> dataset.begin(ReadWrite.WRITE) ;
> >> try {
> >> Model m = dataset.getDefaultModel() ;
> >> RDFDataMgr.read(m, file) ;
> >> dataset.commit() ;
> >> } finally { dataset.end() ; }
> >>
> >>
> >> But now, instead of reading the triples from a file (or Inputstream), i
> > want to read the triples from a Model Instance.
> >
> > Can someone help me with this please.
> >
> > Thanks,
> > Anuj Kumar
> >
> > --
> > *Anuj Kumar*
>
>
--
*Anuj Kumar*