incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Castagna <castagna.li...@googlemail.com>
Subject Re: HelloWorld with Clerezza?
Date Tue, 08 Nov 2011 15:47:48 GMT
Hi Reto,
thank you very much for you quick and straight to the point reply.
I have not had time to try the example out, but I'll come back here if
I have problems when I do it.

Just a couple of comments/questions inline.

On 6 November 2011 10:38, Reto Bachmann-Gmür <reto@apache.org> wrote:
> Hi Paolo,
>
> Thanks for your interest in clerezza.
>
>
>> I had just a quick look at the documentation on the website, but I'd like
>> to learn how I could use the Clerezza "graph" APIs directly.
>>
>> Here is an example of how to parse an RDF Turtle file and write it out as
>> N-Triples using the Jena Model APIs:
>>
>> ----
>> InputStream in = ...;
>> Model model = ModelFactory.createDefaultModel();
>> Model model.read(in, null, "TURTLE");
>> model.write(System.out, "N-TRIPLES");
>> ----
>>
>> Could you help me and guide me in writing a similar example using Clerezza?
>>
>
> The above translates to:
>
> InputStream in = ...;
> Parser parser = Parser.getInstance(); //in OSGi should get this from the
> service registry instead
> Graph g = parser.parse(in, SupportedFormat.TURTLE);
> Serializer serializer = Serializer.getInstance(); //in OSGi should get this
> from the service registry instead
> serializer.serialize(System.out, g, SupportedFormat.N_TRIPLE);

This is exactly what I was searching for, thanks.

>
>
>>
>> I think the org.apache.clerezza.rdf.core module only isn't enough, but I
>> am not
>> sure which module should I look at.
>
> Actually at compile time for the above rdf core is enough but at runtime
> you need providers for serializing and parsing the requested formats. You
> can use the following bundles/jars (in OSGi loaded as bundles otherwise in
> your classpath):
> - rdf.jena.serializer
> - rdf.jena.parser

Great, all clear. Thanks.

> rdf-json is provided by
> - rdf.rdfjson

Is this for parsing and serialising RDF/JSON?
Which RDF/JSON?

I'll have a look at it, we now have support for RDF/JSON in Jena (but
it has been added only recently therefore not many have been
using/testing it). It's this [1] RDF/JSON. While the W3C agrees on
what RDF/JSON should be. :-)

 [1] http://docs.api.talis.com/platform-api/output-types/rdf-json

>
>> The list of Clerezza modules is "extensive" [1]. Is there a map? :-)
>>
> no, but the locals very much like to give directions :-)
>
> for instance for rdf, rdf.core is a good place to start, but from there I
> recommend walking uphill to rdf.utils which offers a resource centric view
> of rdf data. From rdf.utils why not do a stroll over to rdf.scala.utils
> which allow very compact syntax to browse rdf data in scala. To get you
> started with scala cerezza can create a skeleton app for you. Just enter
> the following on the clerezza console:
>
> zz>Dev create 'scala_with_activator in "/path/to/myproject"
>
> You'll have a hello-world at http://localhost:8080/hello-world and you can
> modify its behaviour just by editing
> /path/to/myproject/src/main/scala/HelloWorld.scala

Good. Thanks.

>> Java code and a small example would do.
>>
> The above generated hello-world is in scala, for an example using java see:
> http://svn.apache.org/viewvc/incubator/clerezza/trunk/maven-archetypes/java-ssp-ttl/
>
>
>>
>>  [1] https://repository.apache.org/**content/repositories/**
>> snapshots/org/apache/clerezza/<https://repository.apache.org/content/repositories/snapshots/org/apache/clerezza/>
>>
>
> You have the bundle twice there, as it als contains the old artifact names
> starting with org.apache.clerezza

Oh... good to know. I think I was using the old ones (i.e.
org.apache.clerezza) (by mistake).

Paolo

>
> Cheers,
> Reto
>

Mime
View raw message