kianschmalenbach / rdf-browser

A Firefox Add-on that requests RDF files and renders RDF files as Turtle documents with clickable links
MIT License
16 stars 6 forks source link

Add '@base' to turtle view #19

Closed MattesWhite closed 3 years ago

MattesWhite commented 3 years ago

In many cases URIs of an RDF graph are somewhat related to the retrieval address of the document. Maybe adding the retrieval URI as @base statement to the Turtle view RDF-browser provides could provide an easier to read result.

However, be aware of existing @base statements because additional @base statements are resolved against the pre set base URI (see Turtle specification)

Example

URL: http://two.rapidthings.eu:8000/devices/

# Current
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://two.rapidthings.eu:8000/devices/> rdf:type ldp:Container ,
                                                   ldp:Resource ;
                                          ldp:contains <http://two.rapidthings.eu:8000/devices/00cbb64c87ae/> ,
                                                       <http://two.rapidthings.eu:8000/devices/03d54cfc583a/> ,
                                                       <http://two.rapidthings.eu:8000/devices/060142be0a5f/> ,
                                                       <http://two.rapidthings.eu:8000/devices/1285d2352c84/> ,
                                                       <http://two.rapidthings.eu:8000/devices/147db0298ba6/> ,
                                                       <http://two.rapidthings.eu:8000/devices/186590d59222/> ,
                                                       <http://two.rapidthings.eu:8000/devices/19be0f22bfdd/> ,
                                                       <http://two.rapidthings.eu:8000/devices/1b5f35fb74d7/> ,
                                                       <http://two.rapidthings.eu:8000/devices/20cfa8a44455/> ,
                                                       <http://two.rapidthings.eu:8000/devices/22680d718f9a/> ,
                                                       # ...
# with @base
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@base <http://two.rapidthings.eu:8000/devices/> .

<> rdf:type ldp:Container ,
            ldp:Resource ;
   ldp:contains <00cbb64c87ae/> ,
                <03d54cfc583a/> ,
                <060142be0a5f/> ,
                <1285d2352c84/> ,
                <147db0298ba6/> ,
                <186590d59222/> ,
                <19be0f22bfdd/> ,
                <1b5f35fb74d7/> ,
                <20cfa8a44455/> ,
                <22680d718f9a/> ,
                # ...
kianschmalenbach commented 3 years ago

Hi, Thanks for your feedback. I just added this feature, it will be included in the next release.