Skip to content

TNPD2 Update with addition

Paolo Ciccarese edited this page Jan 9, 2015 · 1 revision

The following is used to test the update when an annotation set of Domeo happening when a new annotation is added to the set.

Creation of first highlight

curl -i -X POST http://localhost:8090/s/annotationset -H "Content-Type: application/json" \
-d'{"apiKey":"164bb0e0-248f-11e4-8c21-0800200c9a66","outCmd":"frame","set":{"@type":"http://purl.org/annotopia#AnnotationSet","@context":"https://raw.githubusercontent.com/Annotopia/AtSmartStorage/master/web-app/data/AnnotopiaContext.json","@id":"urn:domeoclient:uuid:13CBA122-F5AC-4089-85AF-1C2B2E780EA3","domeo_temp_localId":"2","serializedBy":"urn:application:domeo","createdBy":{"@id":"urn:person:uuid:8a70347a4096d318014096d369480000","@type":"foaf:Person","label":"Dr. John Doe","name":"Dr. John Doe","email":"admin@commonsemantics.org","firstname":"John","lastname":"Doe","picture":"http://www.hcklab.org/images/me/paolo%20ciccarese-boston.jpg"},"createdAt":"2015-01-08T13:52:05-0500","createdWith":{"@id":"urn:domeo:software:id:Domeo-2.0alpha-030","@type":"prov:Software","label":"Domeo Annotation Toolkit","name":"Domeo Annotation Toolkit","version":"2.0alpha"},"label":"Default Set","description":"The default set is created automatically by Domeo when no other set is existing.","lineageUri":"","version":"","previousVersion":"","deleted":"false","annotations":[{"@type":"oa:Annotation","serializedBy":"urn:application:domeo","motivatedBy":"oa:highlighting","@id":"urn:domeoclient:uuid:1997D535-8038-4061-BE1F-BC171B00259D","domeo_temp_localId":"3","annotatedBy":{"@id":"urn:person:uuid:8a70347a4096d318014096d369480000","@type":"foaf:Person","label":"Dr. John Doe","name":"Dr. John Doe","email":"admin@commonsemantics.org","firstname":"John","lastname":"Doe","picture":"http://www.hcklab.org/images/me/paolo%20ciccarese-boston.jpg"},"annotatedAt":"2015-01-08T13:52:05-0500","createdWith":{"@id":"urn:domeo:software:id:Domeo-2.0alpha-030","@type":"prov:Software","label":"Domeo Annotation Toolkit","name":"Domeo Annotation Toolkit","version":"2.0alpha"},"hasChanged":"true","lastUpdateOn":"","label":"Highlight","lineageUri":"","versionNumber":"","previousVersion":"","domeo_temp_hasChanged":"true","domeo_temp_saveAsNewVersion":"true","hasTarget":[{"@id":"urn:domeoclient:uuid:0927B5DE-3D3F-4F07-9D12-6D994234C184","@type":"oa:SpecificResource","hasSource":{"@id":"http://www.ncbi.nlm.nih.gov/gene/6606","@type":"dctypes:Text","format":"text/html"},"hasSelector":{"@type":"oa:TextQuoteSelector","exact":"Metazoa","prefix":"Eukaryota; ","suffix":"; Chordata; Craniata; \nVertebrata; Euteleostomi; Mammalia; Eutheria; Euarchontoglires; \nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"}}]}]}}'

The server will mint URIs for the entities involved and will return a message similar to this:

{
...
"@graph" : [ {
    "@id" : "http://localhost:8090/s/annotationset/726C538D-B43E-4054-BE27-3FAD59AA619E",
    "@type" : "at:AnnotationSet",
    "annotations" : {
      "@id" : "http://localhost:8090/s/annotation/3366F9DE-FD61-45F1-B0AE-FA6C8B954F3B",
      "@type" : "oa:Annotation",
      "createdWith" : {
        "@id" : "urn:domeo:software:id:Domeo-2.0alpha-030",
        "@type" : "prov:Software",
        "version" : "2.0alpha",
        "label" : "Domeo Annotation Toolkit",
        "name" : "Domeo Annotation Toolkit"
      },
      "lastUpdateOn" : "2015-01-09T10:10:50-0500",
      "previousVersion" : "urn:domeoclient:uuid:1997D535-8038-4061-BE1F-BC171B00259D",
      "label" : "Highlight",
      "annotatedAt" : "2015-01-08T13:52:05-0500",
      "annotatedBy" : "urn:person:uuid:8a70347a4096d318014096d369480000",
      "hasBody" : null,
      "hasTarget" : {
        "@id" : "http://localhost:8090/s/resource/7080F33F-02C3-4700-B976-344AA7DE85EB",
        "@type" : "oa:SpecificResource",
        "previousVersion" : "urn:domeoclient:uuid:0927B5DE-3D3F-4F07-9D12-6D994234C184",
        "hasSelector" : {
          "@id" : "_:b0",
          "@type" : "oa:TextQuoteSelector",
          "exact" : "Metazoa",
          "prefix" : "Eukaryota; ",
          "suffix" : "; Chordata; Craniata; \nVertebrata; Euteleostomi; Mammalia; Eutheria; Euarchontoglires; \nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"
        },
        "hasSource" : {
          "@id" : "http://www.ncbi.nlm.nih.gov/gene/6606",
          "@type" : "dctypes:Text",
          "format" : "text/html"
        }
      },
      "motivatedBy" : "oa:highlighting",
      "serializedBy" : "urn:application:domeo"
    },
    "description" : "The default set is created automatically by Domeo when no other set is existing.",
    "createdAt" : "2015-01-08T13:52:05-0500",
    "createdBy" : {
      "@id" : "urn:person:uuid:8a70347a4096d318014096d369480000",
      "@type" : "foaf:Person",
      "label" : "Dr. John Doe",
      "name" : "Dr. John Doe"
    },
    "createdWith" : "urn:domeo:software:id:Domeo-2.0alpha-030",
    "lastUpdateOn" : "2015-01-09T10:10:50-0500",
    "previousVersion" : "urn:domeoclient:uuid:13CBA122-F5AC-4089-85AF-1C2B2E780EA3",
    "version" : "1",
    "label" : "Default Set",
    "serializedBy" : "urn:application:domeo"
  } ]
}]}}

From such message we pick the @graph.@id which correspond to the URI minted for the Annotation Set:

http://localhost:8090/s/annotationset/726C538D-B43E-4054-BE27-3FAD59AA619E

And we use it to compose the following message that consists in a PUT for updating the set.

Update with a second highlight

curl -i -X PUT http://localhost:8090/s/annotationset -H "Content-Type: application/json" \
-d'{"apiKey":"164bb0e0-248f-11e4-8c21-0800200c9a66","outCmd":"frame","set":{"@type":"http://purl.org/annotopia#AnnotationSet","@context":"https://raw.githubusercontent.com/Annotopia/AtSmartStorage/master/web-app/data/AnnotopiaContext.json","@id":"http://localhost:8090/s/annotationset/726C538D-B43E-4054-BE27-3FAD59AA619E","domeo_temp_localId":"1","serializedBy":"urn:application:domeo","createdBy":{"@id":"urn:person:uuid:8a70347a4096d318014096d369480000","@type":"foaf:Person","label":"Dr. John Doe","name":"Dr. John Doe"},"createdAt":"2015-01-08T13:52:05-0500","createdWith":{"@id":"urn:domeo:software:id:Domeo-2.0alpha-030","@type":"prov:Software","label":"Domeo Annotation Toolkit","name":"Domeo Annotation Toolkit","version":""},"lastUpdateOn":"2015-01-08T13:52:08-0500","label":"Default Set","description":"The default set is created automatically by Domeo when no other set is existing.","lineageUri":"http://localhost:8090/s/annotationset/AD93719A-4828-4726-B0A8-5BF014495EB3","version":"1","previousVersion":"urn:domeoclient:uuid:13CBA122-F5AC-4089-85AF-1C2B2E780EA3","deleted":"false","annotations":[{"@type":"oa:Annotation","serializedBy":"urn:application:domeo","motivatedBy":"oa:highlighting","@id":"http://localhost:8090/s/annotation/4AFF21C1-A524-4DF3-893F-04794D6ACF4F","domeo_temp_localId":"3","annotatedBy":{"@id":"urn:person:uuid:8a70347a4096d318014096d369480000","@type":"foaf:Person","label":"Dr. John Doe","name":"Dr. John Doe"},"annotatedAt":"2015-01-08T13:52:05-0500","createdWith":{"@id":"urn:domeo:software:id:Domeo-2.0alpha-030","@type":"prov:Software","label":"Domeo Annotation Toolkit","name":"Domeo Annotation Toolkit","version":""},"hasChanged":"true","lastUpdateOn":"2015-01-08T13:52:08-0500","label":"Highlight","lineageUri":"","versionNumber":"","previousVersion":"urn:domeoclient:uuid:1997D535-8038-4061-BE1F-BC171B00259D","domeo_temp_hasChanged":"true","domeo_temp_saveAsNewVersion":"true","hasTarget":[{"@id":"http://localhost:8090/s/resource/E50F5911-6009-4FC5-8104-E13D8FE7DA14","@type":"oa:SpecificResource","hasSource":{"@id":"http://www.ncbi.nlm.nih.gov/gene/6606","@type":"dctypes:Text","format":"text/html"},"hasSelector":{"@type":"oa:TextQuoteSelector","exact":"Metazoa","prefix":"Eukaryota; ","suffix":"; Chordata; Craniata; \\nVertebrata; Euteleostomi; Mammalia; Eutheria; Euarchontoglires; \\nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"}}]},{"@type":"oa:Annotation","serializedBy":"urn:application:domeo","motivatedBy":"oa:highlighting","@id":"urn:domeoclient:uuid:020A07E0-31A5-414B-BA4E-79E31C0B2E79","domeo_temp_localId":"5","annotatedBy":{"@id":"urn:person:uuid:8a70347a4096d318014096d369480000","@type":"foaf:Person","label":"Dr. John Doe","name":"Dr. John Doe","email":"admin@commonsemantics.org","firstname":"John","lastname":"Doe","picture":"http://www.hcklab.org/images/me/paolo%20ciccarese-boston.jpg"},"annotatedAt":"2015-01-08T13:53:41-0500","createdWith":{"@id":"urn:domeo:software:id:Domeo-2.0alpha-030","@type":"prov:Software","label":"Domeo Annotation Toolkit","name":"Domeo Annotation Toolkit","version":"2.0alpha"},"hasChanged":"true","lastUpdateOn":"","label":"Highlight","lineageUri":"","versionNumber":"","previousVersion":"","domeo_temp_hasChanged":"true","domeo_temp_saveAsNewVersion":"true","hasTarget":[{"@id":"urn:domeoclient:uuid:071ED4C7-0149-4C26-A986-6A43081E39A1","@type":"oa:SpecificResource","hasSource":{"@id":"http://www.ncbi.nlm.nih.gov/gene/6606","@type":"dctypes:Text","format":"text/html"},"hasSelector":{"@type":"oa:TextQuoteSelector","exact":"Euteleostomi","prefix":"; Chordata; Craniata; \nVertebrata; ","suffix":"; Mammalia; Eutheria; Euarchontoglires; \nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"}}]}]}}'

Which will returns something like

{
   ...
  "@graph" : [ {
    "@id" : "http://localhost:8090/s/annotationset/726C538D-B43E-4054-BE27-3FAD59AA619E",
    "@type" : "at:AnnotationSet",
    "annotations" : [ {
      "@id" : "http://localhost:8090/s/annotation/C95DBE00-F1CE-43A8-AA9F-63C4434B8176",
      "@type" : "oa:Annotation",
      "createdWith" : {
        "@id" : "urn:domeo:software:id:Domeo-2.0alpha-030",
        "@type" : "prov:Software",
        "version" : [ "2.0alpha", "" ],
        "label" : "Domeo Annotation Toolkit",
        "name" : "Domeo Annotation Toolkit"
      },
      "lastUpdateOn" : "2015-01-09T10:16:47-0500",
      "previousVersion" : "urn:domeoclient:uuid:020A07E0-31A5-414B-BA4E-79E31C0B2E79",
      "label" : "Highlight",
      "annotatedAt" : "2015-01-08T13:53:41-0500",
      "annotatedBy" : "urn:person:uuid:8a70347a4096d318014096d369480000",
      "hasBody" : null,
      "hasTarget" : {
        "@id" : "http://localhost:8090/s/resource/C108DF99-1590-4910-BB72-CB20375F2769",
        "@type" : "oa:SpecificResource",
        "previousVersion" : "urn:domeoclient:uuid:071ED4C7-0149-4C26-A986-6A43081E39A1",
        "hasSelector" : {
          "@id" : "_:b1",
          "@type" : "oa:TextQuoteSelector",
          "exact" : "Euteleostomi",
          "prefix" : "; Chordata; Craniata; \nVertebrata; ",
          "suffix" : "; Mammalia; Eutheria; Euarchontoglires; \nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"
        },
        "hasSource" : {
          "@id" : "http://www.ncbi.nlm.nih.gov/gene/6606",
          "@type" : "dctypes:Text",
          "format" : "text/html"
        }
      },
      "motivatedBy" : "oa:highlighting",
      "serializedBy" : "urn:application:domeo"
    }, {
      "@id" : "http://localhost:8090/s/annotation/D59CDA23-EBD1-4ADD-A827-E7FCBC70A7B9",
      "@type" : "oa:Annotation",
      "createdWith" : "urn:domeo:software:id:Domeo-2.0alpha-030",
      "lastUpdateOn" : "2015-01-09T10:16:47-0500",
      "previousVersion" : "http://localhost:8090/s/annotation/4AFF21C1-A524-4DF3-893F-04794D6ACF4F",
      "label" : "Highlight",
      "annotatedAt" : "2015-01-08T13:52:05-0500",
      "annotatedBy" : "urn:person:uuid:8a70347a4096d318014096d369480000",
      "hasBody" : null,
      "hasTarget" : {
        "@id" : "http://localhost:8090/s/resource/71E92AC9-7E30-46C9-BC99-970E34BC8D67",
        "@type" : "oa:SpecificResource",
        "previousVersion" : "http://localhost:8090/s/resource/E50F5911-6009-4FC5-8104-E13D8FE7DA14",
        "hasSelector" : {
          "@id" : "_:b0",
          "@type" : "oa:TextQuoteSelector",
          "exact" : "Metazoa",
          "prefix" : "Eukaryota; ",
          "suffix" : "; Chordata; Craniata; \\nVertebrata; Euteleostomi; Mammalia; Eutheria; Euarchontoglires; \\nPrimates; Haplorrhini; Catarrhini; Hominidae; Homo"
        },
        "hasSource" : "http://www.ncbi.nlm.nih.gov/gene/6606"
      },
      "motivatedBy" : "oa:highlighting",
      "serializedBy" : "urn:application:domeo"
    } ],
    "description" : "The default set is created automatically by Domeo when no other set is existing.",
    "createdAt" : "2015-01-08T13:52:05-0500",
    "createdBy" : {
      "@id" : "urn:person:uuid:8a70347a4096d318014096d369480000",
      "@type" : "foaf:Person",
      "label" : "Dr. John Doe",
      "name" : "Dr. John Doe"
    },
    "createdWith" : "urn:domeo:software:id:Domeo-2.0alpha-030",
    "lastUpdateOn" : "2015-01-09T10:16:47-0500",
    "previousVersion" : "urn:domeoclient:uuid:13CBA122-F5AC-4089-85AF-1C2B2E780EA3",
    "version" : "1",
    "label" : "Default Set",
    "serializedBy" : "urn:application:domeo"
  } ]
}]}}

The second call should result in an updated of the first Annotation Set with the second one.