Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LanguageMap (or general literalelementmap): how to join? #23

Closed
bjdmeest opened this issue Dec 7, 2020 · 3 comments
Closed

LanguageMap (or general literalelementmap): how to join? #23

bjdmeest opened this issue Dec 7, 2020 · 3 comments
Labels
representation representation issues rml rml issues

Comments

@bjdmeest
Copy link
Member

bjdmeest commented Dec 7, 2020

As it's a termMap, you can apply joins and data transformations similar to how other term maps work

What would a join on a language map look like?

Originally posted by @pmaria in #21 (comment)

Ah yes, I didn't think the joins too much through :P. This would require much more extensions, eg next to a TriplesMap also a LiteralElementMap that can have a different logicalSource, something like below.

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@base <http://example.com/base/> .

<TriplesMap1> a rr:TriplesMap;
    
  rml:logicalSource [ 
    rml:source "input-3/input.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.persons"
  ];

  rr:subjectMap [ 
    rr:template "http://example.com/persons/{firstname}";
  ];

  rr:predicateObjectMap [ 
    rr:predicate ex:lastName ;
    rr:objectMap [
      rml:reference "lastname";
      rml:languageMap [
        a rr:RefObjectMap ; # I guess we need a new name for this too, maybe a RefLiteralElementMap cfr. https://github.com/kg-construct/mapping-challenges/pull/21#issuecomment-738617830?
        rr:parentTriplesMap <TermMap1>;
        rr:joinCondition [
          rr:child "firstname" ;
          rr:parent "firstname" ;
        ]
      ]
    ]
  ].

## WARNING BELOW IS INTRODUCING WAAAY MORE CHANGES THAN ANTICIPATED

<TermMap1> a rr:LiteralElementMap;

  rml:logicalSource [ 
    rml:source "input-3/input.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.languages"
  ];

  rml:reference "language" .

I'm not sure we want to go this far.
This is (of course! :P ) also solvable using a fno:Function (as an fno:Function could refer to a different logicalSource), it would require something like below, but the whole 'using functions across different logicalSources' needs to be further specified

rml:languageMap [
  fnml:functionValue [
    rml:logicalSource [
      rml:source "input-3/input.json";
      rml:referenceFormulation ql:JSONPath;
      rml:iterator "$.languages"
    ];

    rr:predicateObjectMap [
      rr:predicate fno:executes ;
      rr:objectMap [ rr:constant idlab-fn:trueCondition; rr:termType rr:IRI ]
    ];

    rr:predicateObjectMap [
      rr:predicate idlab-fn:strBoolean ;
      rr:objectMap <#EqualsFunction>
    ];
			
    rr:predicateObjectMap [
      rr:predicate idlab-fn:str ;
      rr:objectMap [ rr:reference "language" ]
    ]
  ]
].

<#EqualsFunction>
	
  fnml:functionValue [
    rml:logicalSource [
      rml:source "input-3/input.json";
      rml:referenceFormulation ql:JSONPath;
      rml:iterator "$.persons"
    ];

    rr:predicateObjectMap [
      rr:predicate fno:executes ;
      rr:objectMap [ rr:constant idlab-fn:equal ]
    ];

    rr:predicateObjectMap [
      rr:predicate grel:valueParameter ;
      rr:objectMap [ rml:reference "languages" ] # TODO we need to specify which logical source we take this from
    ];
		
    rr:predicateObjectMap [
      rr:predicate grel:valueParameter2 ;
      rr:objectMap [ rml:reference "languages" ] # TODO we need to specify which logical we take this from
    ]
  ]
].

I have the feeling we could use xrr:pushDown here to join over different data sources as well (@frmichel what do you think?). We have options. But maybe the first question should be: do we want to go this complex? :P @VladimirAlexiev have you come across this use case?

@dachafra dachafra added representation representation issues rml rml issues labels Jan 4, 2021
@dachafra
Copy link
Member

@bjdmeest which is the status of this? Is it still something we need to have? Or is it more like a "good-to-have" feature.

@bjdmeest
Copy link
Member Author

I personally think this is solved once we have https://github.com/kg-construct/rml-fno-spec/issues/2 solved

@dachafra
Copy link
Member

As this is already taken into account in the spec and we are working on it at https://github.com/kg-construct/rml-fno-spec/issues/2, we can close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
representation representation issues rml rml issues
Projects
None yet
Development

No branches or pull requests

2 participants