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);


>
> 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

rdf-json is provided by
- rdf.rdfjson



> 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


> 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

Cheers,
Reto

Reply via email to