---
# System prepended metadata

title: Allegrograph GraphQL Query problems

---

# Allegrograph GraphQL Query problems

## Slow query

```  
PREFIX  pciapollo: <http://onto.wolterskluwer.com/pci/apollo/>
PREFIX  pcilr: <http://onto.wolterskluwer.com/pci/lr/>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  pcicore: <http://onto.wolterskluwer.com/pci/core/>
PREFIX  dcterms: <http://purl.org/dc/terms/>
PREFIX  skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX  frbr: <http://purl.org/vocab/frbr/core#>

SELECT DISTINCT  ?prefLabel ?parent ?topic
WHERE
  { ?parent skos:narrower|skos:hasTopConcept ?topic .
    ?topic skos:prefLabel|dcterms:title ?prefLabel
    FILTER langMatches(lang(?prefLabel), "nl")
  }
VALUES ?parent { 
	<http://data.wolterskluwer.com/nl/apollo/kos/wknl-kbt-status> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-news-domains> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-publication> 
	<http://data.wolterskluwer.com/be/apollo/kos/wkbe-relationship-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-identification-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-territorial-application> 
	<http://data.wolterskluwer.com/be/apollo/kos/wkbe-language> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-hierarchical-section-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-source> 
        <http://data.wolterskluwer.com/be/apollo/kos/wkbe-jurisprudence-nicknames>                                                                  
}
  ```
  Plan:
  ```
    (:modifiers
  :project ?prefLabel, ?parent, ?topic
  (:graph current
    (:multi-match <?topic skos:prefLabel, dcterms:title ?prefLabel>
     :cursor-estimate 866537.0 :filter t)
    (:multi-match <http://data.wolterskluwer.com/nl/apollo/kos/wknl-kbt-status, http://data.wolterskluwer.com/be/apollo/kos/wkbe-news-domains, http://data.wolterskluwer.com/be/apollo/kos/wkbe-publication, http://data.wolterskluwer.com/be/apollo/kos/wkbe-relationship-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-identification-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-territorial-application, http://data.wolterskluwer.com/be/apollo/kos/wkbe-language, http://data.wolterskluwer.com/be/apollo/kos/wkbe-hierarchical-section-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-source, http://data.wolterskluwer.com/be/apollo/kos/wkbe-jurisprudence-nicknames skos:narrower, skos:hasTopConcept ?topic>, bind ?parent to s
     :cursor-estimate 967836.75))
  distinct solutions)
  
```
## Fast Query: 
  
```
PREFIX  pciapollo: <http://onto.wolterskluwer.com/pci/apollo/>
PREFIX  pcilr: <http://onto.wolterskluwer.com/pci/lr/>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  pcicore: <http://onto.wolterskluwer.com/pci/core/>
PREFIX  dcterms: <http://purl.org/dc/terms/>
PREFIX  skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX  frbr: <http://purl.org/vocab/frbr/core#>

SELECT DISTINCT  ?prefLabel ?parent ?topic
WHERE
  { ?parent skos:narrower|skos:hasTopConcept ?topic .
    ?topic skos:prefLabel|dcterms:title ?prefLabel
    FILTER langMatches(lang(?prefLabel), "nl")
  }
VALUES ?parent { 
	<http://data.wolterskluwer.com/nl/apollo/kos/wknl-kbt-status> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-news-domains> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-publication> 
	<http://data.wolterskluwer.com/be/apollo/kos/wkbe-relationship-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-identification-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-territorial-application> 
	<http://data.wolterskluwer.com/be/apollo/kos/wkbe-language> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-hierarchical-section-type> <http://data.wolterskluwer.com/be/apollo/kos/wkbe-source> 
}
```
Plan:
```
(:modifiers
  :project ?prefLabel, ?parent, ?topic
  (:graph current
    (:multi-match <http://data.wolterskluwer.com/nl/apollo/kos/wknl-kbt-status, http://data.wolterskluwer.com/be/apollo/kos/wkbe-news-domains, http://data.wolterskluwer.com/be/apollo/kos/wkbe-publication, http://data.wolterskluwer.com/be/apollo/kos/wkbe-relationship-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-identification-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-territorial-application, http://data.wolterskluwer.com/be/apollo/kos/wkbe-language, http://data.wolterskluwer.com/be/apollo/kos/wkbe-hierarchical-section-type, http://data.wolterskluwer.com/be/apollo/kos/wkbe-source skos:narrower, skos:hasTopConcept ?topic>, bind ?parent to s
     :cursor-estimate 870729.75)
    (:multi-match <?topic skos:prefLabel, dcterms:title ?prefLabel>
     :cursor-estimate 866516.0 :filter t))
  distinct solutions)
  ```