UKGovLD / ukl-registry-poc

Workspace for design of UKGovLD registry proof-of-concept
Apache License 2.0
17 stars 2 forks source link

Trying, and failing, to use Graph registration extension #77

Closed 6a6d74 closed 11 years ago

6a6d74 commented 11 years ago

I am trying to register an Ontology (defined using #-URIs) as a complete graph using the instructions defined here: https://github.com/der/ukl-registry-poc/wiki/Extensions#graph-registration

However, although the server response is what I expect on HTTP PUT, the Registry API, nor the underlying triple store (as verified with a SPARQL query), seem to have any record of the object properties and classes defined in the ontology.

My target register is http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3

Also - does the graph update work with the bootstrap when initially configuring the Registry?


Command line PUT:

curl -i -b cookie-jar -c cookie-jar -H "Content-type:text/turtle" -H "Accept:text/plain" -X PUT --data "@bufr4-core.ttl" http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core?graph

Server response:

HTTP/1.1 100 Continue

HTTP/1.1 201 Created
Server: nginx/1.2.9
Date: Tue, 23 Jul 2013 19:26:19 GMT
Content-Length: 0
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/_core 

file payload (bufr4-core.ttl):

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix qudt: <http://qudt.org/schema/qudt#> .

@prefix bufr4-core: <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core#> .

<http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> a owl:Ontology;
    rdfs:label "WMO No. 306 Vol I.2 FM 94 BUFR code-table structure and metadata ontology"@en;
    rdfs:comment "Ontology for describing structure and domain-specific metadata for WMO No. 306 Vol I.2 FM 94 BUFR code-tables."@en;
    dc:creator "Jeremy Tandy";
    dc:date "2013-03-26"^^xsd:date;
    owl:versionInfo "0.1";
    # For documentation tools
    dc:description "Ontology for describing structure and domain-specific metadata for WMO No. 306 Vol I.2 FM 94 BUFR code-tables. Derived from pre-assigned terms from WMO Secretariat in legacy publications of the WMO code-tables."@en; 
    .
bufr4-core:No a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "No"@en; 
    rdfs:comment "Line number within WMO code-table publication."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range xsd:integer; 
    .
bufr4-core:FXY a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "FXY"@en; 
    rdfs:comment "6-digit BUFR descriptor for Element (from Table B) or Operator (from Table C)."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range xsd:string;
    .
bufr4-core:Status a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Status"@en; 
    rdfs:comment "Used in BUFR code-tables to indicate the status of the associated term with respect to usage in WMO No. 306 Vol I.2 FM 94 BUFR products."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range bufr4-core:StatusType;
    .
bufr4-core:StatusType a owl:Class; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Status (class)"@en; 
    rdfs:comment "Open set of status codes for describing code-table entries with respect to their usage in WMO No. 306 Vol I.2 FM 94 BUFR."@en; 
    rdfs:subClassOf skos:Concept;
    .
bufr4-core:StatusScheme a skos:ConceptScheme; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Status Scheme"@en; 
    rdfs:comment "Concept scheme containing status codes for describing code-table entries with respect to their usage in WMO No. 306 Vol I.2 FM 94 BUFR."@en;
    .
bufr4-core:statusValidation a skos:Concept, bufr4-core:StatusType; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    skos:prefLabel "Validation"@en; 
    rdfs:comment "A code-table entry that may only be used for validation purposes within WMO No. 306 Vol I.2 FM 94 BUFR products - it is prohibited to use this code-table entry in operational products."@en; 
    skos:topConceptOf bufr4-core:StatusScheme; 
    .  
bufr4-core:statusOperational a skos:Concept, bufr4-core:StatusType; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    skos:prefLabel "Operational"@en; 
    rdfs:comment "A code-table entry that may be used within operational WMO No. 306 Vol I.2 FM 94 BUFR products."@en; 
    skos:topConceptOf bufr4-core:StatusScheme;
    .
bufr4-core:BUFR_DataWidth_Bits a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Data width (bits)"@en; 
    rdfs:comment "Number of bits that are used when encoding the value of the BUFR Table B Element in WMO No. 306 Vol I.2 FM 94 BUFR."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range xsd:integer; 
    .
bufr4-core:BUFR_ReferenceValue a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Reference value"@en; 
    rdfs:comment "Reference value used when encoding the value of the BUFR Table B Element in WMO No. 306 Vol I.2 FM 94 BUFR."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range xsd:integer; 
    .
bufr4-core:BUFR_Scale a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Scale"@en; 
    rdfs:comment "Scale factor used when encoding the value of the BUFR Table B Element in WMO No. 306 Vol I.2 FM 94 BUFR."@en; 
    rdfs:domain reg:RegisterItem; 
    rdfs:range xsd:integer; 
    .
bufr4-core:BUFR_Unit a owl:ObjectProperty; 
    rdfs:isDefinedBy <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core> ;
    rdfs:label "Unit of measure"@en; 
    rdfs:comment "Unit (or equivalent concept) used when encoding the value of the BUFR Table B Element in WMO No. 306 Vol I.2 FM 94 BUFR."@en; 
    rdfs:domain reg:RegisterItem; 
    .
der commented 11 years ago

That was a devious one to track down, fortunately you gave an impressively precise report.

Short answer: use --data-binary curl option

Longer answer: I checked the logs on the server I could see a successful graph register and could see the file copy of the received payload the the payload only included a small part of the data:

@prefix dc:      <http://purl.org/dc/elements/1.1/> .
@prefix bufr4-core:  <http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dct:     <http://purl.org/dc/terms/> .
@prefix reg:     <http://purl.org/linked-data/registry#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix skos:    <http://www.w3.org/2004/02/skos/core#> .
@prefix qudt:    <http://qudt.org/schema/qudt#> .

<http://ukgovld-registry.dnsalias.net/codes/bufr4/schema3/core>
      a       owl:Ontology ;
      rdfs:comment "Ontology for describing structure and domain-specific metadata for WMO No. 306 Vol I.2 FM 94 BUFR code-tables."@en ;
      rdfs:label "WMO No. 306 Vol I.2 FM 94 BUFR code-table structure and metadata ontology"@en ;
      dc:creator "Jeremy Tandy" ;
      dc:date "2013-03-26"^^xsd:date ;
      owl:versionInfo "0.1" .

Same effect happened on a local copy yet using a test ontology my own everything was OK.

The problem is that curl's --data option does not preserve line endings in the data. You have a comment line part way through the ontology definition. So when the lines are wrapped together by curl the the comment hides 90% of the file. The turtle parser seems to be forgiving to not seeing a clean termination of the resource.

Using exactly the same command line on your data but with --data-binary instead of --data worked locally.

Not tried it on the ukgovld server, I'll let you do that.

der commented 11 years ago

And no, the bootstrap doesn't support graph registration so you would have to do a post-boot script to load in graphs like this.

6a6d74 commented 11 years ago

Many thanks. I will test this out on ukgovld-registry.dnsalias.net.

Also thanks for note about boot script.

6a6d74 commented 11 years ago

The upload works once the 'data-binary' switch is used. However, the HTML renderer only displays the statements about the ontology object itself. Using the '?_format=ttl' qualifier provides the entire graph.

I guess that fixes to the HTML renderer need to wait until an enhancement package?

6a6d74 commented 11 years ago

Given the html rendering problem I have reverted to using /-pattern URIs for the embedded ontologies I need. This works fine, but the html rendering should be fixed in the longer term.

6a6d74 commented 11 years ago

New issue raised. Closing this one.