RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
41 stars 17 forks source link

Generating object URI without entity #187

Closed namedgraph closed 1 year ago

namedgraph commented 1 year ago

Issue type: :unicorn: Feature

Description

I'm using a mapping like this:

mappings:
  CarMaker:
    sources: Something
    s: makers:$(carMakerId)
    po:
      - [ a, skos:Concept ]
  Car:
    sources: Something
    s: cars:$(carId)
    po:
      - p: cars:madeBy
        o:
          - mapping: CarMaker

I would like to avoid the CarMaker entity (and any triples it produces) however, and simply create cars:$(carId) cars:madeBy makers:$(carMakerId) triples for Car. I tried removing po from CarMaker but that is not allowed.

Is that doable already?

Why it is useful

Not all object resources need to be entities which have their own properties, some can simply be standalone URI values.

Existing features it breaks

Unknown

bjdmeest commented 1 year ago

I assume you can just use the makers:$(carMakerId) template in the Car mapping?

mappings:
  Car:
    sources: Something
    s: cars:$(carId)
    po:
      - p: cars:madeBy
        o: makers:$(carMakerId)

This assumes that the sources are the same and you don't need a join condition (cfr. your original YARRRML file).

namedgraph commented 1 year ago

That's what I tried using RMLMapper 6.1.3 and it came out as a URI but in quotes, i.e. as a string literal. Maybe that's a bug rather than a feature request :)

bjdmeest commented 1 year ago

Haha, no, sorry, that's bug from me! The YARRRML should be below (it makes literals by default), the ~iri specifies it to be a named node

mappings:
  Car:
    sources: Something
    s: cars:$(carId)
    po:
      - p: cars:madeBy
        o: makers:$(carMakerId)~iri