Callidon / sparql-engine

πŸš‚ A framework for building SPARQL query engines in Javascript/Typescript
https://callidon.github.io/sparql-engine
MIT License
99 stars 14 forks source link

custom functions #9

Closed dwhitney closed 5 years ago

dwhitney commented 5 years ago

Is your feature request related to a problem? Please describe.

I'd like to create a custom data type, similar to something like "xsd:date", and have a couple of functions available to filter on that custom type.

For more detail - I have a lot of time series data describing some subject over time. Currently for each moment in time, I have a blank node to relate date and value. This is making the my queries slow because each blank node requires two bgp calls to get the date and value for each. I'd like to create a data type that smashes date and value together into one value and then I would not need the blank node, but I'd still need a way to filter on those values. I can use regular expressions, but I think that will be tough for my users. It would be nice to have a custom function to decouple those values like BIND(timeseries:date(?timeseries) as ?date) or BIND(timeseries:value(?timeseries) as ?value). I can do this with regular expressions, but I think that will become tedious.

Describe the solution you'd like

Not sure.

Describe alternatives you've considered

I can think of a way I could do this with regular expressions as described above, but I think that's not ideal if there is another way. I do See that Jena offers something like this https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/propertyfunction/uppercase.java

Callidon commented 5 years ago

I've already think about that. It is not to hard to implement, but it will require a local fork of the SPARQL parser used in order to detect these custom functions.

I put this on my (endless) TODO list.

dwhitney commented 5 years ago

πŸ‘ for now I'm using regex but thanks for getting back to me

On Thu, Dec 20, 2018, 9:34 AM Thomas Minier <notifications@github.com wrote:

I've already think about that. It is not to hard to implement, but it will require a local fork of the SPARQL parser used in order to detect these custom functions.

I put this on my (endless) TODO list.

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Callidon/sparql-engine/issues/9#issuecomment-449018665, or mute the thread https://github.com/notifications/unsubscribe-auth/AACCodVV54LMTXV4iBidc_FeBMJP2vkpks5u65__gaJpZM4ZXFja .

Callidon commented 5 years ago

solved in #13 and #14