Created
February 16, 2021 19:44
-
-
Save justin2004/de74e579eeba7f9140af01cf97c6c5bc to your computer and use it in GitHub Desktop.
rml on .csv with embedded newlines and embedded quotes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | firstname | lastname | hair | |
---|---|---|---|---|
0 | Ash | "Ketchum" | bla ck | |
1 | Misty | orange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<http://example.org/character/0> <http://dbpedia.org/ontology/hairColor> "bla\nck". | |
<http://example.org/character/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person>. | |
<http://example.org/character/0> <http://schema.org/givenName> "Ash". | |
<http://example.org/character/0> <http://schema.org/lastName> "\"Ketchum\"". | |
<http://example.org/character/1> <http://dbpedia.org/ontology/hairColor> "orange". | |
<http://example.org/character/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person>. | |
<http://example.org/character/1> <http://schema.org/givenName> "Misty". | |
<http://example.org/character/1> <http://schema.org/lastName> "". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix rml: <http://semweb.mmlab.be/ns/rml#> . | |
@prefix rr: <http://www.w3.org/ns/r2rml#> . | |
@prefix ql: <http://semweb.mmlab.be/ns/ql#> . | |
@prefix csvw: <http://www.w3.org/ns/csvw#> . | |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix : <http://example.org/rules/> . | |
@prefix schema: <http://schema.org/> . | |
@prefix dbo: <http://dbpedia.org/ontology/> . | |
:TriplesMap a rr:TriplesMap; | |
rml:logicalSource [ | |
rml:source [ | |
a csvw:Table; | |
csvw:url "characters.csv"; | |
csvw:dialect [ | |
a csvw:Dialect; | |
csvw:delimiter "," | |
] | |
]; | |
rml:referenceFormulation ql:CSV | |
]. | |
:TriplesMap rr:subjectMap [ | |
rr:template "http://example.org/character/{id}" | |
]. | |
:TriplesMap rr:predicateObjectMap [ | |
rr:predicate rdf:type; | |
rr:objectMap [ | |
rr:constant schema:Person | |
] | |
]. | |
:TriplesMap rr:predicateObjectMap [ | |
rr:predicate schema:givenName; | |
rr:objectMap [ | |
rml:reference "firstname" | |
] | |
]. | |
:TriplesMap rr:predicateObjectMap [ | |
rr:predicate schema:lastName; | |
rr:objectMap [ | |
rml:reference "lastname" | |
] | |
]. | |
:TriplesMap rr:predicateObjectMap [ | |
rr:predicate dbo:hairColor; | |
rr:objectMap [ | |
rml:reference "hair" | |
] | |
]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment