# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Knowtator XML Files
-------------------

Some examples of how knowtator represents relations and entity categories in XML files are shown below. 
Looking at these examples can be useful for understanding the code of the gold annotation reader.

1. Entity and entity type representation

<annotations textSource="2290848406_2">

  ...

  <annotation>
    <mention id="Relations_Sept21_Schema_Instance_30340" />
    <annotator id="annotationSchemaMarch4_Instance_0">james masanz, mayo clinic</annotator>
    <span start="86" end="97" />
    <spannedText>sore throat</spannedText>
    <creationDate>Thu Oct 14 22:39:26 MDT 2010</creationDate>
  </annotation>
  <annotation>

  ...

  <classMention id="Relations_Sept21_Schema_Instance_30340">
    <mentionClass id="Sign_Symptom">Sign_Symptom</mentionClass>
    <hasSlotMention id="Relations_Sept21_Schema_Instance_30341" />
  </classMention>

  <stringSlotMention id="Relations_Sept21_Schema_Instance_30341">
    <mentionSlot id="cui" />
    <stringSlotMentionValue value="C0242429" />
  </stringSlotMention>

</annotations>


2. Relation representation

E.g. "soar throat" co_occurs_with "headache"

To find relations and their argument, need to find classMention(s)
that have two hasSlotMention(s), which in turn lead to the actual arguments.

  <annotation>
    <mention id="Relations_Sept21_Schema_Instance_30340" />
    <annotator id="annotationSchemaMarch4_Instance_0">james masanz, mayo clinic</annotator>
    <span start="86" end="97" />
    <spannedText>sore throat</spannedText>
    <creationDate>Thu Oct 14 22:39:26 MDT 2010</creationDate>
  </annotation>

  <annotation>
    <mention id="Relations_Sept21_Schema_Instance_30350" />
    <annotator id="annotationSchemaMarch4_Instance_0">james masanz, mayo clinic</annotator>
    <span start="102" end="110" />
    <spannedText>headache</spannedText>
    <creationDate>Thu Oct 14 22:39:28 MDT 2010</creationDate>
  </annotation>

  ...

  <annotation>
    <mention id="Relations_Sept21_Schema_Set02_Instance_70014" />
    <annotator id="Relations_Aug18_Schema_Instance_2">CU annotator ,</annotator>
    <creationDate>Wed Oct 27 21:45:39 MDT 2010</creationDate>
  </annotation>

  ...

  <classMention id="Relations_Sept21_Schema_Set02_Instance_70014">
    <mentionClass id="co_occurs_with">co_occurs_with</mentionClass>
    <hasSlotMention id="Relations_Sept21_Schema_Set02_Instance_90018" />
    <hasSlotMention id="Relations_Sept21_Schema_Set02_Instance_90020" />
  </classMention>  

  ...

  <complexSlotMention id="Relations_Sept21_Schema_Set02_Instance_90018">
    <mentionSlot id="Related_to" />
    <complexSlotMentionValue value="Relations_Sept21_Schema_Instance_30350" />
  </complexSlotMention>

  <complexSlotMention id="Relations_Sept21_Schema_Set02_Instance_90020">
    <mentionSlot id="Argument" />
    <complexSlotMentionValue value="Relations_Sept21_Schema_Instance_30340" />
  </complexSlotMention>

