kg-construct / rml-core

RML-Core: Main features for RDF generation with RML
https://w3id.org/rml/core/spec
Creative Commons Attribution 4.0 International
12 stars 9 forks source link

inverse predicates in RML #40

Open pmaria opened 3 years ago

pmaria commented 3 years ago

An aspect missing from RML is the ability to generate a triple using an inverse predicate.

Specifiying the generation of triples with an inverse predicate would allow you to generate a triple in the inverse direction so object -> predicate -> subject in the context of the subject generating triples map.

Note: YARRRML also introduces inverse predicates.

Proposal:

Example:

<someTriplesMap>
  rml:logicalSource [] ;
  rr:subject ex:subject ;
  rr:predicateObjectMap [
    rr:predicateMap [
      rr:constant ex:parent ;
    ] ;
    rml:inversePredicateMap [
      rr:constant ex:child ;
    ] ;
    rr:object ex:object ;
  ] ;

or using shortcut properties:

<someTriplesMap>
  rml:logicalSource [] ;
  rr:subject ex:subject ;
  rr:predicateObjectMap [
    rr:predicate ex:parent ;
    rml:inversePredicate ex:child;
    rr:object ex:object ;
  ] ;

would generate:

ex:subject ex:parent ex:object .

ex:object ex:child ex:subject .
andimou commented 2 years ago

Overall I agree with this, but isn't it more a core issue rather than an fno issue?

Only a clarification, with the following

Redefine rml:PredicateObjectMap such that it should have at least one rml:PredicateMap or rml:InversePredicateMap. This will allow for maximum flexibility in use.

you mean we can have a POM which only has an inverse predicate map but not a regular predicate map? or do you see more flexibility than this?

pmaria commented 2 years ago

Overall I agree with this, but isn't it more a core issue rather than an fno issue?

Agreed, but we don't have a separate repository for core yet as far as I know.

you mean we can have a POM which only has an inverse predicate map but not a regular predicate map? or do you see more flexibility than this?

Indeed, that is exactly what I meant.

DylanVanAssche commented 2 years ago

I like this! Implementation-wise this should be straightforward as well, no additional complexity.

dachafra commented 3 months ago

This is a very old issue and I don't know if we will implement or leave it for the Working Group. I'd like to hear opinions from @andimou @pmaria @DylanVanAssche @anaigmo

DylanVanAssche commented 3 months ago

I would like to see this, but depends on RML-Core to add it to the spec. Also needs test cases and SHACL shapes of course.

dachafra commented 3 months ago

IMHO, I would mark it as working-group and not implement this for the CG

pmaria commented 3 months ago

We can leave it on working group, unless I have time to add it beforehand :)

idomingu commented 3 months ago

This feature would come handy. I support it, unless it adds extra complexity in the RML engine.