zazuko / query-rdf-data-cube

Explore or query RDF Data Cubes with a JavaScript API, without writing SPARQL.
https://zazuko.github.io/query-rdf-data-cube/
9 stars 2 forks source link

Fetch values for components #26

Closed vhf closed 5 years ago

vhf commented 5 years ago

Fixes #20

TODO:

vhf commented 5 years ago

Sure, I could implement it on Dimension/Attribute/Measure and we'd use it like this:

myDimension.values()

source

Turns out values depend on the data cube so I came up with a different API:

https://github.com/zazuko/query-rdf-data-cube/blob/cefd4e576f7030abdc07c16687f82fbf7d7519d3/examples/component-values.ts#L14-L45

https://github.com/zazuko/query-rdf-data-cube/blob/cefd4e576f7030abdc07c16687f82fbf7d7519d3/examples/component-values-min-max.ts#L10-L29

Could you please comment on that @ktk @herrstucki @lucguillemot?

jstcki commented 5 years ago

Awesome, looks good to me!

I wonder if additionally adding the possibility to add this to queries as well would be possible (like i described in https://github.com/zazuko/query-rdf-data-cube/issues/20#issuecomment-530817209):

// All dimension values of a cube
await cube.componentValues(myDimension) // => [1,2,3,4,5]

// Construct query without executing
const query = cube.query().filter(something)

// All dimension values of this query
await query.componentValues(myDimension) // => [3,5]
vhf commented 5 years ago

Sounds like something useful, I'll try to implement it and come back to you for feedback on the API, it might diverge a bit from your example.

ktk commented 5 years ago

@vhf lgtm, if it's useful for IXT I'm good :)