metarelate / metOcean-mapping

GNU Lesser General Public License v3.0
1 stars 6 forks source link

Export TDB Changes to TTL from Mapping-Manager (F) #7

Closed wizardstoy closed 11 years ago

wizardstoy commented 11 years ago

Possible handle session-save TTL files from mapping-manager [metarelate/mapping-manager#10].

This is dependent upon [#4].

None

The key point will be to hold the start time of the session and use the date stamp upon the Linkage shards to determine what Linkage (thus what Mapping) shards have changed during the session and to prompt the user if there are any unsaved changes before the session expires or is closed. The changed shards will be written out to a file named by the MD5 sum of its contents and can be merged/loaded upon start of the next session.

wizardstoy commented 11 years ago

Update:

Using a command-line query such as:

$JENAROOT/bin/tdbquery --loc=<location of triple store> --query=<query_file> --results=text > output.ttl

where is similar to the following (and here using 'hasOwner' as the unique identifier of a Provenance shard and 'origin' as the identifier for Linkage shards):

PREFIX cf: <http://cf-pcmdi.llnl.gov/documents/>
PREFIX fcode: <http://www-hc/~umdoc/pp_package_ibm_docs/fcodes/>
PREFIX iso19135: <http://reference.metoffice.gov.uk/data/wmo/def/iso19135/>
PREFIX link: <http://www.metarelate.net/metOcean/linkage/>
PREFIX map: <http://www.metarelate.net/metOcean/mapping/>
PREFIX metExtra: <http://reference.metoffice.gov.uk/data/wmo/def/met/>
PREFIX mof: <http://reference.metoffice.gov.uk/data/fieldcode/>
PREFIX mon: <http://reference.metoffice.gov.uk/data/none/>
PREFIX mos: <http://reference.metoffice.gov.uk/data/stash/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT
{
    ?s ?p ?o .
}
WHERE
{
?s ?p ?o ;
    (metExtra:hasOwner|metextra:origin) ?own .
}

which produces data of the form:

# ======== CONSTRUCT results 
@prefix mof:     <http://reference.metoffice.gov.uk/data/fieldcode/> .
@prefix link:    <http://www.metarelate.net/metOcean/linkage/> .
@prefix mon:     <http://reference.metoffice.gov.uk/data/none/> .
@prefix iso19135:  <http://reference.metoffice.gov.uk/data/wmo/def/iso19135/> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix mos:     <http://reference.metoffice.gov.uk/data/stash/> .
@prefix map:     <http://www.metarelate.net/metOcean/mapping/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix metExtra:  <http://reference.metoffice.gov.uk/data/wmo/def/met/> .
@prefix fcode:   <http://www-hc/~umdoc/pp_package_ibm_docs/fcodes/> .
@prefix cf:      <http://cf-pcmdi.llnl.gov/documents/> .
@prefix skos:    <http://www.w3.org/2004/02/skos/core#> .

<http://www.metarelate.net/metOcean/linkage/4f777478c4664a725caf6e82f2ab01f1>
      rdf:type      iso19135:RegisterItem ;
      cf:name       mon:none ;
      cf:units      "None" ;
      metExtra:long_name  "None" ;
      metExtra:origin  <http://reference.metoffice.gov.uk/data/stash/m01s00i358/vn7.2> .

map:d17eaccd0d549fd25835559b7692cd39
      rdf:type      iso19135:RegisterItem ;
      metExtra:hasComment
                    "None" ;
      metExtra:hasEditor  "None" ;
      metExtra:hasLastEdit
                    "2012-09-20T15:30:13.498404"^^xsd:dateTime ;
      metExtra:hasOwner  "None" ;
      metExtra:hasPrevious
                    "None" ;
      metExtra:hasReason  "Initial load" ;
      metExtra:hasStatus  "Draft" ;
      metExtra:hasWatcher
                    "None" ;
      metExtra:link  <http://www.metarelate.net/metOcean/linkage/28d8fba7b7b4af1028a1cd9905f7976c> .
wizardstoy commented 11 years ago

Latest capture on workflow and implementation:

1) Upon edit of a Shard, insert an attribute into the Shard such as ':hasBeenEdited' 2) Within the query_file, mentioned above,

This would look something like:

CONSTRUCT
{
    ?s ?p ?o .
    ?s metExtra:hasBeenSaved "True" .
}
WHERE
{
?s ?p ?o ;
    metExtra:hasBeenEdited ?edit .
    MINUS{ ?s metExtra:hasBeenSaved ?saved . }
}
marqh commented 11 years ago

the pull request https://github.com/metarelate/metOcean-mapping/pull/13

has a bug, in that the saveCache flag persists into the saved turtle. This should be fixed before this ticket is closed.

marqh commented 11 years ago

this issue is now fixed