SPARQL functions in CONSTRUCT/WHERE

后端 未结 2 2095
别跟我提以往
别跟我提以往 2020-12-02 02:23

I mostly use SPARQL SELECT while working on a query for debugging purposes but in the end I want to use the final result it in a CONSTRUCT way; as I want to work with a grap

2条回答
  •  庸人自扰
    2020-12-02 02:47

    With the help of my colleague we got it to work, UNION and GROUP BY are essential. This query puts the string together for all locah:ArchivalResource in the graphs:

    CONSTRUCT
    {
      ?archresource skos:hiddenLabel ?supertitle
    }
    WHERE
    {
      SELECT ?archresource  (group_concat(?title ; separator = ", ") AS ?supertitle) WHERE {
        GRAPH ?graph {
          {
            SELECT ?title ?archresource WHERE {
              GRAPH ?graph {
                {
                  ?archresource a locah:ArchivalResource ;
                  dc:title ?title .
                } UNION
                {
                  ?archresource dc:relation+ ?relation .
                  ?relation dc:title ?title .
                }
              }
            }
          }
        }
      } GROUP BY ?archresource
    }
    

提交回复
热议问题