kg-construct / rml-core

RML-Core: Main features for RDF generation with RML
https://w3id.org/rml/core/spec
Creative Commons Attribution 4.0 International
12 stars 8 forks source link

capture a piece of JSON/XML as a literal #126

Open VladimirAlexiev opened 3 months ago

VladimirAlexiev commented 3 months ago

An important case in GeoSPARQL is to capture fragments of the input XML (GML) or JSON (GeoJSON) as literals with custom datatypes: geo:gmlLiteral, geo:geoJSONLiteral. This happens when converting eg GML, CityGML; and JSON-FG, CityJSON to RDF.

I think this is easy with RML, but I just want to be sure. Is it possible to add test cases for it?

I faced that problem recently, so I wrote some issues for different tools:

DylanVanAssche commented 3 weeks ago

Hi @VladimirAlexiev !

I had a look at this issue and I also think it will just work because you can specify the data type with rml:datatype in the mapping. Then you use a rml:reference to capture the part of the file you want as Literal.

However, I'm a bit puzzled how it looks exactly if we want to add a test case for it. Do you have an example of input and expected RDF output? The referenced issues give only a faulty output as an example. I tried to reconstruct from those what you want, but please confirm or give another example:

INPUT

<plu:geometry>
        <gml:Polygon srsName="http://www.opengis.net/def/crs/EPSG/0/25833" srsDimension="2">
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>385919.31860777 5824690.697477636 ...</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </plu:geometry>

OUTPUT

<ex:somethign> <ex:polygon> <gml:Polygon srsName=\"http://www.opengis.net/def/crs/EPSG/0/25833\" srsDimension=\"2\">\n                   <gml:exterior>\n                        <gml:LinearRing>\n                            <gml:posList>385919.31860777 5824690.697477636</gml:posList>\n                        </gml:LinearRing>\n                    </gml:exterior>\n                </gml:Polygon>\n            " ^^geo:gmlLiteral;

Moreover, this is RML-Core thing as we only deal in RML-IO with access to Sources and Targets, I moved this issue to the right repository.

dachafra commented 1 week ago

However, I'm a bit puzzled how it looks exactly if we want to add a test case for it. Do you have an example of input and expected RDF output? The referenced issues give only a faulty output as an example.

@VladimirAlexiev could you help us to define this test-case?