kg-construct / rml-lv

Specification repository for logical views in RML.
https://kg-construct.github.io/rml-lv/dev.html
3 stars 3 forks source link

How to define joins between field logical sources #2

Closed thomas-delva closed 5 months ago

thomas-delva commented 2 years ago

There is an opportunity to define joins on a logical source level using fields. This would avoid defining joins every time they are needed somewhere (currently we have the referencing object map, the star map and the function map which all do joins slightly differently).

The general idea is that if one logical source has fields A, B and C, and it is joined with a logical source with fields D, E and F, the result is a new (?) logical source with fields A, B, C, D, E and F.

Pano proposed a syntax for this which we can work from:

<LS> a rml:LogicalSource ;
rml:iterator “$.chains[*]” ;
rml:field [ rml:name “book” ;
  rml:reference “$.books[*]” ;
  rml:field [ rml:name “author”
    rml:reference “$.author” ] ;
  rml:field [ rml:name “title”
    rml:reference “$.title” ] ] ;
# join
rml:join [
  rml:with [
    ...
    rml:iterator "$.bookStats[*]" ;
  ] ;
  rml:joinCondition [
    rml:child "title" ;
    rml:parent "book" ;
  ] ] ;
dachafra commented 2 years ago

@thomas-delva could you add an example where would avoid defining joins every time they are needed somewhere can be exploited?

thomas-delva commented 2 years ago

@dachafra With that comment I mean that currently we have joins in three distinct places in RML (if I don't forget any): referencing object map, RML-star and functions. This seems a bit hard to maintain to me, hence to suggestion to add joins in one place, i.e., in the logical source.

p.s. Sorry for the delay in answering. This was also discussed in the KGC days but it's good to have it written here.

bjdmeest commented 5 months ago

As discussed: we support both parentTermpMap (for backwards compatibility) and logicalView Joins (https://kg-construct.github.io/rml-lv/dev.html#viewjoins)