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

Rdf-writer defined within the Ldio:HttpOut component seemingly does not apply a specified frame to the output #655

Open StijnDenisSirus opened 3 months ago

StijnDenisSirus commented 3 months ago

Versions ldes/ldi-orchestrator:2.3.0-SNAPSHOT and onwards

Describe the bug An rdf-writer defined within the Ldio:HttpOut component seemingly does not apply a specified frame to the output. This issue seems to occur from ldes/ldi-orchestrator:2.3.0-SNAPSHOT onwards (only verified myself in 2.3.0-SNAPSHOT, 2.5.1 and 2.7.0-SNAPSHOT).

To Reproduce Steps to reproduce the behavior:

  1. ldes/ldi-orchestrator:2.3.0-SNAPSHOT (or later) is running with the following configuration:

server: port: 80

  1. A pipeline with the following configuration is successfully sent to the LDIO:

    
    name: telraam_observations
    description: This pipeline will take data from the Telraam ldes server and send to an Azure function
    input:
    name: Ldio:LdesClient
    config:
    urls: https://telraam-api.net/ldes/observations/by-location?tile=14%2F8361%2F5484
    sourceFormat: text/turtle
    retries:
      enabled: true
    transformers:
    - name: Ldio:SparqlConstructTransformer
    config:
      query: |
        PREFIX geojson: <https://purl.org/geojson/vocab#>
        PREFIX location: <http://sw.deri.org/2006/07/location/loc#>
        PREFIX locn: <http://www.w3.org/ns/locn#>
        PREFIX terms: <http://purl.org/dc/terms/>
        PREFIX ngsi-ld: <https://uri.etsi.org/ngsi-ld/>
        PREFIX OM: <http://def.isotc211.org/iso19156/2011/Observation#>
        PREFIX time: <http://www.w3.org/2006/time#>
        PREFIX sosa: <http://www.w3.org/ns/sosa/>
        PREFIX seb: <https://data.vlaanderen.be/ns/sensoren-en-bemonstering#>
        PREFIX schema: <https://schema.org/>
        PREFIX prov: <http://www.w3.org/ns/prov#>
        PREFIX verkeersmetingen: <https://data.vlaanderen.be/ns/verkeersmetingen#>
        PREFIX sf: <http://www.opengis.net/ont/sf#>
        PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
        PREFIX geojson: <https://purl.org/geojson/vocab#>
    
        CONSTRUCT {
          ?obs a verkeersmetingen:Verkeersmeting ;
    
          verkeersmetingen:kenmerkType [
            a ngsi-ld:Property;
            ngsi-ld:hasValue ?strkenmerktype
            ];
    
          verkeersmetingen:voertuigType [
            a ngsi-ld:Property;
            ngsi-ld:hasValue ?strvoertuigtype          
            ];
    
          OM:OM_Observation.result [
            a ngsi-ld:Property;
            ngsi-ld:hasValue ?strvalue
            ];
    
          schema:unitCode [
            a ngsi-ld:Property;
            ngsi-ld:hasValue ?strunit
            ];
    
          OM:OM_Observation.phenomenonTime [
            a ngsi-ld:Property;
            ngsi-ld:hasValue ?strbeginTime 
            ];
    
          ngsi-ld:location [
            a ngsi-ld:GeoProperty;
            ngsi-ld:hasValue [
              a geojson:Point;
              geojson:coordinates (
                ?lat
                ?lon
            )
            ]
          ]}
    
        WHERE {
          ?versieObs a verkeersmetingen:Verkeersmeting ;
          terms:isVersionOf ?obs ; 
          <https://implementatie.data.vlaanderen.be/ns/vsds-verkeersmetingen#Verkeerssnelheidsmeting.geobserveerdKenmerk>|<https://implementatie.data.vlaanderen.be/ns/vsds-verkeersmetingen#Verkeerstelling.geobserveerdKenmerk> [ 
            verkeersmetingen:voertuigType  ?voertuigtype ;
            <https://implementatie.data.vlaanderen.be/ns/vsds-verkeersmetingen#Verkeerssnelheidsmetingkenmerk.kenmerktype>|<https://implementatie.data.vlaanderen.be/ns/vsds-verkeersmetingen#Verkeerstellingkenmerk.kenmerktype>  ?kenmerktype
          ] ;
          verkeersmetingen:geobserveerdObject [ 
            a  verkeersmetingen:Verkeersmeetpunt;
            <http://def.isotc211.org/iso19156/2011/SamplingPoint#SF_SamplingPoint.shape> [ 
              a sf:Point;
              geosparql:asWKT  ?wkt
            ];
          ];
    
          OM:OM_Observation.phenomenonTime/time:hasBeginning/time:inXSDDateTimeStamp ?beginTime ;
          #OM:OM_Observation.phenomenonTime/time:hasXSDDuration ?duration ;
          OM:OM_Observation.result/schema:value | <https://implementatie.data.vlaanderen.be/ns/vsds-verkeersmetingen#Verkeerstelling.tellingresultaat> ?value .
    
        OPTIONAL {
          ?versieObs OM:OM_Observation.result/schema:unitCode ?unit .
          }
    
        BIND (strafter(strbefore(str(?wkt), ' '), 'POINT(') as ?lat)
        BIND (strafter(strbefore(str(?wkt), ')'), ' ') as ?lon)
        BIND (str(?kenmerktype) as ?strkenmerktype)
        BIND (str(?voertuigtype) as ?strvoertuigtype)
        BIND (str(?value) as ?strvalue)
        #BIND (str(?unit) as ?strunit)
        BIND (IF(BOUND(?unit), str(?unit), 'aantal') as ?strunit)
        BIND (str(?beginTime) as ?strbeginTime)
        }
    outputs:
    - name: Ldio:HttpOut
    config:
      endpoint: http://host.docker.internal:7071/api/http_trigger_reformat
      content-type: application/ld+json
      rdf-writer:
        content-type: application/ld+json
        frame: |
          {
            "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
            "@type": "https://data.vlaanderen.be/ns/verkeersmetingen#Verkeersmeting"
          }

4. The output sent to the Ldio:HttpOut endpoint will not have the specified frame applied (see screenshots).

**Expected behavior**
The frame specified in the rdf-writer should be applied to the data sent to the endpoint (see screenshots).

**Screenshots**
Output for ldes/ldi-orchestrator:2.2.0-SNAPSHOT (reference)
![HttpOut_2 2 0-SNAPSHOT](https://github.com/Informatievlaanderen/VSDS-Linked-Data-Interactions/assets/171246355/36e44018-40ad-40a9-ae3c-e2b34a01f8c6)

Output for ldes/ldi-orchestrator:2.3.0-SNAPSHOT or later
![HttpOut_2 3 0-SNAPSHOT_1](https://github.com/Informatievlaanderen/VSDS-Linked-Data-Interactions/assets/171246355/88edbf0d-5d01-4a9c-85e2-794fe762d8af)
![HttpOut_2 3 0-SNAPSHOT_2](https://github.com/Informatievlaanderen/VSDS-Linked-Data-Interactions/assets/171246355/0d2e5652-fe20-48eb-b7f8-c73dab6dcb32)