RMLio / yarrrml-parser

A YARRRML parser library and CLI in Javascript
MIT License
44 stars 17 forks source link

How to represent one-to-many and nested relationships #179

Open qzc438 opened 2 years ago

qzc438 commented 2 years ago

Issue type: :question: Question

As shown in the excel query-result.csv, I am asking how to represent one-to-many and nested relationships:

  1. AHU1A has two sub-equipment VAV2-3 and VAV2-4.
  2. VAV2-4 has one sensor VAV2-4.DPR and this sensor have a sub-sensor VAV2-4.DPRPOS.
bjdmeest commented 2 years ago

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]
qzc438 commented 2 years ago

Can I know how to deal with the blank nodes in the sample query-result.csv?

bjdmeest commented 2 years ago

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?

qzc438 commented 2 years ago

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]?

bjdmeest commented 2 years ago

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.

qzc438 commented 2 years ago

Hi Ben,

This makes sense to me. Let me try and get back to you.

Sincerely, Zhangcheng Qiang

On Wed, 16 Nov 2022 at 20:44, Ben De Meester @.***> wrote:

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 .

— Reply to this email directly, view it on GitHub https://github.com/RMLio/yarrrml-parser/issues/179#issuecomment-1316699804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVDZBA3ZYHHLRYHMMF3DDDWISUJJANCNFSM6AAAAAARNUKZOQ . You are receiving this because you authored the thread.Message ID: @.***>