Hey Andy,
I'm trying to implementing it now, and wondering if the whole
transformation could be packed into one SPARQL Update query? I mean
both the matching and the graph creation and insertion.
I tried the following:
CREATE GRAPH IRI(fn:concat('http://host/graphs/', string(?date)));
INSERT {
GRAPH IRI(fn:concat('http://host/graphs/', string(?date)))
{
?post dct:created ?data
# more
}
}
WHERE {
?post dct:created ?data
# more
}
but I get a parse error where IRI() is:
Was expecting one of:
<IRIref> ...
<PNAME_NS> ...
<PNAME_LN> ...
at
com.hp.hpl.jena.sparql.lang.ParserARQUpdate._parse(ParserARQUpdate.java:58)
...
Or will I have to retrieve the match results first and then iterate
them to create named graphs?
Martynas
On Mon, Sep 26, 2011 at 5:25 PM, Andy Seaborne <[email protected]> wrote:
> On 26/09/11 15:16, Martynas Jusevicius wrote:
>>
>> Hey list,
>>
>> we have a dump from D2RQ currently in N-Triples format. However we
>> want to group the triples into named graphs, and since D2RQ doesn't
>> seem to support it, we probably need to do some post-processing.
>>
>> Does anyone have experience with such translation? My thought is to
>> define a match pattern that would group the necessary triples
>> together, and write them into named graphs with synthetic URI names
>> using SPARQL Update. This would probably mean URI generation inside
>> SPARQL query, but I think I've seen examples of this working in Jena?
>
> Yes - the URI(string) SPARQL function creates URIs from string expressions.
> It must be an absolute URI.
>
> URI("http://example/a") => <http://example/a>
>
> SPARQL Update could be used to place triples into named graphs.
>
> But do you need to do this? Can you use text processing to add graph URI to
> the end of the lines of the NT data?
>
> Andy
>
>>
>> Comments and tips and links welcome,
>>
>> Martynas
>> semantic-web.dk
>
>