yarrrml-parser
yarrrml-parser copied to clipboard
yarrrml-generator: doesn't support function descriptions
Following RML
# status: working, but still some TODOs
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix csvw: <http://www.w3.org/ns/csvw#> .
@prefix fnml: <http://semweb.mmlab.be/ns/fnml#> .
@prefix fno: <https://w3id.org/function/ontology#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix org: <http://www.w3.org/2004/02/skos/core#> .
@prefix rov: <http://www.w3.org/ns/regorg#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix locn: <http://www.w3.org/ns/locn#> .
@base <http://knows.com/base/> .
<CustomerSource>
rml:source [
a csvw:Table;
csvw:url "../../data/general-customer-cleaned.csv";
csvw:dialect [
a csvw:Dialect;
csvw:delimiter ";"
]
];
rml:referenceFormulation ql:CSV
.
_:smOrganization
a rr:SubjectMap;
rr:template "{No_}";
rr:class rov:RegisteredOrganization;
.
_:smSite
a rr:SubjectMap;
rr:template "site/{No_}"; # TODO: site identifier
rr:class org:Site;
.
################################################################################
# TRIPLE MAPS
# Generates a Site resource for column: 'Address'
# The Site resource is linked to its Organization resource through org:siteOf
<SiteForAddress>
a rr:TriplesMap;
rml:logicalSource <CustomerSource> ;
rr:subjectMap _:smSite;
rr:predicateObjectMap [
rr:predicate locn:address;
rr:objectMap [
fnml:functionValue [
rr:predicateObjectMap [
rr:predicate fno:executes ;
rr:objectMap [ rr:constant <http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join> ] ] ;
rr:predicateObjectMap [
rr:predicate <http://users.ugent.be/~bjdmeest/function/grel.ttl#p_array_a> ;
rr:objectMap [ rml:reference "Address"];
rr:objectMap [ rml:reference "Address 2"]
];
rr:predicateObjectMap [
rr:predicate <http://users.ugent.be/~bjdmeest/function/grel.ttl#p_string_sep> ;
rr:object ', '
];
] ;
];
];
.
Generates following YARRRML
prefixes:
rr: 'http://www.w3.org/ns/r2rml#'
xsd: 'http://www.w3.org/2001/XMLSchema#'
rml: 'http://semweb.mmlab.be/ns/rml#'
ql: 'http://semweb.mmlab.be/ns/ql#'
rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
csvw: 'http://www.w3.org/ns/csvw#'
fnml: 'http://semweb.mmlab.be/ns/fnml#'
fno: 'https://w3id.org/function/ontology#'
foaf: 'http://xmlns.com/foaf/0.1/'
org: 'http://www.w3.org/2004/02/skos/core#'
rov: 'http://www.w3.org/ns/regorg#'
skos: 'http://www.w3.org/2004/02/skos/core#'
vcard: 'http://www.w3.org/2006/vcard/ns#'
locn: 'http://www.w3.org/ns/locn#'
mappings:
mapping1:
sources:
- [n3-0~csv]
s: site/$(No_)
po:
- [a, 'http://www.w3.org/2004/02/skos/core#Site']
- {p: 'locn:address', o: {pms: [['http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join', 'http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join'], ['http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join', $(Address)], ['http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join', 'http://users.ugent.be/~bjdmeest/function/grel.ttl#array_join']]}}
see all the locnäddress shenanigans :)