- From: Jean-Marc Vanel <jeanmarc.vanel@gmail.com>
- Date: Sat, 10 May 2014 18:43:38 +0200
- To: Stéphane Campinas <stephane.campinas@deri.org>
- Cc: semantic-web <semantic-web@w3.org>
- Message-ID: <CANwvFKCFEw=mrqmscaAfDGOW7==6x+7DAnbfb0YMfRJECng1vA@mail.gmail.com>
Stéphane, if I understand well, you read data from Sesame database, and need to write some Turtle from these data. In this case, I would do the whole job in SPARQL. Or , maybe, a raw extraction in SPARQL, like contructing <subject> ?P ?O1 . ?O1 ?P1 ?O2 . and final answer built with a rule engine like Euler [1] in N3 rule language. The advantage of a rule language is that you can split your business logic in several rules, contrary to SPARQL. [1] Euler rule engine http://eulersharp.sourceforge.net/ 2014-05-10 17:01 GMT+02:00 Stéphane Campinas <stephane.campinas@deri.org>: > Jean-Marc, see my answer to Martynas, I gave more details. Sorry for the > lack of details in my question. > > > On 10/05/14 15:24, Jean-Marc Vanel wrote: > > Martynas , > > I agree , > it's just that I tried to answer the original question. > > If Stéphane would tell us more about how the input data are , > we could give a better answer. > > > > > 2014-05-10 16:21 GMT+02:00 Martynas Jusevičius <martynas@graphity.org>: > >> Jean-Marc, >> >> I would warn against using string manipulation to construct RDF. There >> are so many things where it can go wrong -- URI escaping, literal >> escaping, Turtle (or other) syntax etc. -- because generic string >> routines have no knowledge of RDF concepts. >> >> A better idea (even if it results in longer/more complex code) is to >> use standard RDF libraries, both to construct RDF and to serialize it >> into desired syntax. They exist for most programming languages, e.g. >> Jena or Sesame for Java. And the same goes for other data models, such >> as XML. >> >> In case the input data is in XML form, using XSLT to transform it is a >> viable option. I do that a lot. >> >> >> Martynas >> graphityhq.com >> >> On Sat, May 10, 2014 at 3:56 PM, Jean-Marc Vanel >> <jeanmarc.vanel@gmail.com> wrote: >> > And some languages like Scala hava a bult-in template capabilty : >> > >> > val id = "e1" >> > val something = """"blabla"""" >> > val person = "john" >> > >> > val ttlString = s""" >> > >> > <http://acme.org/${id}> <http://acme.org/predicate1> ${something} . >> > <http://acme.org/${id}> <http://acme.org/predicate2> >> > <http://acme.org/${person}> . >> > """ >> > >> > ( for simple expressions like here the {} are facultative ) >> > >> > NOTE 1 : you have to manage yourself the fact that something represents >> a >> > literal , >> > and person and id are relative URI. >> > >> > NOTE 2 : the Banana RDF Scala library has a nice DSL for RDF : >> > https://github.com/w3c/banana-rdf >> > >> > >> > >> > 2014-05-10 15:13 GMT+02:00 Jean-Marc Vanel <jeanmarc.vanel@gmail.com>: >> > >> >> Bonjour Stéphane >> >> >> >> Depending on on your software environment, >> >> you can choose one of the so called "template engines" ; >> >> in Java there is freemarker and others : >> >> http://java-source.net/open-source/template-engines >> >> >> >> >> >> 2014-05-10 14:54 GMT+02:00 Stéphane Campinas < >> stephane.campinas@deri.org>: >> >> >> >>> Hi, >> >>> >> >>> Do you know of any tool that creates RDF statements based on some >> >>> template ? >> >>> >> >>> For example, let's imagine I have the following template: >> >>> >> >>> <http://acme.org/${id}> <http://acme.org/predicate1> "${something}" . >> >>> <http://acme.org/${id}> <http://acme.org/predicate2> >> >>> <http://acme.org/${person}> . >> >>> >> >>> >> >>> where ${...} are variables. Then, by providing values for these >> >>> variables, the following statements would be created: >> >>> >> >>> ${id} = e1 ${something} = blabla ${person} = john >> >>> >> >>> <http://acme.org/e1> <http://acme.org/predicate1> "blabla" . >> >>> <http://acme.org/e1> <http://acme.org/predicate2> < >> http://acme.org/john> >> >>> . >> >>> >> >>> Have you seen any such tool ? >> >>> >> >>> Thanks >> >>> >> >>> -- >> >>> Stephane Campinas >> >> >> >> >> >> >> >> >> >> -- >> >> Jean-Marc Vanel >> >> Déductions SARL - Consulting, services, training, >> >> Rule-based programming, Semantic Web >> >> http://deductions-software.com/ >> >> +33 (0)6 89 16 29 52 >> >> Twitter: @jmvanel , @jmvanel_fr ; chat: irc:// >> irc.freenode.net#eulergui >> >> >> >> >> >> >> >> -- >> >> Jean-Marc Vanel >> >> Déductions SARL - Consulting, services, training, >> >> Rule-based programming, Semantic Web >> >> http://deductions-software.com/ >> >> +33 (0)6 89 16 29 52 >> >> Twitter: @jmvanel , @jmvanel_fr ; chat: irc:// >> irc.freenode.net#eulergui >> > >> > >> > >> > >> > -- >> > Jean-Marc Vanel >> > Déductions SARL - Consulting, services, training, >> > Rule-based programming, Semantic Web >> > http://deductions-software.com/ >> > +33 (0)6 89 16 29 52 >> > Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui >> > > > > -- > Jean-Marc Vanel > Déductions SARL - Consulting, services, training, > Rule-based programming, Semantic Web > http://deductions-software.com/ > +33 (0)6 89 16 29 52 > Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui > > > -- > Stephane Campinas > > -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://deductions-software.com/ +33 (0)6 89 16 29 52 Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
Received on Saturday, 10 May 2014 16:44:06 UTC