Hi! I'm attempting to translate a CSV file containing patient information into RDF-STAR format. I'm working with RDF-star to add metadata to my records, where it is necessary. I'm using the morph-kgc and pyoxigraph libraries, both of which support RDF-star.
My goal is to generate certain triples asserted and quoted, while others solely asserted.
The problem is that the materialization of triples only occurs successfully if I use "AssertedTriplesMap" for innerTriples and "TriplesMap" for outerTriples. This generate only quoted triples. If I use "AssertedTriplesMap" for both inner and outer triples, the total number of generated triples is zero.
Furthermore, when attempting to have T1, T2, T3 asserted and quoted, and T4, T5, T6 only asserted (by removing OUT4, OUT5, OUT6), only T1, T2, T3 are generated.
Could you help me understand if it is feasible or if there are errors in my code?
import morph_kgc
import pyoxigraph
graph = morph_kgc.materialize_oxigraph('D:/morph_kgc_code/config.ini')
output = open('D:/mimic-iii-1.4-nq/PATIENTS.nq', 'wb')
pyoxigraph.serialize(graph, output, "application/n-quads")
[DataSouce1]
mappings : D:/morph_kgc_code/patients_mapping.ttl
- This is the .ttl file (not working):
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix mimic: <http://mimic-translation-project.org/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/#term_>.
@base <http://mimic-translation-project.org/> .
<T1> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:gender;
rml:objectMap [
rml:reference "GENDER"
];
].
<T2> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:dob;
rml:objectMap [
rml:reference "DOB";
rr:datatype xsd:dateTime
];
].
<T3> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:dod;
rml:objectMap [
rml:reference "DOD";
rr:datatype xsd:dateTime
];
].
<T4> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:dodHosp;
rml:objectMap [
rml:reference "DOD_HOSP";
rr:datatype xsd:dateTime
];
].
<T5> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:dodSSN;
rml:objectMap [
rml:reference "DOD_SSN";
rr:datatype xsd:dateTime
];
].
<T6> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rr:template "http://mimic-translation-project.org/Patient/{SUBJECT_ID}"
];
rr:predicateObjectMap [
rr:predicate mimic:expireFlag;
rml:objectMap [
rml:reference "EXPIRE_FLAG";
rr:datatype xsd:boolean
];
].
<OUT1> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rml:quotedTriplesMap <T1>
];
rr:predicateObjectMap [
rr:predicate mimic:confidence ;
rml:objectMap [
rr:constant <http://purl.bioontology.org/ontology/SNOMEDCT/263495000>
]
].
<OUT2> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rml:quotedTriplesMap <T2>
];
rr:predicateObjectMap [
rr:predicate mimic:snomedPredicate ;
rml:objectMap [
rr:constant <http://purl.bioontology.org/ontology/SNOMEDCT/184099003>
]
].
<OUT3> a rml:AssertedTriplesMap;
rml:logicalSource [
rml:source "D:/mimic-iii-clinical-database-1.4/PATIENTS.csv/PATIENTS.csv";
rml:referenceFormulation rml:CSV
];
rml:subjectMap [
rml:quotedTriplesMap <T3>
];
rr:predicateObjectMap [
rr:predicate mimic:snomedPredicate ;
rml:objectMap [
rr:constant <http://purl.bioontology.org/ontology/SNOMEDCT/399753006>
]
].