Difference between revisions of "App/API/Ontology/ontology class"

From mx Help Wiki
Jump to: navigation, search
(Undo revision 3951 by Matt (Talk))
 
(17 intermediate revisions by one user not shown)
Line 1: Line 1:
<nowiki>http:</nowiki>//''base_url''/api/ontology/'''ontology_class'''/<CLASS_ID>
+
[[App/API/Ontology|Back to ontology API home]]
  
 
== Description ==
 
== Description ==
 +
 +
<nowiki>http:</nowiki>//''base_url''/api/ontology/'''ontology_class'''/<CLASS_ID>
 +
 +
''Defaults to returning HTML''. Pass an OBO formatted ID with colon translated to underscore.  API returns the possible labels (and associated references), and relationships for the class.
  
 
== Response (JSON) ==
 
== Response (JSON) ==
Line 7: Line 11:
 
  ''CLASS_ID'':
 
  ''CLASS_ID'':
 
   definition: ''definition''
 
   definition: ''definition''
   relationships:
+
  label: ''name''
     ''relationship_type'': ''RELATED_CLASS_ID''
+
   relationships:  
    ...
+
     [
 +
    {  subject:
 +
          id: ''CLASS_ID1''
 +
          label: ''name''
 +
        predicate:
 +
          id: ''ID''
 +
          name: ''name''
 +
        object:
 +
          id: ''CLASS_ID2''
 +
          label: ''name''
 +
    }
 +
    ...  
 +
    ]
  
== Example ==
+
== Response (HTML) ==
 +
 
 +
Redirects to the '''/public/ontology_class/show-expanded/ID''' action.
 +
 
 +
== Example (JSON) ==
  
 
Request:
 
Request:
  
'''http://api.hymao.org/api/ontology/ontology_class/HAO_0000397'''
+
'''http://api.hymao.org/api/ontology/ontology_class/http%3A%2F%2Fpurl%2Eobolibrary%2Eorg%2Fobo%2FHAO_0000397.json'''  ''preferred, note the escape periods as well''
 +
 
 +
or
 +
 
 +
'''http://api.hymao.org/api/ontology/ontology_class/HAO_0000397.json''' ''short form, experimental''
 +
 
  
 
Response:
 
Response:
  
  HAO_0000397:
+
  {
    definition: "The tagma that is located anterior to the thorax."
+
    "<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/HAO_0000397":
    relationships:  
+
      {
      "is_a":"HAO:0000988"
+
        "label":"head",
      "part_of":"HAO:0000182"
+
        "relationships":
 +
          [
 +
          {
 +
            "predicate": {"name":"is_a","id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/OBO_REL_is_a"},
 +
            "subject":{"id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/HAO_0000397","label":"head"},
 +
            "object":{"id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/HAO_0000988","label":"tagma"}
 +
          },
 +
            {
 +
            "predicate": {"name":"part_of","id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/OBO_REL_part_of"},
 +
            "subject": {"id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/HAO_0000397","label":"head"},
 +
            "object": {"id":"<nowiki>h</nowiki>ttp://purl.obolibrary.org/obo/HAO_0000182","label":"body"}
 +
            }
 +
          ],
 +
        "definition":"The tagma that is located anterior to the thorax."
 +
      }
 +
  }

Latest revision as of 22:43, 4 March 2011

Back to ontology API home

Contents

[edit] Description

http://base_url/api/ontology/ontology_class/<CLASS_ID>

Defaults to returning HTML. Pass an OBO formatted ID with colon translated to underscore. API returns the possible labels (and associated references), and relationships for the class.

[edit] Response (JSON)

CLASS_ID:
 definition: definition
 label: name
 relationships: 
   [
    {  subject: 
         id: CLASS_ID1
         label: name
       predicate: 
         id: ID
         name: name
       object: 
         id: CLASS_ID2
         label: name
    }
    ... 
   ]

[edit] Response (HTML)

Redirects to the /public/ontology_class/show-expanded/ID action.

[edit] Example (JSON)

Request:

http://api.hymao.org/api/ontology/ontology_class/http%3A%2F%2Fpurl%2Eobolibrary%2Eorg%2Fobo%2FHAO_0000397.json preferred, note the escape periods as well

or

http://api.hymao.org/api/ontology/ontology_class/HAO_0000397.json short form, experimental


Response:

  {
    "http://purl.obolibrary.org/obo/HAO_0000397":
     {
       "label":"head",
       "relationships":
         [
          {
           "predicate": {"name":"is_a","id":"http://purl.obolibrary.org/obo/OBO_REL_is_a"},
           "subject":{"id":"http://purl.obolibrary.org/obo/HAO_0000397","label":"head"},
           "object":{"id":"http://purl.obolibrary.org/obo/HAO_0000988","label":"tagma"}
          },
           {
            "predicate": {"name":"part_of","id":"http://purl.obolibrary.org/obo/OBO_REL_part_of"},
            "subject": {"id":"http://purl.obolibrary.org/obo/HAO_0000397","label":"head"},
            "object": {"id":"http://purl.obolibrary.org/obo/HAO_0000182","label":"body"}
           }
         ],
       "definition":"The tagma that is located anterior to the thorax."
     }
  }
Personal tools