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 9 forks source link

How to construct graph object #138

Closed Spothedog1 closed 2 months ago

Spothedog1 commented 2 months ago

Say I have the following CSV:

id, title, geometry
1, 'feature 1', 'POLYGON(...)'
2, 'feature 2', 'POLYGON(...)'

I'm trying to turn this into a geosparql compatible graph. Each row in the CSV would have to look like:

ex:1
    a geo:Feature ;
    skos:prefLabel "feature 1" ;
    geo:hasGeometry [
        geo:asWKT "POLYGON(...)"^^geo:wktLiteral ;
    ] ;

The graph would look like

graph LR
    A((eg:1)) -->|rdf:type| B((geo:Feature))
    A -->|skos:prefLabel| C(("feature 1"))
    A -->|geo:hasGeometry| D((BlankNode))
    D -->|geo:asWKT| E(("POLYGON (...)"))

I'm stuck on how I would generate a blank node that points to the WKT

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix over: <http://overturemaps.org#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix geo: <http://www.opengis.net/ont/geosparql#> .
@prefix ex: <http://example.org/#> .

<feature> a rml:TriplesMap;

    rml:logicalSource [
        a rml:LogicalSource;
        rr:sqlVersion rr:SQL2008;
    ];

    rml:subjectMap [
        rml:template "http://example.org/#{id}" ;
        rml:class geo:Feature;
    ];

    rml:predicateObjectMap [
        rml:predicate skos:prefLabel ;
        rml:objectMap [ rml:reference "title" ]
    ];

    rr:predicateObjectMap [
        rr:predicate geo:hasGeometry;
        rr:objectMap [
#.           TODO: How would this work?
#            rr:parentTriplesMap <#GeometryMap>
          rml:termType: rml:BlankNode
        ]
    ]
.

How would I generate the triple?

<blank_node from objectMap> geo:asWKT "POLYGON(...)"^^geo:wktLiteral ;

dachafra commented 2 months ago

Sorry, this is not an issue for the spec. it's a question about how to do things. Please, open it in the proper repository (rml-questions --> discussions)

Spothedog1 commented 2 months ago

Ok will do, haven't seen a separate repo for Discussions only before so didn't know where to put it.