RMLio / RML-Mapper

Generate High Quality Linked Data from multiple originally (semi-)structured data (legacy)
http://RML.io
52 stars 20 forks source link

Is it possible to do following transformation? #11

Open m1ci opened 7 years ago

m1ci commented 7 years ago

Hi, is it possible to do the following transformation in RML?

Input:

      "properties": [
        {
          "type": "X-signup",
          "url": "https://www.weatherbit.io/"
        },
        {
          "type": "Swagger",
          "url": "https://www.weatherbit.io/static/swagger.json"
        },
        {
          "type": "X-blog",
          "url": "https://www.weatherbit.io/blog"
        }
      ],

Output

ex:resource1 exo:x-signup <https://www.weatherbit.io/>
ex:resource1 exo:swagger <https://www.weatherbit.io/static/swagger.json>
ex:resource1 exo:x-blog <https://www.weatherbit.io/blog>

Thanks!

andimou commented 7 years ago

@m1ci yes but for the RDF term that generates the URL do not forget to define the term type to be an IRI, i.e. [ ] rml:reference "uri" ; rr:termType rr:IRI

and that's because rr:column/rml:reference generate rr:Literal by default, whereas rr:template generates an rr:IRI. If one wants to "overwrite" the default, its rr:termType is required to be specified.

radmirusmanov commented 7 years ago

Hi, For the above example I have the following code in RML:

<#ApisMapping>

    rml:logicalSource [
        rml:source "data/apis/apis.json";
        rml:referenceFormulation ql:JSONPath;
        rml:iterator "$.data";
    ];

    rr:subjectMap [
           rr:constant ex:resource1;
               rr:class semapi:WebAPI
        ];

    rr:predicateObjectMap [

            rr:predicateMap [
                        rr:template "http://example.com/tmp/{$.properties[*].type}"
                ];

                rr:objectMap [
                        rml:reference "$.properties[*].url";
                        rr:termType rr:IRI
        ]
    ]

and I get the following output:

ex:resource1 <http://example.com/tmp/X-signup> <https://www.weatherbit.io/> , <https://www.weatherbit.io/static/swagger.json> , <https://www.weatherbit.io/blog>;

Is it possible to iterate through predicates? If yes, can you provide an example?

Thanks!

canarvaeza commented 6 years ago

Hi,

Did you solve this?, I have the same problem and making a work around (changing my jsons structure) to make it work