Skip to content

Commit 1902342

Browse files
committed
feat: improved URI pattern rewrite implementation in source files
Conform to the following scheme: ``` ns:{notice-id}-{notice-ver}/Notice/{class-or-context-name}/{id-or-path-seed} ``` Implemented with the following techniques: **rr:template:** - substitute `http://data.europa.eu/a4g/resource/id_{` with `http://data.europa.eu/a4g/resource/{` - substitute `replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}` with `replace(replace(/*/cbc:ID, ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}` - substitute `\}_(.*?)_\{` with `}/$1/{` - substitute `}_Notice` with `}/Notice` **rml:reference:** - substitute `'http://data.europa.eu/a4g/resource/id_'` with `'http://data.europa.eu/a4g/resource/'` - substitute `replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') ||` with `replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '-' || /*/cbc:VersionID ||` - substitute `\|\| '_(.*?)_' \|\|` with `|| '/$1/' ||` - substitute `|| '_Notice'` with `|| '/Notice'` **Unwanted:** - substitute `replace(replace(cbc:ID, ' ', '-' ), '/' , '-')}` with `replace(replace(cbc:ID, ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}` - substitute `replace(replace(cbc:ID, ' ', '-' ), '/' , '-') ||` with `replace(replace(cbc:ID, ' ', '-' ), '/' , '-') || '-' || /*/cbc:VersionID ||` We don't want to be replacing references to previous/external entities. Those will be manually replaced as they need extra care.
1 parent 5f36eca commit 1902342

96 files changed

Lines changed: 1082 additions & 1036 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/mappings-can/AwardDecision-can.rml.ttl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tedm:MG-AwardDecision_ND-SettledContract a rr:TriplesMap ;
3838
rr:subjectMap
3939
[
4040
rdfs:label "ND-SettledContract" ;
41-
rml:reference "if(exists(cbc:AwardDate)) then 'http://data.europa.eu/a4g/resource/id_' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '_AwardDecision_' || encode-for-uri(cbc:AwardDate) else null" ;
41+
rml:reference "if(exists(cbc:AwardDate)) then 'http://data.europa.eu/a4g/resource/' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '-' || /*/cbc:VersionID || '/AwardDecision/' || encode-for-uri(cbc:AwardDate) else null" ;
4242
rr:class epo:AwardDecision
4343
] ;
4444
rr:predicateObjectMap
@@ -79,7 +79,7 @@ tedm:MG-AwardDecision_ND-LotResult a rr:TriplesMap ;
7979
#
8080
# ASSUMPTION: all SettledContract AwardDates under the LotResult
8181
# are the same date
82-
rml:reference "'http://data.europa.eu/a4g/resource/id_' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '_AwardDecision_' || (if(exists(/*/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:NoticeResult/efac:SettledContract[cbc:ID/text() = //efac:SettledContract/cbc:ID/text()]/cbc:AwardDate)) then encode-for-uri((/*/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:NoticeResult/efac:SettledContract[cbc:ID/text() = //efac:SettledContract/cbc:ID/text()]/cbc:AwardDate)[1]) else if (exists(efac:SettledContract/cbc:ID) and not(exists(efac:SettledContract[2]/cbc:ID))) then encode-for-uri(efac:SettledContract/cbc:ID) else encode-for-uri(cbc:ID))" ;
82+
rml:reference "'http://data.europa.eu/a4g/resource/' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '-' || /*/cbc:VersionID || '/AwardDecision/' || (if(exists(/*/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:NoticeResult/efac:SettledContract[cbc:ID/text() = //efac:SettledContract/cbc:ID/text()]/cbc:AwardDate)) then encode-for-uri((/*/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:NoticeResult/efac:SettledContract[cbc:ID/text() = //efac:SettledContract/cbc:ID/text()]/cbc:AwardDate)[1]) else if (exists(efac:SettledContract/cbc:ID) and not(exists(efac:SettledContract[2]/cbc:ID))) then encode-for-uri(efac:SettledContract/cbc:ID) else encode-for-uri(cbc:ID))" ;
8383
rr:class epo:AwardDecision
8484
] ;
8585
rr:predicateObjectMap

src/mappings-can/BudgetProvider-can.rml.ttl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tedm:MG-BudgetProvider_ND-FinancingParty a rr:TriplesMap ;
3535
rr:subjectMap
3636
[
3737
rdfs:label "ND-FinancingParty" ;
38-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_BudgetProvider_{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
38+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/BudgetProvider/{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
3939
rr:class epo:BudgetProvider
4040
] ;
4141
rr:predicateObjectMap
@@ -81,7 +81,7 @@ tedm:MG-Lot-contextualisedBy-BudgetProvider_ND-FinancingParty a rr:TriplesMap ;
8181
rr:subjectMap
8282
[
8383
rdfs:label "ND-FinancingParty" ;
84-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Lot_{../efac:TenderLot/cbc:ID}" ;
84+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Lot/{../efac:TenderLot/cbc:ID}" ;
8585
rr:class epo:Lot
8686
] ;
8787
.
@@ -97,7 +97,7 @@ tedm:MG-BudgetProvider-seeAlso-LotAwardOutcome_ND-FinancingParty a rr:TriplesMap
9797
rr:subjectMap
9898
[
9999
rdfs:label "ND-FinancingParty" ;
100-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_BudgetProvider_{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
100+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/BudgetProvider/{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
101101
rr:class epo:BudgetProvider
102102
] ;
103103
.
@@ -113,7 +113,7 @@ tedm:MG-BudgetProvider-announcesRole-ResultNotice_ND-FinancingParty a rr:Triples
113113
rr:subjectMap
114114
[
115115
rdfs:label "ND-FinancingParty" ;
116-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_BudgetProvider_{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
116+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/BudgetProvider/{encode-for-uri(concat(cac:PartyIdentification/cbc:ID, cac:PartyIdentification/cbc:ID/@schemeName))}" ;
117117
rr:class epo:BudgetProvider
118118
] ;
119119
.
@@ -131,7 +131,7 @@ tedm:MG-Organization-playedBy-BudgetProvider_ND-FinancingParty a rr:TriplesMap ;
131131
[
132132
rdfs:label "ND-FinancingParty" ;
133133
rdfs:comment "Financing Party (ID reference)";
134-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Organization_{cac:PartyIdentification/cbc:ID}" ;
134+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Organization/{cac:PartyIdentification/cbc:ID}" ;
135135
rr:class org:Organization
136136
] ;
137137
.

src/mappings-can/Business-can.rml.ttl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tedm:MG-Business_ND-OrganizationUboReference a rr:TriplesMap ;
3636
rr:subjectMap
3737
[
3838
rdfs:label "ND-OrganizationUboReference" ;
39-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Organization_{../efac:Company/cac:PartyIdentification/cbc:ID}" ;
39+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Organization/{../efac:Company/cac:PartyIdentification/cbc:ID}" ;
4040
rr:class epo:Business
4141
] ;
4242
rr:predicateObjectMap
@@ -70,7 +70,7 @@ tedm:MG-Person-hasBeneficialOwner-Business_ND-OrganizationUboReference a rr:Trip
7070
rdfs:label "ND-OrganizationUboReference" ;
7171
rdfs:label "OPT-302-Organization" ;
7272
rdfs:comment "Beneficial Owner Reference of MG-Person under ND-OrganizationUboReference" ;
73-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Person_{cbc:ID}" ;
73+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Person/{cbc:ID}" ;
7474
rr:class person:Person
7575
] ;
7676
.
@@ -86,7 +86,7 @@ tedm:MG-Business_ND-Organization a rr:TriplesMap ;
8686
rr:subjectMap
8787
[
8888
rdfs:label "ND-Organization" ;
89-
rml:reference "if(exists(efbc:ListedOnRegulatedMarketIndicator)) then 'http://data.europa.eu/a4g/resource/id_' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '_Organization_' || efac:Company/cac:PartyIdentification/cbc:ID else null";
89+
rml:reference "if(exists(efbc:ListedOnRegulatedMarketIndicator)) then 'http://data.europa.eu/a4g/resource/' || replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-') || '-' || /*/cbc:VersionID || '/Organization/' || efac:Company/cac:PartyIdentification/cbc:ID else null";
9090
rr:class epo:Business
9191
] ;
9292
rr:predicateObjectMap
@@ -113,7 +113,7 @@ tedm:MG-Identifier-identifier-Person_ND-UBO a rr:TriplesMap ;
113113
rr:subjectMap
114114
[
115115
rdfs:label "ND-UBO" ;
116-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_BeneficialOwnerTechnicalIdentifier_{replace(translate(path(), concat(codepoints-to-string(123), codepoints-to-string(125), '/[]'), ' _'), 'Q .*? ', '')}" ;
116+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/BeneficialOwnerTechnicalIdentifier/{replace(translate(path(), concat(codepoints-to-string(123), codepoints-to-string(125), '/[]'), ' _'), 'Q .*? ', '')}" ;
117117
rr:class adms:Identifier
118118
] ;
119119
rr:predicateObjectMap
@@ -149,7 +149,7 @@ tedm:MG-Person_ND-UBO a rr:TriplesMap ;
149149
rr:subjectMap
150150
[
151151
rdfs:label "ND-UBO" ;
152-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Person_{cbc:ID}" ;
152+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Person/{cbc:ID}" ;
153153
rr:class person:Person
154154
] ;
155155
rr:predicateObjectMap
@@ -213,7 +213,7 @@ tedm:MG-Address-registeredAddress-Person_ND-UBOAddress a rr:TriplesMap ;
213213
rr:subjectMap
214214
[
215215
rdfs:label "ND-UBOAddress" ;
216-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_UBOAddress_{replace(translate(path(), concat(codepoints-to-string(123), codepoints-to-string(125), '/[]'), ' _'), 'Q .*? ', '')}" ;
216+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/UBOAddress/{replace(translate(path(), concat(codepoints-to-string(123), codepoints-to-string(125), '/[]'), ' _'), 'Q .*? ', '')}" ;
217217
rr:class locn:Address
218218
] ;
219219
rr:predicateObjectMap
@@ -286,7 +286,7 @@ tedm:MG-Person_ND-UBONationality a rr:TriplesMap ;
286286
rr:subjectMap
287287
[
288288
rdfs:label "ND-UBONationality" ;
289-
rr:template "http://data.europa.eu/a4g/resource/id_{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}_Person_{../cbc:ID}" ;
289+
rr:template "http://data.europa.eu/a4g/resource/{replace(replace(/*/cbc:ID[@schemeName='notice-id'], ' ', '-' ), '/' , '-')}-{/*/cbc:VersionID}/Person/{../cbc:ID}" ;
290290
rr:class person:Person
291291
] ;
292292
rr:predicateObjectMap

0 commit comments

Comments
 (0)