Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
npd-factpages
npd-factpages
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • logid
  • npd-factpagesnpd-factpages
  • Issues
  • #12

Closed
Open
Opened Jan 23, 2017 by Martin G. Skjæveland@m.g.skjaeveland
  • Report abuse
  • New issue
Report abuse New issue

Merge mappings with equal SQL table and subject map

convert mappings which just project different columns from one table into one TripleMap, assuming this is safe (which I guess amounts to checking if the subjectMaps are equal).

So the two mappings (map:m-1, map:m-2) below (they only differ on y1/y2), should be trandformed into map:supermap, also below, which uses tt:table instead of R2RMLView, and contains multiple predicateObjectMap-s. The benefit is at least less duplication of the subjectMap.

map:m-1
   a rr:TriplesMap ;
   rr:logicalTable [
       a rr:R2RMLView ;
       rr:sqlQuery """
   SELECT
       x, y1 from tableA"""
   ] ;
   rr:predicateObjectMap [
       a rr:PredicateObjectMap ;
       rr:objectMap [
           a rr:ObjectMap, rr:TermMap ;
           rr:column "y1" ;
           rr:termType rr:Literal
       ] ;
       rr:predicate npdv:myY1
   ] ;
   rr:subjectMap [
       a rr:SubjectMap, rr:TermMap ;
       rr:template "http://sws.ifi.uio.no/data/{x}" ;
       rr:termType rr:IRI
   ] .

map:m-2
   a rr:TriplesMap ;
   rr:logicalTable [
       a rr:R2RMLView ;
       rr:sqlQuery """
   SELECT
       x, y2 from tableA"""
   ] ;
   rr:predicateObjectMap [
       a rr:PredicateObjectMap ;
       rr:objectMap [
           a rr:ObjectMap, rr:TermMap ;
           rr:column "y2" ;
           rr:termType rr:Literal
       ] ;
       rr:predicate npdv:myY2
   ] ;
   rr:subjectMap [
       a rr:SubjectMap, rr:TermMap ;
       rr:template "http://sws.ifi.uio.no/data/{x}" ;
       rr:termType rr:IRI
   ] .
map:supermap
   a rr:TriplesMap ;
   rr:logicalTable [ rr:tableName "tableA" ]
   rr:predicateObjectMap [
       a rr:PredicateObjectMap ;
       rr:objectMap [
           a rr:ObjectMap, rr:TermMap ;
           rr:column "y1" ;
           rr:termType rr:Literal
       ] ;
       rr:predicate npdv:myY1
   ] ;
   rr:predicateObjectMap [
       a rr:PredicateObjectMap ;
       rr:objectMap [
           a rr:ObjectMap, rr:TermMap ;
           rr:column "y2" ;
           rr:termType rr:Literal
       ] ;
       rr:predicate npdv:myY2
   ] ;
   rr:subjectMap [
       a rr:SubjectMap, rr:TermMap ;
       rr:template "http://sws.ifi.uio.no/data/{x}" ;
       rr:termType rr:IRI
   ] .

Related issues

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View project labels
Reference: logid/npd-factpages#12