W3C home > Mailing lists > Public > semantic-web@w3.org > May 2014

Re: RDF Template

From: Stéphane Campinas <stephane.campinas@deri.org>
Date: Sat, 10 May 2014 15:50:20 +0100
Message-ID: <536E3CAC.7010908@deri.org>
To: semantic-web@w3.org
I am using Java but thanks for the links.

The fact that some variables can be URIs or literals is managed in the 
application itself. The template engine would get the final value of the 
variable after all necessary checking/processing needed, e.g., escape 
the literal value if needed.

The reason for such a template is that the schema can change. The data 
that is described is still the same, but its representation can change.

On 10/05/14 14:56, Jean-Marc Vanel 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/$%7Bid%7D>
>     <http://acme.org/predicate1>
>     <http://acme.org/predicate1> ${something} .
>     <http://acme.org/${id}> <http://acme.org/$%7Bid%7D>
>     <http://acme.org/predicate2> <http://acme.org/predicate2>
>     <http://acme.org/${person}> <http://acme.org/$%7Bperson%7D> .
>     """
>
> ( 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 
> <mailto: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 <mailto: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/$%7Bid%7D>
>             <http://acme.org/predicate1> <http://acme.org/predicate1>
>             "${something}" .
>             <http://acme.org/${id}> <http://acme.org/$%7Bid%7D>
>             <http://acme.org/predicate2> <http://acme.org/predicate2>
>             <http://acme.org/${person}> <http://acme.org/$%7Bperson%7D> .
>
>
>         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/e1>
>             <http://acme.org/predicate1> <http://acme.org/predicate1>
>             "blabla" .
>             <http://acme.org/e1> <http://acme.org/e1>
>             <http://acme.org/predicate2> <http://acme.org/predicate2>
>             <http://acme.org/john> <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 <tel:%2B33%20%280%296%2089%2016%2029%2052>
>     Twitter: @jmvanel , @jmvanel_fr ; chat:
>     irc://irc.freenode.net#eulergui <http://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 <tel:%2B33%20%280%296%2089%2016%2029%2052>
>     Twitter: @jmvanel , @jmvanel_fr ; chat:
>     irc://irc.freenode.net#eulergui <http://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 <http://irc.freenode.net#eulergui>

-- 
Stephane Campinas
Received on Saturday, 10 May 2014 14:48:43 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 07:42:50 UTC