NCEAS / eml

Ecological Metadata Language (EML)
https://eml.ecoinformatics.org/
GNU General Public License v2.0
41 stars 15 forks source link

Should annotations be able to have `id` attributes? #335

Closed amoeba closed 5 years ago

amoeba commented 5 years ago

@mpsaloha brought up an interesting point last week on our DataONE semprov call: Should <annotation> elements be able to have ids? This'd allow at least two cool things:

  1. Annotations can be turned into quads and referenced in other contexts. Coolness level: Gentle ocean breeze.
  2. Annotations can annotate other annotations. Coolness level: Gale force winds.

For example, (2) allows us to insert provenance about annotations. Take this annotation:

<!-- snip -->
<attribute id="my_attribute">
  <!-- snip -->
  <annotation>
    <propertyURI label="contains measurements about">
      http://ecoinformatics.org/oboe/oboe.1.2/oboe-core.owl#ofEntity
    </propertyURI>
    <valueURI label="air">
      http://purl.obolibrary.org/obo/ENVO_00002005
    </valueURI>
  </annotation>
  <!-- snip -->
</attribute>
<!-- snip -->

Add in the option of an id attribute:

<!-- snip -->
<attribute id="my_attribute">
  <!-- snip -->
  <annotation id="my_annotation">
    <propertyURI label="contains measurements about">
      http://ecoinformatics.org/oboe/oboe.1.2/oboe-core.owl#ofEntity
    </propertyURI>
    <valueURI label="air">
      http://purl.obolibrary.org/obo/ENVO_00002005
    </valueURI>
  </annotation>
  <!-- snip -->
</attribute>
<!-- snip -->
<annotations>
  <annotation references="my_annotation">
    <propertyURI label="was created by">
      https://schema.org/creator
    </propertyURI>
    <valueURI label="Bryce Mecum">
      https://dataone.org/person/BryceMecum
    </valueURI>
  </annotation>
</annotations>

I think this is potentially useful, and I also think it's not a problem to add to the schema and it's probably better to add now, before 2.2 is released. @mobb mentioned our usual pattern with id attributes is that they also come with system and scope attributes, like:

<xs:attribute name="id" type="res:IDType" use="optional"/>
<xs:attribute name="system" type="res:SystemType" use="optional"/>
<xs:attribute name="scope" type="res:ScopeType" use="optional" default="document"/>

Is this interesting to others and does this fit within the spirit of the semantics module?

csjx commented 5 years ago

Aside from what you've outlined here, when it comes to building a UI around adding, updating, and removing annotations, having an id attribute will be super useful so we can target the XML node easily, so I'm in favor of it. (My $0.02)

twhiteaker commented 5 years ago

Would the id go on the <attribute> or the <annotation> element?

<annotation id="my_annotation">

mobb commented 5 years ago

@twhiteaker - this suggestion means that there would be an id attribute on both elements. <attribute id="attr1">: an id is required so that an unambiguous triple can be created (this is already required in EML 2.2, for any element that is annotated)

<annotation id="annot1">: means that the annotation node can itself be targeted, e.g., for adding more info an annotation ("annotating the annotation... " -- the example adds an author to the annotation), or as Chris says, it makes building user interfaces easier.

amoeba commented 5 years ago

Hey @twhiteaker, my fault: I had the left those details out of the XML snippets. I think I fixed them and they match what @mobb said. Sorry about that!

twhiteaker commented 5 years ago

Makes sense to me

stevenchong commented 5 years ago

The folks working on ADC semantics (@amoeba , @mobb, @mpsaloha and me) are in general agreement that adding an optional id attribute to <annotation> elements are a good idea. So, this is going to require an edit to the schema and supporting documentation (e.g. the semantic annotation primer).

amoeba commented 5 years ago

Okay I pushed this up to the 2.2.0 branch. You can now put id, system, and scope on your annotation elements, like:

    <annotation id="myanno" system="earth" scope="document">
        <propertyURI label="Subject">http://purl.org/dc/elements/1.1/subject</propertyURI>
        <valueURI label="grassland biome">http://purl.obolibrary.org/obo/ENVO_01000177</valueURI>
    </annotation>

Will leave open until we merge with master or someone else closes for their own issue-managing workflow.