yarrrml-parser icon indicating copy to clipboard operation
yarrrml-parser copied to clipboard

Example with deeper data

Open hoijui opened this issue 5 years ago • 2 comments

Could you maybe provide an example with a "deeper" data structure? The three examples available in Matey all use the same structure - one key containig a list/array of values composed of a list of simple key-value pairs, like so:

{
    "persons": [
        {
            "firstname": "John",
            "lastname": "Doe"
        },
        {
            "firstname": "Jane",
            "lastname": "Smith"
        },
        {
            "firstname": "Sarah",
            "lastname": "Bladinck"
        }
    ]
}

I am failing to map something like this though:

{
    "modules": [
        {
            "name": "wings",
            "license": "GPL 3",
            "authors": [
                {
                    "firstname": "John",
                    "lastname": "Dafoe"
                },
                {
                    "firstname": "Jane",
                    "lastname": "Dafoe"
                }
            ]
        },
        {
            "name": "rudder",
            "license": "GPL 2",
            "authors": [
                {
                    "firstname": "John",
                    "lastname": "Dafoe"
                }
            ]
        },
        {
            "name": "main body",
            "license": "LGPL 2",
            "authors": [
                {
                    "firstname": "Jane",
                    "lastname": "Dafoe"
                }
            ]
        }
    ]
}

hoijui avatar Oct 10 '20 09:10 hoijui

Hi @hoijui

What is the output that you like to have from your example?

pheyvaer avatar Oct 28 '20 08:10 pheyvaer

  • 2 author individuals
  • 3 module individuals
  • the 3 modules linked to the corresponding author individuals

by now I gave up on YARRRML and RML though, and moved to Python, using a YAML and an RDF library. the total code length is not much more, it is much easier to understand and modify, more widely usable (more people know Python then YARRRML), it is more powerful, and instead of days, stretched over weeks, trying to get what I want, it took me less then 3h to get it done from scratch.

I will always do it this way from now on.

As I understood, for RML/YARRRML to work, the initial data needs to be in a kind of relational DB format, where stuff is basically divided into flat tables, linked to each other through primary- and foreign-keys. I wish this was clearly communicated at the very beginning on all the homepages main screens and in the first few lines of the README's and so on. would have saved me a lot of life-time.

sorry.. sounds all a bit negative now... of course it is my own fault too, for not realizing this for so long, and I am sure that there are a lot of scenarios where your approach is useful.

hoijui avatar Oct 28 '20 17:10 hoijui