Informatievlaanderen / VSDS-Linked-Data-Interactions

https://informatievlaanderen.github.io/VSDS-Linked-Data-Interactions/
European Union Public License 1.2
4 stars 6 forks source link

Add support for prebound values in Sparql construct component #426

Closed rorlic closed 1 month ago

rorlic commented 10 months ago

Is your feature request related to a problem? Please describe. Sometimes you want to use some constants in a sparql construct query/constuct but you do not really want to hard code it, e.g. a base URL of some API, etc.

Describe the solution you'd like Can you provide support for prebound values as defined here in the SparqlConstructTransformer? Ideally there is the possibility to define a prebound collection of key/value pairs in the transformer config. Because it is possible to use environment variables in the application.yml file defining a workbench pipeline, it becomes possible to even use environment variables from outside the container running the workbench.

Describe alternatives you've considered The only other option is hard-coding the invariants.

rorlic commented 8 months ago

There is one alternative/workaround:

Example docker compose file:

    environment:
      - API_BASE=${API_BASE:-https://example.com/api/v1}
      - SOMETHING_ELSE=${SOMETHING_ELSE:-anything}

workbench pipeline:

      transformers:
        - name: be.vlaanderen.informatievlaanderen.ldes.ldi.SparqlConstructTransformer
          config:
            query: |
              PREFIX : <https://example.com#>
              CONSTRUCT { 
                ?dummy :api ?api ; :myVariable ?somethingElse. 
              } WHERE { 
                bind(bnode() as ?dummy). 
                bind("${API_BASE}" as ?api) . 
                bind("${SOMETHING_ELSE}" as ?somethingElse) . 
              }
            infer: true
Yalz commented 1 month ago

Workaround in place. Feature no longer needed