Many thanks. I have been trying this but seem to miss some trick:

From my CONSTRUCT query:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX www: <http://xyz.com#>

CONSTRUCT { 
  ?s a owl:NamedIndividual, skos:Concept ;
    ?p ?o .
}
WHERE 
{ 
  ?s a owl:NamedIndividual, skos:Concept ;
     ?p ?o .
}

I get results of the following type (summarised because of file size).
www:Some_Identifier
        a                skos:Concept , owl:NamedIndividual ;
        ?p ?o .

I need to replace 'Some_Identifier' with a UUID generated by the STRUUID() 
function. For this purpose I append the bind statement in a new CONSTRUCT query 
as follow:

CONSTRUCT { 
  ?olds a owl:NamedIndividual, skos:Concept ;
    ?p ?o .
}
WHERE 
{ 
  ?olds a owl:NamedIndividual, skos:Concept ;
     ?p ?o .
  BIND(CONCAT(CONCAT(STRBEFORE(?olds, "#"), "#"), STRUUID()) AS ?snew) .
}


But this does not change anything. It looks as if I expect the variable ?olds 
as a string whereas it is not. How can then I use the BIND() function correctly 
to obtain this? 

One way may be to use STR(www:) and concatenate it with STRUUID(), but how to 
place this in the sub-graph?

Any idea, I'll appreciate.

Regards
Mahmood

-----Original Message-----
From: Martynas Jusevičius [mailto:[email protected]] 
Sent: 03 November 2016 12:36
To: [email protected]
Subject: Re: Adding UUIDs to SPARQL query results

Use BIND() with UUID() or STRUUID().

https://www.w3.org/TR/2012/WD-sparql11-query-20120724/#func-uuid
https://www.w3.org/TR/2012/WD-sparql11-query-20120724/#func-struuid

On Thu, Nov 3, 2016 at 1:34 PM, Mahmood Ahmad <[email protected]> 
wrote:
> Hi,
>
> [Advanced apologies if this question is out of scope of this list, and 
> advise me the correct forum.]
>
> I am currently using Apache Jena Fuseki 2.4.0 (Windows 10) to upload my 
> project RDF triples into a big soup.
>
> Using the SPARQL CONSTRUCT queries, I am able to query sub-graphs from the 
> big soup and the result is in Turtle format. However, I am looking to add a 
> UUID to every result of my query.
>
> Is it possible to get this done within my CONSTRUCT query, and how? If not, 
> please can you suggest some alternative approaches?
>
> Thanks and regards
> Mahmood
>
> ====================
> Dr Mahmood Ahmad
> KTP Associate
>
> School of Computer Science
> University of Manchester
> and
> Telematicus
> Newport Street
> Macclesfield
> SK11 6QJ
> United Kingdom
>
> E: [email protected]<mailto:[email protected]>
> E: 
> [email protected]<mailto:[email protected]>
>
>

Reply via email to