Informasjonsforvaltning / datacatalogtordf

A library that will map a data catalog (inkl dataset, dataservices and other dcat resources) to rdf
Apache License 2.0
5 stars 1 forks source link

Add support for assigning a link to spatital_coverage. #28

Closed stigbd closed 3 years ago

stigbd commented 3 years ago

Shoud behave as illustrated in the following:

    dataset = Dataset()
    dataset.identifier = "http://example.com/datasets/1"
    # Add link to location:
    location = "http://publications.europa.eu/resource/authority/country/NOR"
    dataset.spatial_coverage = location

    src = """
    @prefix dct: <http://purl.org/dc/terms/> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix dcat: <http://www.w3.org/ns/dcat#> .
    @prefix geosparql: <http://www.opengis.net/ont/geosparql#> .

    <http://example.com/datasets/1> a dcat:Dataset ;
        dct:spatial <http://publications.europa.eu/resource/authority/country/NOR> ;
    .
    """
    g1 = Graph().parse(data=dataset.to_rdf(), format="turtle")
    g2 = Graph().parse(data=src, format="turtle")

    assert isomorphic(g1, g2)