You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commonsrdf.apache.org by Stian Soiland-Reyes <st...@apache.org> on 2016/03/27 21:20:44 UTC

RDFParserBuilder draft

Happy Easter!

Time for some RDF hacking..


I started a draft interface for preparing and running an RDF parser:


https://github.com/apache/incubator-commonsrdf/blob/parser-writer-interface/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java

This builds on a previous idea I had at
https://github.com/stain/commonsrdf-parser-jena
and Andy's work at
https://github.com/afs/commonsrdf-jena


An equivalent interface for writers would be pretty much the same but
with .write().


The idea is that of a builder pattern - so you can set parameters like
base() and contentType() if you want to - and must call
one of the source() variants (or any third-party extensions like source(URL)).

The parsing happens not until parse() -- which return a
Future<Graph> -- allowing asynchronous parsing.

If you don't specify intoGraph() or rdfTermFactory() the
implementation is free to choose what kind of Graph it will return.


Then we can try out integrations with Jena, Sesame, JSONLD-Java etc.
that provide such builders.

I've not thought too much about how you would discover those builders
or find the right one depending on the format you may want to parse -
would  through the RDFTermFactory.createParser() ?  (in which case
RDFTermFActory -> RDFFactory )


Thoughts?


-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: RDFParserBuilder draft

Posted by Sergio Fernández <wi...@apache.org>.
Quite productive coding weekend, Stian!

For me the early proposal looks fine. Let's evolve it and review a PR
whenever you feel it's ready.

On Mon, Mar 28, 2016 at 7:02 AM, Stian Soiland-Reyes <st...@apache.org>
wrote:

> My first attempt  to implement the RDFParserBuilder with Jena seems to
> work:
>
>
> https://github.com/stain/incubator-commonsrdf/blob/jena/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFParserBuilder.java
>
> https://github.com/stain/incubator-commonsrdf/blob/jena/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
>
> https://github.com/stain/incubator-commonsrdf/blob/jena/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java#L33
>
> (I only tested that one variation in the end.. :)
>
> Based on Andy's https://github.com/afs/commonsrdf-jena
> but added as a 'commons-rdf-jena' integration module.
>
> If we were to add this to Commons RDF, I wonder if we would need an IP
> Clearance from Andy, as it's lived a while on GitHub alone - however
> it already have "Licensed to the Apache Software Foundation" headers.
>
>
>
> On 27 March 2016 at 20:27, Stian Soiland-Reyes <st...@apache.org> wrote:
> > .. RDFParserBuilder JavaDoc:
> >
> >
> https://cdn.rawgit.com/stain/b588d39742ff7ccb3568/raw/8d92f3cbb06500eadf9be2d08b50512f337c2f06/-.html
> >
> > On 27 March 2016 at 20:20, Stian Soiland-Reyes <st...@apache.org> wrote:
> >> Happy Easter!
> >>
> >> Time for some RDF hacking..
> >>
> >>
> >> I started a draft interface for preparing and running an RDF parser:
> >>
> >>
> >>
> https://github.com/apache/incubator-commonsrdf/blob/parser-writer-interface/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java
> >>
> >> This builds on a previous idea I had at
> >> https://github.com/stain/commonsrdf-parser-jena
> >> and Andy's work at
> >> https://github.com/afs/commonsrdf-jena
> >>
> >>
> >> An equivalent interface for writers would be pretty much the same but
> >> with .write().
> >>
> >>
> >> The idea is that of a builder pattern - so you can set parameters like
> >> base() and contentType() if you want to - and must call
> >> one of the source() variants (or any third-party extensions like
> source(URL)).
> >>
> >> The parsing happens not until parse() -- which return a
> >> Future<Graph> -- allowing asynchronous parsing.
> >>
> >> If you don't specify intoGraph() or rdfTermFactory() the
> >> implementation is free to choose what kind of Graph it will return.
> >>
> >>
> >> Then we can try out integrations with Jena, Sesame, JSONLD-Java etc.
> >> that provide such builders.
> >>
> >> I've not thought too much about how you would discover those builders
> >> or find the right one depending on the format you may want to parse -
> >> would  through the RDFTermFactory.createParser() ?  (in which case
> >> RDFTermFActory -> RDFFactory )
> >>
> >>
> >> Thoughts?
> >>
> >>
> >> --
> >> Stian Soiland-Reyes
> >> Apache Taverna (incubating), Apache Commons RDF (incubating)
> >> http://orcid.org/0000-0001-9842-9718
> >
> >
> >
> > --
> > Stian Soiland-Reyes
> > Apache Taverna (incubating), Apache Commons RDF (incubating)
> > http://orcid.org/0000-0001-9842-9718
>
>
>
> --
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718
>



-- 
Sergio Fernández
Partner Technology Manager
Redlink GmbH
m: +43 6602747925
e: sergio.fernandez@redlink.co
w: http://redlink.co

Re: RDFParserBuilder draft

Posted by Stian Soiland-Reyes <st...@apache.org>.
My first attempt  to implement the RDFParserBuilder with Jena seems to work:

https://github.com/stain/incubator-commonsrdf/blob/jena/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFParserBuilder.java
https://github.com/stain/incubator-commonsrdf/blob/jena/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
https://github.com/stain/incubator-commonsrdf/blob/jena/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java#L33

(I only tested that one variation in the end.. :)

Based on Andy's https://github.com/afs/commonsrdf-jena
but added as a 'commons-rdf-jena' integration module.

If we were to add this to Commons RDF, I wonder if we would need an IP
Clearance from Andy, as it's lived a while on GitHub alone - however
it already have "Licensed to the Apache Software Foundation" headers.



On 27 March 2016 at 20:27, Stian Soiland-Reyes <st...@apache.org> wrote:
> .. RDFParserBuilder JavaDoc:
>
> https://cdn.rawgit.com/stain/b588d39742ff7ccb3568/raw/8d92f3cbb06500eadf9be2d08b50512f337c2f06/-.html
>
> On 27 March 2016 at 20:20, Stian Soiland-Reyes <st...@apache.org> wrote:
>> Happy Easter!
>>
>> Time for some RDF hacking..
>>
>>
>> I started a draft interface for preparing and running an RDF parser:
>>
>>
>> https://github.com/apache/incubator-commonsrdf/blob/parser-writer-interface/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java
>>
>> This builds on a previous idea I had at
>> https://github.com/stain/commonsrdf-parser-jena
>> and Andy's work at
>> https://github.com/afs/commonsrdf-jena
>>
>>
>> An equivalent interface for writers would be pretty much the same but
>> with .write().
>>
>>
>> The idea is that of a builder pattern - so you can set parameters like
>> base() and contentType() if you want to - and must call
>> one of the source() variants (or any third-party extensions like source(URL)).
>>
>> The parsing happens not until parse() -- which return a
>> Future<Graph> -- allowing asynchronous parsing.
>>
>> If you don't specify intoGraph() or rdfTermFactory() the
>> implementation is free to choose what kind of Graph it will return.
>>
>>
>> Then we can try out integrations with Jena, Sesame, JSONLD-Java etc.
>> that provide such builders.
>>
>> I've not thought too much about how you would discover those builders
>> or find the right one depending on the format you may want to parse -
>> would  through the RDFTermFactory.createParser() ?  (in which case
>> RDFTermFActory -> RDFFactory )
>>
>>
>> Thoughts?
>>
>>
>> --
>> Stian Soiland-Reyes
>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>> http://orcid.org/0000-0001-9842-9718
>
>
>
> --
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: RDFParserBuilder draft

Posted by Stian Soiland-Reyes <st...@apache.org>.
.. RDFParserBuilder JavaDoc:

https://cdn.rawgit.com/stain/b588d39742ff7ccb3568/raw/8d92f3cbb06500eadf9be2d08b50512f337c2f06/-.html

On 27 March 2016 at 20:20, Stian Soiland-Reyes <st...@apache.org> wrote:
> Happy Easter!
>
> Time for some RDF hacking..
>
>
> I started a draft interface for preparing and running an RDF parser:
>
>
> https://github.com/apache/incubator-commonsrdf/blob/parser-writer-interface/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java
>
> This builds on a previous idea I had at
> https://github.com/stain/commonsrdf-parser-jena
> and Andy's work at
> https://github.com/afs/commonsrdf-jena
>
>
> An equivalent interface for writers would be pretty much the same but
> with .write().
>
>
> The idea is that of a builder pattern - so you can set parameters like
> base() and contentType() if you want to - and must call
> one of the source() variants (or any third-party extensions like source(URL)).
>
> The parsing happens not until parse() -- which return a
> Future<Graph> -- allowing asynchronous parsing.
>
> If you don't specify intoGraph() or rdfTermFactory() the
> implementation is free to choose what kind of Graph it will return.
>
>
> Then we can try out integrations with Jena, Sesame, JSONLD-Java etc.
> that provide such builders.
>
> I've not thought too much about how you would discover those builders
> or find the right one depending on the format you may want to parse -
> would  through the RDFTermFactory.createParser() ?  (in which case
> RDFTermFActory -> RDFFactory )
>
>
> Thoughts?
>
>
> --
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718