Re: RDF Template

You could wrap  ValueFactoryImpl, or you could use a RDFHandler (wrapped
StatementCollector)?  handleStatement would be where you would replace any
template variables.

The template would be in a file or other source. You would need to parse
the file once for each instantiation.

The org.openrdf.repository.config.ConfigTemplate class does does
substitutions on almost-plain text (substitutions are ttl-quote escaped.
After substitution the code is code is passed to Rio and gathered using a
regular StatementCollector.

org.openrdf.console.Create::createRepository is an example of the code you
use to set up and instantiate a template.

Simon


On Tue, May 13, 2014 at 5:18 PM, Stéphane Campinas <
stephane.campinas@deri.org> wrote:

>  Hi Simon,
>
> In Sesame there is the ValueFactory interface for creating Literals, URI,
> ... .
> Are you suggesting to implement a custom ValueFactory that will take care
> of substituting the variables ? Although this is an interesting idea, I
> prefer to have the template in a file, so that it is easy to provide a new
> template without touching the code.
>
> Cheers,
>
>
> On 12/05/14 18:47, Simon Spero wrote:
>
> Why not finish the job in sesame?
>
> From your examples, the only permitted slots for variables in the
> templates are as local names in URIs, or as values of literals (assuming
> that that IRIs started off with prefixes).
>
> You could do could keep the template as a collection of statements, and
> generate a new collection of statements by constructing new statements by
> substituting for variables in appropriate constructors.
>
> As long as the template is parsed with literal datatype validation
> disabled this should be pretty simple to implement.
>
> Simon
>
>
> --
> Stephane Campinas
>
>

Received on Tuesday, 13 May 2014 22:13:17 UTC