CSIRO-enviro-informatics / pyldapi

A very small module to add Linked Data API functionality to a Python Flask installation
GNU General Public License v3.0
1 stars 0 forks source link

When listing each registry item, add `item a reg:RegistryItem` #8

Open ashleysommer opened 6 years ago

ashleysommer commented 6 years ago

In this cats registry example generated by pyldapi:

@prefix ereg: <https://promsns.org/def/eregistry#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix xhv: <https://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/id/cat/Jonny> a <http://127.0.0.1:8081/cats> ;
    rdfs:label "Jonny"^^xsd:string ;
    reg:register <http://127.0.0.1:8081/cats> .

<http://example.com/id/cat/Sally> a <http://127.0.0.1:8081/cats> ;
    rdfs:label "Sally"^^xsd:string ;
    reg:register <http://127.0.0.1:8081/cats> .

<http://example.com/id/cat/Spud> a <http://127.0.0.1:8081/cats> ;
    rdfs:label "Spud"^^xsd:string ;
    reg:register <http://127.0.0.1:8081/cats> .

<http://127.0.0.1:8081/cats?per_page=20&page=1> a ldp:Page ;
    ldp:pageOf <http://127.0.0.1:8081/cats> ;
    xhv:first <http://127.0.0.1:8081/cats?per_page=20&page=1> ;
    xhv:last <http://127.0.0.1:8081/cats?per_page=20&page=1> .

<http://127.0.0.1:8081/cats> a reg:Register ;
    rdfs:label "Reg1 Label"^^xsd:string ;
    reg:containedItemClass <http://example.com/Cat> ;
    rdfs:comment "Reg1 Comment"^^xsd:string .

It shows each cat ("Jonny", "Sally", and "Spud") as a <http://127.0.0.1:8081/cats> ; I believe this to be incorrect, because it uses that same string as register: reg:register <http://127.0.0.1:8081/cats> for each entry.

I believe it should be:

<http://example.com/id/cat/Spud> a reg:RegisterItem ;
    rdfs:label "Spud"^^xsd:string ;
    reg:register <http://127.0.0.1:8081/cats> .

See http://epimorphics.com/public/vocabulary/Registry.html

dr-shorthair commented 6 years ago

But do bear in mind that reg:RegisterItem is the registration record (submitter, date, status etc) and is not the item description (species, name, fur length etc). The latter is independent of the registration record, which is register-specific, since the same description might be submitted to more than one register. You use reg:definition to link from the RegisterItem to a blank node which has a property reg:entity that points to the registered thing.

dr-shorthair commented 6 years ago

Download examples from LDR with metadata to see the full pattern. The RegisterItem and registered thing each have their own URI - the default pattern in the LDR as implemented is for the RI URI to prepend a "_" to the last field of the item URI.

ashleysommer commented 6 years ago

Turns out I went in the wrong direction with this Issue. The item type should actually be what is captured in self.contained_item_classes, not self.uri. Created a new issue here: https://github.com/CSIRO-enviro-informatics/pyldapi/issues/12

ashleysommer commented 6 years ago

Moving forward with reg:RegisterItem, I believe we can use the new Accept-Profile mechanism to negotiate rendering a RI view, rather than the actual instances view.