Swirrl / cubiql

CubiQL: A GraphQL service for querying multidimensional Linked Data Cubes
Eclipse Public License 1.0
41 stars 2 forks source link

Dimensions created by Table2qb are not treated as enum #153

Closed zeginis closed 6 years ago

zeginis commented 6 years ago

Table2qb defiens the range of teh dimensions like this" <http://example.ee/crime/def/dimension/day> rdfs:range <http://example.ee/crime/def/Day>

This makes Cubiql to treat these dimensions as URIs not as enum.

zeginis commented 6 years ago

@lkitching I am not sure that the problem is the rdfs:range

I have tested the cube: http://example.ee/crime/data/tallincrime The enum are created ok when there are no other cubes at the db.

However when I load also other cubes the enums of this cube are not created and the dimension values are returned as URIs.

e.g. running

{cubiql{dataset_tallincrime{
  observations{
    page{
      observation
      {
        count
        day
        linnaosa  
     }    }  }}}}

The result is:

"observation": [
              {
                "count": "111.0",
                "day": "http://example.ee/crime/def/concept/day/Esmaspaev",
                "linnaosa": "http://example.ee/crime/def/concept/linnaosa/Haabersti"
              },
...

The SPARQL endpoint I use: http://195.251.218.39:8893/sparql

The config I use:

{:geo-dimension-uri nil
 :time-dimension-uri "http://example.ee/crime/def/dimension/year"
 :codelist-source "component"
 :codelist-predicate "http://publishmydata.com/def/qb/codesUsed"
 :codelist-label-uri "http://www.w3.org/2000/01/rdf-schema#label"
 :dataset-label-uri "http://www.w3.org/2000/01/rdf-schema#label"
 :schema-label-language en
 :max-observations-page-size 2000}
lkitching commented 6 years ago

@zeginis - It looks like that SPARQL endpoint is restricting the number of results returned by the enum labels query. The query is:

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT (count(*) as ?c) WHERE {  
  ?ds qb:structure ?struct .  
  ?struct a qb:DataStructureDefinition .  
  ?struct qb:component ?comp .  
  ?comp qb:dimension ?dim .
  FILTER(?dim != <http://example.ee/crime/def/dimension/year>) 
  OPTIONAL { ?dim rdfs:comment ?doc }
  ?comp <http://publishmydata.com/def/qb/codesUsed> ?codelist .
  {  
    ?codelist skos:member ?member .  
    ?member <http://www.w3.org/2000/01/rdf-schema#label> ?vallabel .
  }
  UNION {  
    ?member skos:inScheme ?codelist .  
    ?member rdfs:label ?vallabel .
  }
}

this query should return 25964 results, but running it in the REPL using the sesame client only returns 10000 items. None of the returned labels are for the http://example.ee/crime/data/tallincrime cube, so the enum mapping is not created for any of its enum dimensions. That is why the graphql type mapped to those dimensions is uri instead of a custom enum type. Can you configure that endpoint to increase the limit on the number of returned results?

zeginis commented 6 years ago

Thank you @lkitching. The problem was indeed the max number or results returnded by the endpoint