Hi, The following (generated) query takes 1 minute to execute over a dataset of 175862 quads in Fuseki 3.16.0. Isn't that slow?
If I remove the SAMPLE and the last OPTIONAL, it executes immediately. PREFIX dct: <http://purl.org/dc/terms/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX sioc: <http://rdfs.org/sioc/ns#> SELECT DISTINCT ?thing (COUNT(DISTINCT ?child) AS ?countchildd14aAdAbDbAbA) (SAMPLE(?labelthingd14aAdAbDbAbA) AS ?labelthingd14aAdAbDbAbAsample) WHERE { GRAPH ?childGraph { { ?child sioc:has_parent <https://localhost:4443/products/> } UNION { ?child sioc:has_container <https://localhost:4443/products/> } ?child a ?Type OPTIONAL { ?child dct:title ?title } OPTIONAL { ?child foaf:primaryTopic ?thing } } OPTIONAL { { ?thing (((((((<http://www.w3.org/2000/01/rdf-schema#label>|<http://purl.org/dc/elements/1.1/title>)|dct:title)|foaf:name)|foaf:givenName)|foaf:familyName)|sioc:name)|<http://www.w3.org/2004/02/skos/core#prefLabel>)|sioc:content ?labelthingd14aAdAbDbAbA } UNION { GRAPH ?labelthingd14aAdAbDbAbAgraph { ?thing (((((((<http://www.w3.org/2000/01/rdf-schema#label>|<http://purl.org/dc/elements/1.1/title>)|dct:title)|foaf:name)|foaf:givenName)|foaf:familyName)|sioc:name)|<http://www.w3.org/2004/02/skos/core#prefLabel>)|sioc:content ?labelthingd14aAdAbDbAbA } } } } GROUP BY ?thing ORDER BY DESC(?countchildd14aAdAbDbAbA) Martynas