How to represent one-to-many and nested relationships
qzc438 opened this issue · 6 comments
Issue type: ❓ Question
As shown in the excel query-result.csv, I am asking how to represent one-to-many and nested relationships:
- AHU1A has two sub-equipment VAV2-3 and VAV2-4.
- VAV2-4 has one sensor VAV2-4.DPR and this sensor have a sub-sensor VAV2-4.DPRPOS.
See the example YARRRML below, does this answer your question?
prefixes:
ex: "http://example.com/"
idlab-fn: "http://example.com/idlab/function/"
grel: "http://users.ugent.be/~bjdmeest/function/grel.ttl#"
mappings:
Equipment:
sources:
- ['data.csv~csv']
s: http://example.com/equiment/$(Equipment)
po:
- [a, ex:Equipment]
- [ex:subEquipment, http://example.com/equiment/$(Sub-Equipment)~iri]
- [ex:hasSensor, http://example.com/sensor/$(Sensor)~iri]
Sensor:
sources:
- ['data.csv~csv']
s: http://example.com/sensor/$(Sensor)
po:
- [a, ex:Sensor]
- [ex:subSensor, http://example.com/sensor/$(Sub-Sensor)~iri]
Can I know how to deal with the blank nodes in the sample query-result.csv?
How do you mean? Empty values are by default seen as null values and thus skipped, conforming to the R2RML specification. Have you been able to try the example given above? In what way does its output not conform with your expectations?
If you look at Line 2 and 3 in my CSV, AHU1A appears twice because it links to VAV-3 and VAV4. Will it occur as a duplicate definition in [a, ex:Equipment]?
The resulting graph might contain duplicates, but mapping engines could filter out duplicates, see eg https://github.com/RMLio/rmlmapper-java#duplicate-removal-and-serialization-format.