Skip to content

preserve base on output #571

@VladimirAlexiev

Description

@VladimirAlexiev

SA works perfectly!

base         <https://cirpass.eu/thesauri/>
prefix xyz:  <http://sparql.xyz/facade-x/data/>
prefix fx:   <http://sparql.xyz/facade-x/ns/>
prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>

construct {
  $_thes_iri skos:member ?item.
  ?item a skos:Concept; skos:notation ?code; skos:prefLabel ?label.
}
where { service <x-sparql-anything:>
  { fx:properties fx:location $_location.
    ?row a xyz:Row;
      rdf:_1 [xyz:ColumnRef "code"; rdf:_1/rdf:_1 ?code];
      rdf:_2 [xyz:ColumnRef "EN";   rdf:_1/rdf:_1 ?label]
  }
  bind(iri(concat(str($_thes_iri),"/",?code)) as ?item)
}
  • and this command line:
sparql-anything -v location=eBIZ-NT11.xml -o eBIZ-NT11.ttl -v thes=inventory/reason/transport -q eBiz.rq

The only comlpaint I have is that the result uses full URLs:

<https://cirpass.eu/thesauri/inventory/reason/transport/FOC>
        rdf:type        skos:Concept;
        skos:notation   "FOC";
        skos:prefLabel  "free of charge" .

<https://cirpass.eu/thesauri/inventory/reason/transport>
        skos:member  <https://cirpass.eu/thesauri/inventory/reason/transport/WRK> , <https://cirpass.eu/thesauri/inventory/reason/transport/VEW> , <https://cirpass.eu/thesauri/inventory/reason/transport/STO> , <https://cirpass.eu/thesauri/inventory/reason/transport/SEL> , <https://cirpass.eu/thesauri/inventory/reason/transport/RJC> , <https://cirpass.eu/thesauri/inventory/reason/transport/NWK> , <https://cirpass.eu/thesauri/inventory/reason/transport/IST> , <https://cirpass.eu/thesauri/inventory/reason/transport/FWK> , <https://cirpass.eu/thesauri/inventory/reason/transport/FVW> , <https://cirpass.eu/thesauri/inventory/reason/transport/FST> , <https://cirpass.eu/thesauri/inventory/reason/transport/FRW> , <https://cirpass.eu/thesauri/inventory/reason/transport/FOC> .

https://tarql.github.io/ (also Jena based) has this option:

 --write-base           Write @base if output is Turtle

It allows the production of much shorter turtles. Unfortunately Tarql doesn't remember the base in the query, so one also needs to give

      --base                 Base IRI for resolving relative IRIs

Can SA remember the base and use it in the output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions