Hi Holger, thank you for the explanation.
I'll try to create sth on my own and surely I will come back to you with some additional questions :) Br, Kasia On Friday, June 30, 2023 at 5:25:58 PM UTC+2 Holger Knublauch wrote: > Ok thanks, I now understand the question better. > > The problem of generating rdf:Lists with SPARQL has been observed by other > users too and is an inherent limitation of SPARQL. It cannot be done in > general, although you could write INSERTs for certain list lengths, e.g. > produce all BNODE() for each list item up to length of three and then link > them together. But even that would be a terrible syntax. One problem is > SPARQL’s lack or recursion. > > To generate RDF lists or similarly complex structures, you would need to > use a scripting language. TopBraid EDG includes JavaScript support from its > Script Editor panel, see > > Active Data Shapes <https://datashapes.org/active/> > datashapes.org <https://datashapes.org/active/> > <https://datashapes.org/active/> <https://datashapes.org/active/> > > where you can produce even the most complex structures and use JavaScript > to orchestrate arbitrary SPARQL queries too. > > If that’s an option for you, feel free to ask follow-up questions. > > Holger > > > On 30 Jun 2023, at 3:18 pm, Kasia Kryczka <[email protected]> wrote: > > Hi Holger, > > Thank you. > > Just to clarify so I fully understand because now I don't have a sh:in > list but I want to create one from the imports that are included in the > cGraph: > > SELECT ?product > # (GROUP_CONCAT(?product; SEPARATOR=', ') AS ?result) > { > BIND(teamwork:currentMasterGraph() as ?cGraph) > GRAPH ?cGraph > {?cGraph owl:imports ?import} > GRAPH ?import{ > ?d a skos:Concept. > ?d skos:hasTopConcept ?Concept. > ?ProductT skos:broader ?Concept. > ?ProductT uri:product ?product . > } > FILTER(CONTAINS(STR(?Concept),"service")) > > ## BIND (ui:label(?product) AS ?label) . > > }GROUP BY ?product } > > > but I don't know how to insert that. > > Thanks, > > Kasia > > > On Thursday, June 29, 2023 at 4:36:41 PM UTC+2 Holger Knublauch wrote: > >> The value of sh:in is an rdf:List. Lists consist of intermediate notes >> that are linked into a chain using rdf:first and rdf:rest. The usual trick >> to walk such chains is to use a SPARQL path expression. The following may >> work for you:L >> >> SELECT ?item >> WHERE { >> <uri> sh:in ?list . >> ?list rdf:rest*/rdf:first ?item . >> } >> >> where rdf:rest* is walking through all list elements and rdf:first >> fetches the actual value of each element. >> >> HTH >> Holger >> >> >> On 29 Jun 2023, at 2:22 pm, Kasia Kryczka <[email protected]> wrote: >> >> Hi everyone, >> I want insert a list of types to sh:in which would be : >> >> <uri> >> sh:in *(* >> * "aaa"* >> * "bbb"* >> * "ccc"* >> * ) ;* >> >> my query doesn't work : >> INSERT{ >> <URI> sh:in ?product >> } >> >> WHERE { >> SELECT ?product >> # (GROUP_CONCAT(?product; SEPARATOR=', ') AS ?result) >> { >> >> BIND(teamwork:currentMasterGraph() as ?cGraph) >> >> GRAPH ?cGraph >> {?cGraph owl:imports ?import} >> >> GRAPH ?import{ >> ?d a skos:Concept. >> ?d skos:hasTopConcept ?Concept. >> ?ProductT skos:broader ?Concept. >> ?ProductT uri:product ?product . >> } >> FILTER(CONTAINS(STR(?Concept),"service")) >> >> ## BIND (ui:label(?product) AS ?label) . >> >> }GROUP BY ?product } >> >> the result with concat_group is <uri> >> sh:in *(* >> * "aaa,**bbb, **ccc"* >> * ) ;* >> >> and this is not what I need. >> >> Could you give me a hint how to resolve this? >> >> Thanks, >> >> Kasia >> >> >> -- >> The topics of this mailing list include TopBraid EDG and related >> technologies such as SHACL. >> To post to this group, send email to [email protected] >> --- >> You received this message because you are subscribed to the Google Groups >> "TopBraid Suite Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/topbraid-users/ead4c18d-f520-47f3-8664-022c51c6c286n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/topbraid-users/ead4c18d-f520-47f3-8664-022c51c6c286n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> > -- > The topics of this mailing list include TopBraid EDG and related > technologies such as SHACL. > To post to this group, send email to [email protected] > --- > You received this message because you are subscribed to the Google Groups > "TopBraid Suite Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/topbraid-users/06dfe3ce-690c-4568-8738-46fe15f3435bn%40googlegroups.com > > <https://groups.google.com/d/msgid/topbraid-users/06dfe3ce-690c-4568-8738-46fe15f3435bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- The topics of this mailing list include TopBraid EDG and related technologies such as SHACL. To post to this group, send email to [email protected] --- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/44befcac-0124-4bf1-872c-23feeb898d67n%40googlegroups.com.
