You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Luigi Selmi <lu...@gmail.com> on 2012/11/12 19:40:40 UTC

parser binding

Hello
I am using Clerezza API to manage FOAF profiles. I need to parse foaf
RDF/XML files and so I need the parser provided by the Clerezza platform
but don't know how to bind a parsing provider. I would like to test the
parser before creating the bundle to upload and activate on Felix. Is that
possible ?

Thanks

Luigi

Re: parser binding

Posted by Luigi Selmi <lu...@gmail.com>.
Hi Daniel,
the Jena parser works fine with the SimpleMGraph. I am working inside
eclipse and maybe this is why I had the problem with the Parser. I do not
have a META-INF/services file inside the project only the followings

target/maven-shared-archive-resources/META-INF/

DEPENDENCIE

LICENSE

NOTICE

Maybe I have to use some maven command.

Regards

Luigi


2012/11/13 Daniel Spicar <ds...@apache.org>

> Hi Luigi,
>
> Parser.getinstance() should work even outside the OSGi container. We use it
> tests as well. However you have to have the jena parser implementation in
> the Classpath. The getInstance Method should then read the parser
> implementations from META-INF/services in the classpath. Remember, that the
> Parser class is provided by rdf.core but the Jena parser implementation is
> provided by rdf.jena.parser. So you need both of these in your test
> classpath or whatever classpath you are using.
>
> For the other question. You can use
> org.apache.clerezza.rdf.core.impl.SimpleMGraph. But remember this is an
> in-memory graph. Mostly this is fine but when you pare huge amounts of data
> you could run out of memory.
>
> Daniel
>
>
> On 13 November 2012 16:11, Luigi Selmi <lu...@gmail.com> wrote:
>
> > Hello Daniel,
> > thank you for the response. The solution that uses an instance of a
> parser
> > doesn't work I think for the reason that I have written, there is no
> > instance available outside the OSGi service platform (Fuseki). The code
> > that I use is
> >
> > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> > InputStream is = subjectUrl.openStream();
> > Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);
> >
> > returns an UnsupportedFormatException
> >
> > For the solution with the Jena parser I need a MGraph implemetation since
> > the parse method of the Jena parser requires the graph as an attribute.
> >
> > org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
> > org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> > InputStream is = subjectUrl.openStream();
> > MGraph subjectGraph = <???>
> > parser.parse(<???>, is, SupportedFormat.RDF_XML, null);
> >
> > Can you tell me what kind of implementation of the MGraph can I use to
> pass
> > to the parse method of the JenaParserProvider ?
> >
> > Best
> >
> > Luigi
> >
> >
> >
> > 2012/11/13 Daniel Spicar <ds...@apache.org>
> >
> > > To parse serialized RDF formats in tests or without the OSGi
> environment
> > > you can use this:
> > >
> > > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> > >   Graph graph = parser.parse(
> > >   inputStream, formatString);
> > >
> > > formatString can be any of the supported formats, e.g.
> > > "application/rdf+xml" or "text/rdf+nt"
> > >
> > > The required dependencies are:
> > >
> > > For the Parser class
> > > <dependency>
> > >     <groupId>org.apache.clerezza</groupId>
> > >     <artifactId>rdf.core</artifactId>
> > > </dependency>
> > >
> > > For the parsing providers:
> > > <dependency>
> > >     <groupId>org.apache.clerezza</groupId>
> > >     <artifactId>rdf.jena.parser</artifactId>
> > > </dependency>
> > >
> > > You can also use the jena parser directly by instanciating it:
> > > new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> > >
> > >
> > > To bind a parser in the OSGi environment you can use this:
> > >
> > > @org.apache.felix.scr.annotations.Reference
> > > private org.apache.clerezza.rdf.core.serializedform.Parser parser;
> > >
> > >
> > > Note: Supported formats (by the jena parser) are:
> > > "application/rdf+xml";
> > >  "text/turtle";
> > >  "application/x-turtle";
> > >  "text/rdf+nt";
> > >  "text/rdf+n3";
> > >  "application/rdf+json";
> > >
> > > Hope this helps.
> > >
> > > Daniel
> > >
> > > On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
> > >
> > > > Hello
> > > > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > > > RDF/XML files and so I need the parser provided by the Clerezza
> > platform
> > > > but don't know how to bind a parsing provider. I would like to test
> the
> > > > parser before creating the bundle to upload and activate on Felix. Is
> > > that
> > > > possible ?
> > > >
> > > > Thanks
> > > >
> > > > Luigi
> > > >
> > >
> >
>

Re: parser binding

Posted by Luigi Selmi <lu...@gmail.com>.
Hi Daniel,
the Jena parser works fine with the SimpleMGraph. I am working inside
eclipse and maybe this is why I had the problem with the Parser. I do not
have a META-INF/services file inside the project only the followings

target/maven-shared-archive-resources/META-INF/

DEPENDENCIE

LICENSE

NOTICE

Maybe I have to use some maven command.

Regards

Luigi


2012/11/13 Daniel Spicar <ds...@apache.org>

> Hi Luigi,
>
> Parser.getinstance() should work even outside the OSGi container. We use it
> tests as well. However you have to have the jena parser implementation in
> the Classpath. The getInstance Method should then read the parser
> implementations from META-INF/services in the classpath. Remember, that the
> Parser class is provided by rdf.core but the Jena parser implementation is
> provided by rdf.jena.parser. So you need both of these in your test
> classpath or whatever classpath you are using.
>
> For the other question. You can use
> org.apache.clerezza.rdf.core.impl.SimpleMGraph. But remember this is an
> in-memory graph. Mostly this is fine but when you pare huge amounts of data
> you could run out of memory.
>
> Daniel
>
>
> On 13 November 2012 16:11, Luigi Selmi <lu...@gmail.com> wrote:
>
> > Hello Daniel,
> > thank you for the response. The solution that uses an instance of a
> parser
> > doesn't work I think for the reason that I have written, there is no
> > instance available outside the OSGi service platform (Fuseki). The code
> > that I use is
> >
> > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> > InputStream is = subjectUrl.openStream();
> > Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);
> >
> > returns an UnsupportedFormatException
> >
> > For the solution with the Jena parser I need a MGraph implemetation since
> > the parse method of the Jena parser requires the graph as an attribute.
> >
> > org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
> > org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> > InputStream is = subjectUrl.openStream();
> > MGraph subjectGraph = <???>
> > parser.parse(<???>, is, SupportedFormat.RDF_XML, null);
> >
> > Can you tell me what kind of implementation of the MGraph can I use to
> pass
> > to the parse method of the JenaParserProvider ?
> >
> > Best
> >
> > Luigi
> >
> >
> >
> > 2012/11/13 Daniel Spicar <ds...@apache.org>
> >
> > > To parse serialized RDF formats in tests or without the OSGi
> environment
> > > you can use this:
> > >
> > > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> > >   Graph graph = parser.parse(
> > >   inputStream, formatString);
> > >
> > > formatString can be any of the supported formats, e.g.
> > > "application/rdf+xml" or "text/rdf+nt"
> > >
> > > The required dependencies are:
> > >
> > > For the Parser class
> > > <dependency>
> > >     <groupId>org.apache.clerezza</groupId>
> > >     <artifactId>rdf.core</artifactId>
> > > </dependency>
> > >
> > > For the parsing providers:
> > > <dependency>
> > >     <groupId>org.apache.clerezza</groupId>
> > >     <artifactId>rdf.jena.parser</artifactId>
> > > </dependency>
> > >
> > > You can also use the jena parser directly by instanciating it:
> > > new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> > >
> > >
> > > To bind a parser in the OSGi environment you can use this:
> > >
> > > @org.apache.felix.scr.annotations.Reference
> > > private org.apache.clerezza.rdf.core.serializedform.Parser parser;
> > >
> > >
> > > Note: Supported formats (by the jena parser) are:
> > > "application/rdf+xml";
> > >  "text/turtle";
> > >  "application/x-turtle";
> > >  "text/rdf+nt";
> > >  "text/rdf+n3";
> > >  "application/rdf+json";
> > >
> > > Hope this helps.
> > >
> > > Daniel
> > >
> > > On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
> > >
> > > > Hello
> > > > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > > > RDF/XML files and so I need the parser provided by the Clerezza
> > platform
> > > > but don't know how to bind a parsing provider. I would like to test
> the
> > > > parser before creating the bundle to upload and activate on Felix. Is
> > > that
> > > > possible ?
> > > >
> > > > Thanks
> > > >
> > > > Luigi
> > > >
> > >
> >
>

Re: parser binding

Posted by Daniel Spicar <ds...@apache.org>.
Hi Luigi,

Parser.getinstance() should work even outside the OSGi container. We use it
tests as well. However you have to have the jena parser implementation in
the Classpath. The getInstance Method should then read the parser
implementations from META-INF/services in the classpath. Remember, that the
Parser class is provided by rdf.core but the Jena parser implementation is
provided by rdf.jena.parser. So you need both of these in your test
classpath or whatever classpath you are using.

For the other question. You can use
org.apache.clerezza.rdf.core.impl.SimpleMGraph. But remember this is an
in-memory graph. Mostly this is fine but when you pare huge amounts of data
you could run out of memory.

Daniel


On 13 November 2012 16:11, Luigi Selmi <lu...@gmail.com> wrote:

> Hello Daniel,
> thank you for the response. The solution that uses an instance of a parser
> doesn't work I think for the reason that I have written, there is no
> instance available outside the OSGi service platform (Fuseki). The code
> that I use is
>
> org.apache.clerezza.rdf.core.serializedform.Parser parser =
> org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> InputStream is = subjectUrl.openStream();
> Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);
>
> returns an UnsupportedFormatException
>
> For the solution with the Jena parser I need a MGraph implemetation since
> the parse method of the Jena parser requires the graph as an attribute.
>
> org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
> org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> InputStream is = subjectUrl.openStream();
> MGraph subjectGraph = <???>
> parser.parse(<???>, is, SupportedFormat.RDF_XML, null);
>
> Can you tell me what kind of implementation of the MGraph can I use to pass
> to the parse method of the JenaParserProvider ?
>
> Best
>
> Luigi
>
>
>
> 2012/11/13 Daniel Spicar <ds...@apache.org>
>
> > To parse serialized RDF formats in tests or without the OSGi environment
> > you can use this:
> >
> > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> >   Graph graph = parser.parse(
> >   inputStream, formatString);
> >
> > formatString can be any of the supported formats, e.g.
> > "application/rdf+xml" or "text/rdf+nt"
> >
> > The required dependencies are:
> >
> > For the Parser class
> > <dependency>
> >     <groupId>org.apache.clerezza</groupId>
> >     <artifactId>rdf.core</artifactId>
> > </dependency>
> >
> > For the parsing providers:
> > <dependency>
> >     <groupId>org.apache.clerezza</groupId>
> >     <artifactId>rdf.jena.parser</artifactId>
> > </dependency>
> >
> > You can also use the jena parser directly by instanciating it:
> > new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> >
> >
> > To bind a parser in the OSGi environment you can use this:
> >
> > @org.apache.felix.scr.annotations.Reference
> > private org.apache.clerezza.rdf.core.serializedform.Parser parser;
> >
> >
> > Note: Supported formats (by the jena parser) are:
> > "application/rdf+xml";
> >  "text/turtle";
> >  "application/x-turtle";
> >  "text/rdf+nt";
> >  "text/rdf+n3";
> >  "application/rdf+json";
> >
> > Hope this helps.
> >
> > Daniel
> >
> > On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
> >
> > > Hello
> > > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > > RDF/XML files and so I need the parser provided by the Clerezza
> platform
> > > but don't know how to bind a parsing provider. I would like to test the
> > > parser before creating the bundle to upload and activate on Felix. Is
> > that
> > > possible ?
> > >
> > > Thanks
> > >
> > > Luigi
> > >
> >
>

Re: parser binding

Posted by Daniel Spicar <ds...@apache.org>.
Hi Luigi,

Parser.getinstance() should work even outside the OSGi container. We use it
tests as well. However you have to have the jena parser implementation in
the Classpath. The getInstance Method should then read the parser
implementations from META-INF/services in the classpath. Remember, that the
Parser class is provided by rdf.core but the Jena parser implementation is
provided by rdf.jena.parser. So you need both of these in your test
classpath or whatever classpath you are using.

For the other question. You can use
org.apache.clerezza.rdf.core.impl.SimpleMGraph. But remember this is an
in-memory graph. Mostly this is fine but when you pare huge amounts of data
you could run out of memory.

Daniel


On 13 November 2012 16:11, Luigi Selmi <lu...@gmail.com> wrote:

> Hello Daniel,
> thank you for the response. The solution that uses an instance of a parser
> doesn't work I think for the reason that I have written, there is no
> instance available outside the OSGi service platform (Fuseki). The code
> that I use is
>
> org.apache.clerezza.rdf.core.serializedform.Parser parser =
> org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> InputStream is = subjectUrl.openStream();
> Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);
>
> returns an UnsupportedFormatException
>
> For the solution with the Jena parser I need a MGraph implemetation since
> the parse method of the Jena parser requires the graph as an attribute.
>
> org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
> org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> InputStream is = subjectUrl.openStream();
> MGraph subjectGraph = <???>
> parser.parse(<???>, is, SupportedFormat.RDF_XML, null);
>
> Can you tell me what kind of implementation of the MGraph can I use to pass
> to the parse method of the JenaParserProvider ?
>
> Best
>
> Luigi
>
>
>
> 2012/11/13 Daniel Spicar <ds...@apache.org>
>
> > To parse serialized RDF formats in tests or without the OSGi environment
> > you can use this:
> >
> > org.apache.clerezza.rdf.core.serializedform.Parser parser =
> > org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
> >   Graph graph = parser.parse(
> >   inputStream, formatString);
> >
> > formatString can be any of the supported formats, e.g.
> > "application/rdf+xml" or "text/rdf+nt"
> >
> > The required dependencies are:
> >
> > For the Parser class
> > <dependency>
> >     <groupId>org.apache.clerezza</groupId>
> >     <artifactId>rdf.core</artifactId>
> > </dependency>
> >
> > For the parsing providers:
> > <dependency>
> >     <groupId>org.apache.clerezza</groupId>
> >     <artifactId>rdf.jena.parser</artifactId>
> > </dependency>
> >
> > You can also use the jena parser directly by instanciating it:
> > new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
> >
> >
> > To bind a parser in the OSGi environment you can use this:
> >
> > @org.apache.felix.scr.annotations.Reference
> > private org.apache.clerezza.rdf.core.serializedform.Parser parser;
> >
> >
> > Note: Supported formats (by the jena parser) are:
> > "application/rdf+xml";
> >  "text/turtle";
> >  "application/x-turtle";
> >  "text/rdf+nt";
> >  "text/rdf+n3";
> >  "application/rdf+json";
> >
> > Hope this helps.
> >
> > Daniel
> >
> > On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
> >
> > > Hello
> > > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > > RDF/XML files and so I need the parser provided by the Clerezza
> platform
> > > but don't know how to bind a parsing provider. I would like to test the
> > > parser before creating the bundle to upload and activate on Felix. Is
> > that
> > > possible ?
> > >
> > > Thanks
> > >
> > > Luigi
> > >
> >
>

Re: parser binding

Posted by Luigi Selmi <lu...@gmail.com>.
Hello Daniel,
thank you for the response. The solution that uses an instance of a parser
doesn't work I think for the reason that I have written, there is no
instance available outside the OSGi service platform (Fuseki). The code
that I use is

org.apache.clerezza.rdf.core.serializedform.Parser parser =
org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
InputStream is = subjectUrl.openStream();
Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);

returns an UnsupportedFormatException

For the solution with the Jena parser I need a MGraph implemetation since
the parse method of the Jena parser requires the graph as an attribute.

org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
InputStream is = subjectUrl.openStream();
MGraph subjectGraph = <???>
parser.parse(<???>, is, SupportedFormat.RDF_XML, null);

Can you tell me what kind of implementation of the MGraph can I use to pass
to the parse method of the JenaParserProvider ?

Best

Luigi



2012/11/13 Daniel Spicar <ds...@apache.org>

> To parse serialized RDF formats in tests or without the OSGi environment
> you can use this:
>
> org.apache.clerezza.rdf.core.serializedform.Parser parser =
> org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
>   Graph graph = parser.parse(
>   inputStream, formatString);
>
> formatString can be any of the supported formats, e.g.
> "application/rdf+xml" or "text/rdf+nt"
>
> The required dependencies are:
>
> For the Parser class
> <dependency>
>     <groupId>org.apache.clerezza</groupId>
>     <artifactId>rdf.core</artifactId>
> </dependency>
>
> For the parsing providers:
> <dependency>
>     <groupId>org.apache.clerezza</groupId>
>     <artifactId>rdf.jena.parser</artifactId>
> </dependency>
>
> You can also use the jena parser directly by instanciating it:
> new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
>
>
> To bind a parser in the OSGi environment you can use this:
>
> @org.apache.felix.scr.annotations.Reference
> private org.apache.clerezza.rdf.core.serializedform.Parser parser;
>
>
> Note: Supported formats (by the jena parser) are:
> "application/rdf+xml";
>  "text/turtle";
>  "application/x-turtle";
>  "text/rdf+nt";
>  "text/rdf+n3";
>  "application/rdf+json";
>
> Hope this helps.
>
> Daniel
>
> On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
>
> > Hello
> > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > RDF/XML files and so I need the parser provided by the Clerezza platform
> > but don't know how to bind a parsing provider. I would like to test the
> > parser before creating the bundle to upload and activate on Felix. Is
> that
> > possible ?
> >
> > Thanks
> >
> > Luigi
> >
>

Re: parser binding

Posted by Luigi Selmi <lu...@gmail.com>.
Hello Daniel,
thank you for the response. The solution that uses an instance of a parser
doesn't work I think for the reason that I have written, there is no
instance available outside the OSGi service platform (Fuseki). The code
that I use is

org.apache.clerezza.rdf.core.serializedform.Parser parser =
org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
InputStream is = subjectUrl.openStream();
Graph subjectGraph = parser.parse(is, SupportedFormat.RDF_XML);

returns an UnsupportedFormatException

For the solution with the Jena parser I need a MGraph implemetation since
the parse method of the Jena parser requires the graph as an attribute.

org.apache.clerezza.rdf.jena.parser.JenaParserProvider parser = new
org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
InputStream is = subjectUrl.openStream();
MGraph subjectGraph = <???>
parser.parse(<???>, is, SupportedFormat.RDF_XML, null);

Can you tell me what kind of implementation of the MGraph can I use to pass
to the parse method of the JenaParserProvider ?

Best

Luigi



2012/11/13 Daniel Spicar <ds...@apache.org>

> To parse serialized RDF formats in tests or without the OSGi environment
> you can use this:
>
> org.apache.clerezza.rdf.core.serializedform.Parser parser =
> org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
>   Graph graph = parser.parse(
>   inputStream, formatString);
>
> formatString can be any of the supported formats, e.g.
> "application/rdf+xml" or "text/rdf+nt"
>
> The required dependencies are:
>
> For the Parser class
> <dependency>
>     <groupId>org.apache.clerezza</groupId>
>     <artifactId>rdf.core</artifactId>
> </dependency>
>
> For the parsing providers:
> <dependency>
>     <groupId>org.apache.clerezza</groupId>
>     <artifactId>rdf.jena.parser</artifactId>
> </dependency>
>
> You can also use the jena parser directly by instanciating it:
> new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();
>
>
> To bind a parser in the OSGi environment you can use this:
>
> @org.apache.felix.scr.annotations.Reference
> private org.apache.clerezza.rdf.core.serializedform.Parser parser;
>
>
> Note: Supported formats (by the jena parser) are:
> "application/rdf+xml";
>  "text/turtle";
>  "application/x-turtle";
>  "text/rdf+nt";
>  "text/rdf+n3";
>  "application/rdf+json";
>
> Hope this helps.
>
> Daniel
>
> On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:
>
> > Hello
> > I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> > RDF/XML files and so I need the parser provided by the Clerezza platform
> > but don't know how to bind a parsing provider. I would like to test the
> > parser before creating the bundle to upload and activate on Felix. Is
> that
> > possible ?
> >
> > Thanks
> >
> > Luigi
> >
>

Re: parser binding

Posted by Daniel Spicar <ds...@apache.org>.
To parse serialized RDF formats in tests or without the OSGi environment
you can use this:

org.apache.clerezza.rdf.core.serializedform.Parser parser =
org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
  Graph graph = parser.parse(
  inputStream, formatString);

formatString can be any of the supported formats, e.g.
"application/rdf+xml" or "text/rdf+nt"

The required dependencies are:

For the Parser class
<dependency>
    <groupId>org.apache.clerezza</groupId>
    <artifactId>rdf.core</artifactId>
</dependency>

For the parsing providers:
<dependency>
    <groupId>org.apache.clerezza</groupId>
    <artifactId>rdf.jena.parser</artifactId>
</dependency>

You can also use the jena parser directly by instanciating it:
new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();


To bind a parser in the OSGi environment you can use this:

@org.apache.felix.scr.annotations.Reference
private org.apache.clerezza.rdf.core.serializedform.Parser parser;


Note: Supported formats (by the jena parser) are:
"application/rdf+xml";
 "text/turtle";
 "application/x-turtle";
 "text/rdf+nt";
 "text/rdf+n3";
 "application/rdf+json";

Hope this helps.

Daniel

On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:

> Hello
> I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> RDF/XML files and so I need the parser provided by the Clerezza platform
> but don't know how to bind a parsing provider. I would like to test the
> parser before creating the bundle to upload and activate on Felix. Is that
> possible ?
>
> Thanks
>
> Luigi
>

Re: parser binding

Posted by Daniel Spicar <ds...@apache.org>.
To parse serialized RDF formats in tests or without the OSGi environment
you can use this:

org.apache.clerezza.rdf.core.serializedform.Parser parser =
org.apache.clerezza.rdf.core.serializedform.Parser.getInstance();
  Graph graph = parser.parse(
  inputStream, formatString);

formatString can be any of the supported formats, e.g.
"application/rdf+xml" or "text/rdf+nt"

The required dependencies are:

For the Parser class
<dependency>
    <groupId>org.apache.clerezza</groupId>
    <artifactId>rdf.core</artifactId>
</dependency>

For the parsing providers:
<dependency>
    <groupId>org.apache.clerezza</groupId>
    <artifactId>rdf.jena.parser</artifactId>
</dependency>

You can also use the jena parser directly by instanciating it:
new org.apache.clerezza.rdf.jena.parser.JenaParserProvider();


To bind a parser in the OSGi environment you can use this:

@org.apache.felix.scr.annotations.Reference
private org.apache.clerezza.rdf.core.serializedform.Parser parser;


Note: Supported formats (by the jena parser) are:
"application/rdf+xml";
 "text/turtle";
 "application/x-turtle";
 "text/rdf+nt";
 "text/rdf+n3";
 "application/rdf+json";

Hope this helps.

Daniel

On 12 November 2012 19:40, Luigi Selmi <lu...@gmail.com> wrote:

> Hello
> I am using Clerezza API to manage FOAF profiles. I need to parse foaf
> RDF/XML files and so I need the parser provided by the Clerezza platform
> but don't know how to bind a parsing provider. I would like to test the
> parser before creating the bundle to upload and activate on Felix. Is that
> possible ?
>
> Thanks
>
> Luigi
>