You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Wetz Peter <pe...@tuwien.ac.at> on 2014/10/02 08:19:24 UTC
RDF Streaming timestamp annotated triples/quads in Jena: Create a
Quadruple in Jena and store it as a file, or outputstream
With Jena I want to create a quadruple to create triples + a timestamp to store so called "streaming RDF data", which is an upcoming area of interest in both research and industry.
For reference please see the RSP (RDF Stream Processing) Community group over at the W3C which recently formed to eventually work out a W3C Recommendation Draft on this topic: [1]. In their wiki they define RDF streams as "streams consisting of RDF elements [...] annotated by a minimum of one timestamp or interval." [2]
So, all I want to do is to be able to store a quadruple, i.e., a Subject - Predicate - Object relation + a Timestamp. In one implementation of such a RDF Stream Processor they are simply doing it like this:
RdfQuadruple q = new RdfQuadruple(subject, predicate, object, timestamp);
My question is, how this can be done similarly in Jena?
I thought about "abusing" the quad-feature for this. Yes, quads actually are a feature for storing triples in named graphs, but I thought about "abusing" quads by just using a timestamp for the graph-node-parameter. I dont know if this approach scales, but I just wanted to give it a try. However, I am not able to get a running example. I can create a quad, but then don't know how to store this in a DatasetGraph and writing it into a file.
If someone could provide a running example of creating a quad + storing it in a file, this would be highly appreciated. More generally, if someone has a better idea to store quadruples, i.e., time annotated RDF triples, I am also happy to hear from you.
Best regards,
Peter
[1] http://www.w3.org/community/rsp/
[2] http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope_of_the_Community_Group
Re: AW: AW: RDF Streaming timestamp annotated triples/quads in Jena:
Create a Quadruple in Jena and store it as a file, or outputstream
Posted by Andy Seaborne <an...@apache.org>.
On 03/10/14 10:07, Wetz Peter wrote:
> Andy, thanks for your suggestions again and thanks for pointing to the other threads in order to have some sort of consistent access to my questions ;)
>
>> You could take the source code and change this (it's a trivial change) to add a
>> new format that is triples+time.
>
> this sounds interesting to me. could you elaborate on that? with "add a new format" do you mean a new serialization format in jena, i.e., a class like LANG.NQUADS? Or do you mean something else?
>
> I'd be glad if you could provide pointers on how to add a new format, i.e., triples+time.
Have a look at NQUADS - the parser is LangNQuads (actually LangNTuple),
Lang/RDFLanguages for contants and RDFParserRegistry/RDFWriterRegistry
for registration.
That will get you some machinery. I still think there is a bigger
question for you. Adding a time component to a triples is outside RDF
and indeed the "RDF way" is different (model the events, not the triples).
Access and manipulation of triples+time is going to be unnatural in a
pure RDF viewpoint by overloading the fourth field of a quad.
Andy
>
> Thanks and best,
> Peter
>
>> -----Ursprüngliche Nachricht-----
>> Von: Andy Seaborne [mailto:andy@apache.org]
>> Gesendet: Donnerstag, 02. Oktober 2014 22:54
>> An: users@jena.apache.org
>> Betreff: Re: AW: RDF Streaming timestamp annotated triples/quads in Jena:
>> Create a Quadruple in Jena and store it as a file, or outputstream
>>
>> On 02/10/14 08:39, Wetz Peter wrote:
>>> Thanks for your response and the pointers. I will definitely have a closer
>> look and am happy to mutually share advances in this area.
>>>
>>> Meanwhile I could solve my technical and intial problem of storing a
>>> quad in Jena. It's important to write the quad in a format which
>>> supports quads, obviously. So one should use, e.g., N-QUADs. See below.
>>
>> N-Quads requires a URI or bnode as the graph name. There are limits as to
>> how far the code will work when you go outside standard RDF.
>>
>> You could take the source code and change this (it's a trivial change) to add a
>> new format that is triples+time. Or use Michel's suggestion, or use named
>> graphs and provenance about the graph.
>>
>> My answer at:
>> http://answers.semanticweb.com/questions/30509/how-to-write-a-quad-
>> into-a-jena-graph-and-then-to-file
>>
>> also comments on:
>> http://stackoverflow.com/questions/26145412/how-to-write-a-quad-into-a-
>> jena-graph-and-then-to-file
>>
>> Andy
>>
>>>
>>> The running code looks like this:
>>> DatasetGraph dsg = DatasetGraphFactory.createMem(); Triple e1 = new
>>> Triple(subject, predicate, object); Quad quad1 = new Quad(timestamp,
>>> e1); dsg.add(quad1); //and then write it into an output stream
>>> OutputStream output; output = new
>>> FileOutputStream("c:\\output-text.nq");
>>> RDFDataMgr.write(output, dsg, Lang.NQ);
>>>
>>>
>>>
>>> hth
>>>
>>> best,
>>> Peter
>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Bohms, H.M. (Michel) [mailto:michel.bohms@tno.nl]
>>>> Gesendet: Donnerstag, 02. Oktober 2014 09:30
>>>> An: users@jena.apache.org
>>>> Cc: Theo.Rieswijk@priva.nl; Taal, J. (Johan);
>>>> miguel.oltra@telvent.com; miguel.oltra@telvent.com; Leandro Madrazo
>>>> Agudin
>>>> Betreff: RE: RDF Streaming timestamp annotated triples/quads in Jena:
>>>> Create a Quadruple in Jena and store it as a file, or outputstream
>>>>
>>>> Dear Peter,
>>>>
>>>> Thanks for this very interesting info on streaming rdf, never heard
>>>> about it before.
>>>> In a running eu project (odysseus) we develop ontologies that deal
>>>> with dynamic properties (energy-related measurements by sensors etc.
>>>> in buildings and districts) involving time series, interval values,
>>>> units, time stamps etc. I included some ontology (depc)/dataset
>>>> (examples). Clearly having my worries wrt performance in case of
>>>> bigdata sets..so any base support on meta-level would help I guess...
>>>>
>>>> In depc we use units (of QUDT) as underlying types for the properties.
>>>>
>>>> We also dev. in parallel a more class-based approach
>>>>
>> (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experimen
>>>> t
>>>> al+CBNL+MG+Extension/WebHome)
>>>> Where property instances can have more (meta-)info like unit, but in
>>>> future more value-info like timestamp/interval (unless of course
>>>> built-in on higher level like via RSP...
>>>>
>>>> So, sorry not to be able to answer your question, but guess we share
>>>> a similar interest...
>>>>
>>>> Greetings, Michel
>>>>
>>>> Dr. ir. H.M. (Michel) Bohms
>>>> Sr. Research Scientist
>>>> Structural Reliability
>>>> T +31 (0)88 866 31 07
>>>> M +31 (0)63 038 12 20
>>>> E michel.bohms@tno.nl
>>>>
>>>> This message may contain information that is not intended for you. If
>>>> you are not the addressee or if this message was sent to you by
>>>> mistake, you are requested to inform the sender and delete the
>>>> message. TNO accepts no liability for the content of this e-mail, for
>>>> the manner in which you use it and for damage of any kind resulting
>>>> from the risks inherent to the electronic transmission of messages.
>>>>
>>>> -----Original Message-----
>>>> From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
>>>> Sent: donderdag 2 oktober 2014 8:19
>>>> To: users@jena.apache.org
>>>> Subject: RDF Streaming timestamp annotated triples/quads in Jena:
>>>> Create a Quadruple in Jena and store it as a file, or outputstream
>>>>
>>>> With Jena I want to create a quadruple to create triples + a
>>>> timestamp to store so called "streaming RDF data", which is an
>>>> upcoming area of interest in both research and industry.
>>>>
>>>> For reference please see the RSP (RDF Stream Processing) Community
>>>> group over at the W3C which recently formed to eventually work out a
>>>> W3C Recommendation Draft on this topic: [1]. In their wiki they
>>>> define RDF streams as "streams consisting of RDF elements [...]
>>>> annotated by a minimum of one timestamp or interval." [2]
>>>>
>>>> So, all I want to do is to be able to store a quadruple, i.e., a
>>>> Subject - Predicate - Object relation + a Timestamp. In one
>>>> implementation of such a RDF Stream Processor they are simply doing it
>> like this:
>>>> RdfQuadruple q = new RdfQuadruple(subject, predicate, object,
>>>> timestamp);
>>>>
>>>> My question is, how this can be done similarly in Jena?
>>>>
>>>> I thought about "abusing" the quad-feature for this. Yes, quads
>>>> actually are a feature for storing triples in named graphs, but I thought
>> about "abusing"
>>>> quads by just using a timestamp for the graph-node-parameter. I dont
>>>> know if this approach scales, but I just wanted to give it a try.
>>>> However, I am not able to get a running example. I can create a quad,
>>>> but then don't know how to store this in a DatasetGraph and writing it
>> into a file.
>>>>
>>>> If someone could provide a running example of creating a quad +
>>>> storing it in a file, this would be highly appreciated. More
>>>> generally, if someone has a better idea to store quadruples, i.e.,
>>>> time annotated RDF triples, I am also happy to hear from you.
>>>>
>>>> Best regards,
>>>> Peter
>>>>
>>>> [1] http://www.w3.org/community/rsp/
>>>> [2]
>>>>
>> http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope
>>>> _of_the_Community_Group
>
AW: AW: RDF Streaming timestamp annotated triples/quads in Jena:
Create a Quadruple in Jena and store it as a file, or outputstream
Posted by Wetz Peter <pe...@tuwien.ac.at>.
Andy, thanks for your suggestions again and thanks for pointing to the other threads in order to have some sort of consistent access to my questions ;)
> You could take the source code and change this (it's a trivial change) to add a
> new format that is triples+time.
this sounds interesting to me. could you elaborate on that? with "add a new format" do you mean a new serialization format in jena, i.e., a class like LANG.NQUADS? Or do you mean something else?
I'd be glad if you could provide pointers on how to add a new format, i.e., triples+time.
Thanks and best,
Peter
> -----Ursprüngliche Nachricht-----
> Von: Andy Seaborne [mailto:andy@apache.org]
> Gesendet: Donnerstag, 02. Oktober 2014 22:54
> An: users@jena.apache.org
> Betreff: Re: AW: RDF Streaming timestamp annotated triples/quads in Jena:
> Create a Quadruple in Jena and store it as a file, or outputstream
>
> On 02/10/14 08:39, Wetz Peter wrote:
> > Thanks for your response and the pointers. I will definitely have a closer
> look and am happy to mutually share advances in this area.
> >
> > Meanwhile I could solve my technical and intial problem of storing a
> > quad in Jena. It's important to write the quad in a format which
> > supports quads, obviously. So one should use, e.g., N-QUADs. See below.
>
> N-Quads requires a URI or bnode as the graph name. There are limits as to
> how far the code will work when you go outside standard RDF.
>
> You could take the source code and change this (it's a trivial change) to add a
> new format that is triples+time. Or use Michel's suggestion, or use named
> graphs and provenance about the graph.
>
> My answer at:
> http://answers.semanticweb.com/questions/30509/how-to-write-a-quad-
> into-a-jena-graph-and-then-to-file
>
> also comments on:
> http://stackoverflow.com/questions/26145412/how-to-write-a-quad-into-a-
> jena-graph-and-then-to-file
>
> Andy
>
> >
> > The running code looks like this:
> > DatasetGraph dsg = DatasetGraphFactory.createMem(); Triple e1 = new
> > Triple(subject, predicate, object); Quad quad1 = new Quad(timestamp,
> > e1); dsg.add(quad1); //and then write it into an output stream
> > OutputStream output; output = new
> > FileOutputStream("c:\\output-text.nq");
> > RDFDataMgr.write(output, dsg, Lang.NQ);
> >
> >
> >
> > hth
> >
> > best,
> > Peter
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Bohms, H.M. (Michel) [mailto:michel.bohms@tno.nl]
> >> Gesendet: Donnerstag, 02. Oktober 2014 09:30
> >> An: users@jena.apache.org
> >> Cc: Theo.Rieswijk@priva.nl; Taal, J. (Johan);
> >> miguel.oltra@telvent.com; miguel.oltra@telvent.com; Leandro Madrazo
> >> Agudin
> >> Betreff: RE: RDF Streaming timestamp annotated triples/quads in Jena:
> >> Create a Quadruple in Jena and store it as a file, or outputstream
> >>
> >> Dear Peter,
> >>
> >> Thanks for this very interesting info on streaming rdf, never heard
> >> about it before.
> >> In a running eu project (odysseus) we develop ontologies that deal
> >> with dynamic properties (energy-related measurements by sensors etc.
> >> in buildings and districts) involving time series, interval values,
> >> units, time stamps etc. I included some ontology (depc)/dataset
> >> (examples). Clearly having my worries wrt performance in case of
> >> bigdata sets..so any base support on meta-level would help I guess...
> >>
> >> In depc we use units (of QUDT) as underlying types for the properties.
> >>
> >> We also dev. in parallel a more class-based approach
> >>
> (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experimen
> >> t
> >> al+CBNL+MG+Extension/WebHome)
> >> Where property instances can have more (meta-)info like unit, but in
> >> future more value-info like timestamp/interval (unless of course
> >> built-in on higher level like via RSP...
> >>
> >> So, sorry not to be able to answer your question, but guess we share
> >> a similar interest...
> >>
> >> Greetings, Michel
> >>
> >> Dr. ir. H.M. (Michel) Bohms
> >> Sr. Research Scientist
> >> Structural Reliability
> >> T +31 (0)88 866 31 07
> >> M +31 (0)63 038 12 20
> >> E michel.bohms@tno.nl
> >>
> >> This message may contain information that is not intended for you. If
> >> you are not the addressee or if this message was sent to you by
> >> mistake, you are requested to inform the sender and delete the
> >> message. TNO accepts no liability for the content of this e-mail, for
> >> the manner in which you use it and for damage of any kind resulting
> >> from the risks inherent to the electronic transmission of messages.
> >>
> >> -----Original Message-----
> >> From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
> >> Sent: donderdag 2 oktober 2014 8:19
> >> To: users@jena.apache.org
> >> Subject: RDF Streaming timestamp annotated triples/quads in Jena:
> >> Create a Quadruple in Jena and store it as a file, or outputstream
> >>
> >> With Jena I want to create a quadruple to create triples + a
> >> timestamp to store so called "streaming RDF data", which is an
> >> upcoming area of interest in both research and industry.
> >>
> >> For reference please see the RSP (RDF Stream Processing) Community
> >> group over at the W3C which recently formed to eventually work out a
> >> W3C Recommendation Draft on this topic: [1]. In their wiki they
> >> define RDF streams as "streams consisting of RDF elements [...]
> >> annotated by a minimum of one timestamp or interval." [2]
> >>
> >> So, all I want to do is to be able to store a quadruple, i.e., a
> >> Subject - Predicate - Object relation + a Timestamp. In one
> >> implementation of such a RDF Stream Processor they are simply doing it
> like this:
> >> RdfQuadruple q = new RdfQuadruple(subject, predicate, object,
> >> timestamp);
> >>
> >> My question is, how this can be done similarly in Jena?
> >>
> >> I thought about "abusing" the quad-feature for this. Yes, quads
> >> actually are a feature for storing triples in named graphs, but I thought
> about "abusing"
> >> quads by just using a timestamp for the graph-node-parameter. I dont
> >> know if this approach scales, but I just wanted to give it a try.
> >> However, I am not able to get a running example. I can create a quad,
> >> but then don't know how to store this in a DatasetGraph and writing it
> into a file.
> >>
> >> If someone could provide a running example of creating a quad +
> >> storing it in a file, this would be highly appreciated. More
> >> generally, if someone has a better idea to store quadruples, i.e.,
> >> time annotated RDF triples, I am also happy to hear from you.
> >>
> >> Best regards,
> >> Peter
> >>
> >> [1] http://www.w3.org/community/rsp/
> >> [2]
> >>
> http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope
> >> _of_the_Community_Group
Re: AW: RDF Streaming timestamp annotated triples/quads in Jena:
Create a Quadruple in Jena and store it as a file, or outputstream
Posted by Andy Seaborne <an...@apache.org>.
On 02/10/14 08:39, Wetz Peter wrote:
> Thanks for your response and the pointers. I will definitely have a closer look and am happy to mutually share advances in this area.
>
> Meanwhile I could solve my technical and intial problem of storing a
> quad in Jena. It's important to write the quad in a format which
> supports quads, obviously. So one should use, e.g., N-QUADs. See below.
N-Quads requires a URI or bnode as the graph name. There are limits as
to how far the code will work when you go outside standard RDF.
You could take the source code and change this (it's a trivial change)
to add a new format that is triples+time. Or use Michel's suggestion,
or use named graphs and provenance about the graph.
My answer at:
http://answers.semanticweb.com/questions/30509/how-to-write-a-quad-into-a-jena-graph-and-then-to-file
also comments on:
http://stackoverflow.com/questions/26145412/how-to-write-a-quad-into-a-jena-graph-and-then-to-file
Andy
>
> The running code looks like this:
> DatasetGraph dsg = DatasetGraphFactory.createMem();
> Triple e1 = new Triple(subject, predicate, object);
> Quad quad1 = new Quad(timestamp, e1);
> dsg.add(quad1);
> //and then write it into an output stream
> OutputStream output;
> output = new FileOutputStream("c:\\output-text.nq");
> RDFDataMgr.write(output, dsg, Lang.NQ);
>
>
>
> hth
>
> best,
> Peter
>
>> -----Ursprüngliche Nachricht-----
>> Von: Bohms, H.M. (Michel) [mailto:michel.bohms@tno.nl]
>> Gesendet: Donnerstag, 02. Oktober 2014 09:30
>> An: users@jena.apache.org
>> Cc: Theo.Rieswijk@priva.nl; Taal, J. (Johan); miguel.oltra@telvent.com;
>> miguel.oltra@telvent.com; Leandro Madrazo Agudin
>> Betreff: RE: RDF Streaming timestamp annotated triples/quads in Jena:
>> Create a Quadruple in Jena and store it as a file, or outputstream
>>
>> Dear Peter,
>>
>> Thanks for this very interesting info on streaming rdf, never heard about it
>> before.
>> In a running eu project (odysseus) we develop ontologies that deal with
>> dynamic properties (energy-related measurements by sensors etc. in
>> buildings and districts) involving time series, interval values, units, time
>> stamps etc. I included some ontology (depc)/dataset (examples). Clearly
>> having my worries wrt performance in case of bigdata sets..so any base
>> support on meta-level would help I guess...
>>
>> In depc we use units (of QUDT) as underlying types for the properties.
>>
>> We also dev. in parallel a more class-based approach
>> (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experiment
>> al+CBNL+MG+Extension/WebHome)
>> Where property instances can have more (meta-)info like unit, but in future
>> more value-info like timestamp/interval (unless of course built-in on higher
>> level like via RSP...
>>
>> So, sorry not to be able to answer your question, but guess we share a similar
>> interest...
>>
>> Greetings, Michel
>>
>> Dr. ir. H.M. (Michel) Bohms
>> Sr. Research Scientist
>> Structural Reliability
>> T +31 (0)88 866 31 07
>> M +31 (0)63 038 12 20
>> E michel.bohms@tno.nl
>>
>> This message may contain information that is not intended for you. If you are
>> not the addressee or if this message was sent to you by mistake, you are
>> requested to inform the sender and delete the message. TNO accepts no
>> liability for the content of this e-mail, for the manner in which you use it and
>> for damage of any kind resulting from the risks inherent to the electronic
>> transmission of messages.
>>
>> -----Original Message-----
>> From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
>> Sent: donderdag 2 oktober 2014 8:19
>> To: users@jena.apache.org
>> Subject: RDF Streaming timestamp annotated triples/quads in Jena: Create a
>> Quadruple in Jena and store it as a file, or outputstream
>>
>> With Jena I want to create a quadruple to create triples + a timestamp to
>> store so called "streaming RDF data", which is an upcoming area of interest in
>> both research and industry.
>>
>> For reference please see the RSP (RDF Stream Processing) Community group
>> over at the W3C which recently formed to eventually work out a W3C
>> Recommendation Draft on this topic: [1]. In their wiki they define RDF
>> streams as "streams consisting of RDF elements [...] annotated by a
>> minimum of one timestamp or interval." [2]
>>
>> So, all I want to do is to be able to store a quadruple, i.e., a Subject -
>> Predicate - Object relation + a Timestamp. In one implementation of such a
>> RDF Stream Processor they are simply doing it like this:
>> RdfQuadruple q = new RdfQuadruple(subject, predicate, object, timestamp);
>>
>> My question is, how this can be done similarly in Jena?
>>
>> I thought about "abusing" the quad-feature for this. Yes, quads actually are a
>> feature for storing triples in named graphs, but I thought about "abusing"
>> quads by just using a timestamp for the graph-node-parameter. I dont know
>> if this approach scales, but I just wanted to give it a try. However, I am not
>> able to get a running example. I can create a quad, but then don't know how
>> to store this in a DatasetGraph and writing it into a file.
>>
>> If someone could provide a running example of creating a quad + storing it in
>> a file, this would be highly appreciated. More generally, if someone has a
>> better idea to store quadruples, i.e., time annotated RDF triples, I am also
>> happy to hear from you.
>>
>> Best regards,
>> Peter
>>
>> [1] http://www.w3.org/community/rsp/
>> [2]
>> http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope
>> _of_the_Community_Group
Re: RDF Streaming timestamp annotated triples/quads in Jena: Create a
Quadruple in Jena and store it as a file, or outputstream
Posted by Claude Warren <cl...@xenei.com>.
With respect to time series data I thought that the data cube vocabulary (
http://www.w3.org/TR/vocab-data-cube/) was supposed to support that.
Don't know if this meets your need however.
Claude
On Thu, Oct 2, 2014 at 8:39 AM, Wetz Peter <pe...@tuwien.ac.at> wrote:
> Thanks for your response and the pointers. I will definitely have a closer
> look and am happy to mutually share advances in this area.
>
> Meanwhile I could solve my technical and intial problem of storing a quad
> in Jena. It's important to write the quad in a format which supports quads,
> obviously. So one should use, e.g., N-QUADs. See below.
>
> The running code looks like this:
> DatasetGraph dsg = DatasetGraphFactory.createMem();
> Triple e1 = new Triple(subject, predicate, object);
> Quad quad1 = new Quad(timestamp, e1);
> dsg.add(quad1);
> //and then write it into an output stream
> OutputStream output;
> output = new FileOutputStream("c:\\output-text.nq");
> RDFDataMgr.write(output, dsg, Lang.NQ);
>
>
>
> hth
>
> best,
> Peter
>
> > -----Ursprüngliche Nachricht-----
> > Von: Bohms, H.M. (Michel) [mailto:michel.bohms@tno.nl]
> > Gesendet: Donnerstag, 02. Oktober 2014 09:30
> > An: users@jena.apache.org
> > Cc: Theo.Rieswijk@priva.nl; Taal, J. (Johan); miguel.oltra@telvent.com;
> > miguel.oltra@telvent.com; Leandro Madrazo Agudin
> > Betreff: RE: RDF Streaming timestamp annotated triples/quads in Jena:
> > Create a Quadruple in Jena and store it as a file, or outputstream
> >
> > Dear Peter,
> >
> > Thanks for this very interesting info on streaming rdf, never heard
> about it
> > before.
> > In a running eu project (odysseus) we develop ontologies that deal with
> > dynamic properties (energy-related measurements by sensors etc. in
> > buildings and districts) involving time series, interval values, units,
> time
> > stamps etc. I included some ontology (depc)/dataset (examples). Clearly
> > having my worries wrt performance in case of bigdata sets..so any base
> > support on meta-level would help I guess...
> >
> > In depc we use units (of QUDT) as underlying types for the properties.
> >
> > We also dev. in parallel a more class-based approach
> > (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experiment
> > al+CBNL+MG+Extension/WebHome)
> > Where property instances can have more (meta-)info like unit, but in
> future
> > more value-info like timestamp/interval (unless of course built-in on
> higher
> > level like via RSP...
> >
> > So, sorry not to be able to answer your question, but guess we share a
> similar
> > interest...
> >
> > Greetings, Michel
> >
> > Dr. ir. H.M. (Michel) Bohms
> > Sr. Research Scientist
> > Structural Reliability
> > T +31 (0)88 866 31 07
> > M +31 (0)63 038 12 20
> > E michel.bohms@tno.nl
> >
> > This message may contain information that is not intended for you. If
> you are
> > not the addressee or if this message was sent to you by mistake, you are
> > requested to inform the sender and delete the message. TNO accepts no
> > liability for the content of this e-mail, for the manner in which you
> use it and
> > for damage of any kind resulting from the risks inherent to the
> electronic
> > transmission of messages.
> >
> > -----Original Message-----
> > From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
> > Sent: donderdag 2 oktober 2014 8:19
> > To: users@jena.apache.org
> > Subject: RDF Streaming timestamp annotated triples/quads in Jena: Create
> a
> > Quadruple in Jena and store it as a file, or outputstream
> >
> > With Jena I want to create a quadruple to create triples + a timestamp to
> > store so called "streaming RDF data", which is an upcoming area of
> interest in
> > both research and industry.
> >
> > For reference please see the RSP (RDF Stream Processing) Community group
> > over at the W3C which recently formed to eventually work out a W3C
> > Recommendation Draft on this topic: [1]. In their wiki they define RDF
> > streams as "streams consisting of RDF elements [...] annotated by a
> > minimum of one timestamp or interval." [2]
> >
> > So, all I want to do is to be able to store a quadruple, i.e., a Subject
> -
> > Predicate - Object relation + a Timestamp. In one implementation of such
> a
> > RDF Stream Processor they are simply doing it like this:
> > RdfQuadruple q = new RdfQuadruple(subject, predicate, object, timestamp);
> >
> > My question is, how this can be done similarly in Jena?
> >
> > I thought about "abusing" the quad-feature for this. Yes, quads actually
> are a
> > feature for storing triples in named graphs, but I thought about
> "abusing"
> > quads by just using a timestamp for the graph-node-parameter. I dont know
> > if this approach scales, but I just wanted to give it a try. However, I
> am not
> > able to get a running example. I can create a quad, but then don't know
> how
> > to store this in a DatasetGraph and writing it into a file.
> >
> > If someone could provide a running example of creating a quad + storing
> it in
> > a file, this would be highly appreciated. More generally, if someone has
> a
> > better idea to store quadruples, i.e., time annotated RDF triples, I am
> also
> > happy to hear from you.
> >
> > Best regards,
> > Peter
> >
> > [1] http://www.w3.org/community/rsp/
> > [2]
> > http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope
> > _of_the_Community_Group
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
AW: RDF Streaming timestamp annotated triples/quads in Jena: Create
a Quadruple in Jena and store it as a file, or outputstream
Posted by Wetz Peter <pe...@tuwien.ac.at>.
Thanks for your response and the pointers. I will definitely have a closer look and am happy to mutually share advances in this area.
Meanwhile I could solve my technical and intial problem of storing a quad in Jena. It's important to write the quad in a format which supports quads, obviously. So one should use, e.g., N-QUADs. See below.
The running code looks like this:
DatasetGraph dsg = DatasetGraphFactory.createMem();
Triple e1 = new Triple(subject, predicate, object);
Quad quad1 = new Quad(timestamp, e1);
dsg.add(quad1);
//and then write it into an output stream
OutputStream output;
output = new FileOutputStream("c:\\output-text.nq");
RDFDataMgr.write(output, dsg, Lang.NQ);
hth
best,
Peter
> -----Ursprüngliche Nachricht-----
> Von: Bohms, H.M. (Michel) [mailto:michel.bohms@tno.nl]
> Gesendet: Donnerstag, 02. Oktober 2014 09:30
> An: users@jena.apache.org
> Cc: Theo.Rieswijk@priva.nl; Taal, J. (Johan); miguel.oltra@telvent.com;
> miguel.oltra@telvent.com; Leandro Madrazo Agudin
> Betreff: RE: RDF Streaming timestamp annotated triples/quads in Jena:
> Create a Quadruple in Jena and store it as a file, or outputstream
>
> Dear Peter,
>
> Thanks for this very interesting info on streaming rdf, never heard about it
> before.
> In a running eu project (odysseus) we develop ontologies that deal with
> dynamic properties (energy-related measurements by sensors etc. in
> buildings and districts) involving time series, interval values, units, time
> stamps etc. I included some ontology (depc)/dataset (examples). Clearly
> having my worries wrt performance in case of bigdata sets..so any base
> support on meta-level would help I guess...
>
> In depc we use units (of QUDT) as underlying types for the properties.
>
> We also dev. in parallel a more class-based approach
> (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experiment
> al+CBNL+MG+Extension/WebHome)
> Where property instances can have more (meta-)info like unit, but in future
> more value-info like timestamp/interval (unless of course built-in on higher
> level like via RSP...
>
> So, sorry not to be able to answer your question, but guess we share a similar
> interest...
>
> Greetings, Michel
>
> Dr. ir. H.M. (Michel) Bohms
> Sr. Research Scientist
> Structural Reliability
> T +31 (0)88 866 31 07
> M +31 (0)63 038 12 20
> E michel.bohms@tno.nl
>
> This message may contain information that is not intended for you. If you are
> not the addressee or if this message was sent to you by mistake, you are
> requested to inform the sender and delete the message. TNO accepts no
> liability for the content of this e-mail, for the manner in which you use it and
> for damage of any kind resulting from the risks inherent to the electronic
> transmission of messages.
>
> -----Original Message-----
> From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
> Sent: donderdag 2 oktober 2014 8:19
> To: users@jena.apache.org
> Subject: RDF Streaming timestamp annotated triples/quads in Jena: Create a
> Quadruple in Jena and store it as a file, or outputstream
>
> With Jena I want to create a quadruple to create triples + a timestamp to
> store so called "streaming RDF data", which is an upcoming area of interest in
> both research and industry.
>
> For reference please see the RSP (RDF Stream Processing) Community group
> over at the W3C which recently formed to eventually work out a W3C
> Recommendation Draft on this topic: [1]. In their wiki they define RDF
> streams as "streams consisting of RDF elements [...] annotated by a
> minimum of one timestamp or interval." [2]
>
> So, all I want to do is to be able to store a quadruple, i.e., a Subject -
> Predicate - Object relation + a Timestamp. In one implementation of such a
> RDF Stream Processor they are simply doing it like this:
> RdfQuadruple q = new RdfQuadruple(subject, predicate, object, timestamp);
>
> My question is, how this can be done similarly in Jena?
>
> I thought about "abusing" the quad-feature for this. Yes, quads actually are a
> feature for storing triples in named graphs, but I thought about "abusing"
> quads by just using a timestamp for the graph-node-parameter. I dont know
> if this approach scales, but I just wanted to give it a try. However, I am not
> able to get a running example. I can create a quad, but then don't know how
> to store this in a DatasetGraph and writing it into a file.
>
> If someone could provide a running example of creating a quad + storing it in
> a file, this would be highly appreciated. More generally, if someone has a
> better idea to store quadruples, i.e., time annotated RDF triples, I am also
> happy to hear from you.
>
> Best regards,
> Peter
>
> [1] http://www.w3.org/community/rsp/
> [2]
> http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope
> _of_the_Community_Group
RE: RDF Streaming timestamp annotated triples/quads in Jena: Create
a Quadruple in Jena and store it as a file, or outputstream
Posted by "Bohms, H.M. (Michel)" <mi...@tno.nl>.
Dear Peter,
Thanks for this very interesting info on streaming rdf, never heard about it before.
In a running eu project (odysseus) we develop ontologies that deal with dynamic properties (energy-related measurements by sensors etc. in buildings and districts) involving time series, interval values, units, time stamps etc. I included some ontology (depc)/dataset (examples). Clearly having my worries wrt performance in case of bigdata sets..so any base support on meta-level would help I guess...
In depc we use units (of QUDT) as underlying types for the properties.
We also dev. in parallel a more class-based approach (http://vps16544.public.cloudvps.com/xwiki/bin/view/4.+VCON+Experimental+CBNL+MG+Extension/WebHome)
Where property instances can have more (meta-)info like unit, but in future more value-info like timestamp/interval (unless of course built-in on higher level like via RSP...
So, sorry not to be able to answer your question, but guess we share a similar interest...
Greetings, Michel
Dr. ir. H.M. (Michel) Bohms
Sr. Research Scientist
Structural Reliability
T +31 (0)88 866 31 07
M +31 (0)63 038 12 20
E michel.bohms@tno.nl
This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.
-----Original Message-----
From: Wetz Peter [mailto:peter.wetz@tuwien.ac.at]
Sent: donderdag 2 oktober 2014 8:19
To: users@jena.apache.org
Subject: RDF Streaming timestamp annotated triples/quads in Jena: Create a Quadruple in Jena and store it as a file, or outputstream
With Jena I want to create a quadruple to create triples + a timestamp to store so called "streaming RDF data", which is an upcoming area of interest in both research and industry.
For reference please see the RSP (RDF Stream Processing) Community group over at the W3C which recently formed to eventually work out a W3C Recommendation Draft on this topic: [1]. In their wiki they define RDF streams as "streams consisting of RDF elements [...] annotated by a minimum of one timestamp or interval." [2]
So, all I want to do is to be able to store a quadruple, i.e., a Subject - Predicate - Object relation + a Timestamp. In one implementation of such a RDF Stream Processor they are simply doing it like this:
RdfQuadruple q = new RdfQuadruple(subject, predicate, object, timestamp);
My question is, how this can be done similarly in Jena?
I thought about "abusing" the quad-feature for this. Yes, quads actually are a feature for storing triples in named graphs, but I thought about "abusing" quads by just using a timestamp for the graph-node-parameter. I dont know if this approach scales, but I just wanted to give it a try. However, I am not able to get a running example. I can create a quad, but then don't know how to store this in a DatasetGraph and writing it into a file.
If someone could provide a running example of creating a quad + storing it in a file, this would be highly appreciated. More generally, if someone has a better idea to store quadruples, i.e., time annotated RDF triples, I am also happy to hear from you.
Best regards,
Peter
[1] http://www.w3.org/community/rsp/
[2] http://www.w3.org/community/rsp/wiki/Concepts_and_Definitions#Scope_of_the_Community_Group