Skip to content

Joining on equal condition with constant value fails #39

@ghsnd

Description

@ghsnd

Problem

Joining using the equal function with a constant value as parameter generates a join condition with an "empty" child as object. We expect a join with an rr:constant

Example

data.json:

{
  "features": [
    {
      "type": "Feature",
      "properties": {
        "sector": 0,
        "altitude_m_gained": 20,
        "altitude_m_dropped": 0,
        "surface": "asphalt",
        "surface_condition": "perfect",
        "track_width": "wide",
        "obstacle": "none",
        "curvy": "low"
      }
    }
  ]
}

source_1.csv:

Athlete,Total laps,Lap,Sector 0
Jos Bosmans,6,1,6.0
Jos Bosmans,6,2,6.0
Jos Bosmans,6,3,6.0
Jos Bosmans,6,4,6.0
Jos Bosmans,6,5,6.0
Jos Bosmans,6,6,5.0
Ellen Triek,6,1,6.0
Ellen Triek,6,2,6.5

mapping.yarrrml:

prefixes:
  ex: "http://example.com/"

mappings:
  track:
    sources:
      - ['data.json~jsonpath', '$.features.[*].properties']
    s: http://example.com/sector/$(sector)
    po:
      - [ex:name, $(sector)]

  sector0:
    sources:
      - ['source_1.csv~csv']
    s: ex:Lap$(Lap)/Sector1/$(Athlete)
    po:
      - p: ex:Sector
        o:
          mapping: track
          condition:
            function: equal
            parameters:
              - [str1, "0"]            ### <-- constant value ###
              - [str2, $(sector)]

Generated RML rules:

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix map: <http://mapping.example.com/>.

map:jc_0 rr:child "";   ### <-- empty  ###
    rr:parent "sector".
map:map_sector0_0 rml:logicalSource map:source_1;
    a rr:TriplesMap;
    rdfs:label "sector0";
    rr:subjectMap map:s_1;
    rr:predicateObjectMap map:pom_1.
map:map_track_0 rml:logicalSource map:source_0;
    a rr:TriplesMap;
    rdfs:label "track";
    rr:subjectMap map:s_0;
    rr:predicateObjectMap map:pom_0.
map:om_0 a rr:ObjectMap;
    rml:reference "sector";
    rr:termType rr:Literal.
map:om_1 a rr:ObjectMap;
    rr:parentTriplesMap map:map_track_0;
    rr:joinCondition map:jc_0.
map:pm_0 a rr:PredicateMap;
    rr:constant <http://example.com/name>.
map:pm_1 a rr:PredicateMap;
    rr:constant <http://example.com/Sector>.
map:pom_0 a rr:PredicateObjectMap;
    rr:predicateMap map:pm_0;
    rr:objectMap map:om_0.
map:pom_1 a rr:PredicateObjectMap;
    rr:predicateMap map:pm_1;
    rr:objectMap map:om_1.
map:s_0 a rr:SubjectMap;
    rr:template "http://example.com/sector/{sector}".
map:s_1 a rr:SubjectMap;
    rr:template "http://example.com/Lap{Lap}/Sector1/{Athlete}".
map:source_0 a rml:LogicalSource;
    rml:source "data.json";
    rml:iterator "$.features.[*].properties";
    rml:referenceFormulation ql:JSONPath.
map:source_1 a rml:LogicalSource;
    rml:source "source_1.csv";
    rml:referenceFormulation ql:CSV.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions