Difference between revisions of "RadLex API"

From MircWiki
Jump to navigation Jump to search
(midstream of major revision for API v2)
Line 1: Line 1:
 
'''Warning:  This documentation is currently being updated to reflect version 2 of the servlet.'''
 
'''Warning:  This documentation is currently being updated to reflect version 2 of the servlet.'''
  
The RadLex API acts as a webservice, which allows developers to query the RadLex terminology and retrieve an XML response.
+
The RadLex API acts as a webservice, which allows developers to query the RadLex terminology and retrieve an XML response.  For more information about the RadLexID's, see [[RadLex Term Browser#RadLex URI's]].
  
 
__TOC__
 
__TOC__
 
== Methods ==
 
== Methods ==
 +
=== getTermByID ===
 +
'''URL:''' [http://radlex.org/getTermByID http://radlex.org/getTermByID]
 +
 +
'''Parameters:'''
 +
* ''radlexID'' - the RadLex ID to obtain in the form "^RID([0-9]+)$"
 +
 +
'''Return:'''
 +
[[#<term>]] structure. 
 +
 +
'''Notes:'''
 +
Obtains all information pertaining to the ''radlexID'' in the terminology.
 +
 +
 +
=== getTree ===
 +
'''URL:''' [http://radlex.org/getTree http://radlex.org/getTree]
 +
 +
'''Parameters:'''
 +
 +
* ''relationType'' - the type of relation the tree should show.
 +
* (''baseID'') - optional. The RadLex ID to start the tree at. Default: RID0
 +
* (''radlexID'') - optional. The RadLex ID to enumerate the tree to.
 +
 +
'''Return:'''
 +
[[#<links>]] structure. 
 +
 +
'''Notes:'''
 +
Returns a tree structure that represents the terms and their relationships. It returns all links starting with the baseID as the root term related via the relationType. If no radlexID is present only a single layer of children below the baseID term will be returned. If radlexID is present, all nodes that will create the structure from the baseID term to the radlexID term are given—this is "filled" out with the children of the nodes above the radlexID level. That is, if baseID = A and radlexID = a1, and A has children a, b, c, d, and a has children a1, a2, a3. The links of all of A’s children will be given, followed by all of a’s children. If no baseID is given, the root term for the terminology ("RID0") is used.
 +
 +
 +
=== getChildren ===
 +
'''URL:''' [http://radlex.org/getChildren http://radlex.org/getChildren]
 +
 +
'''Parameters:'''
 +
* ''radlexID'' - the RadLex term for which you which to find its children
 +
* (''relationType'') - optional.  The relation that the children must have with the radlexID term.  Default: all relationships
 +
 +
'''Return:'''
 +
[[#<children>]] structure.  All the children of the radlexID, based upon the relationType (if defined)
 +
 +
'''Notes:'''
 +
Serves as an extension of the getTree method, by allowing the program to see one level farther down the tree.  Calls to the [[#getTermByID]] method, automatically include any child information.
 +
 +
 
=== search ===
 
=== search ===
URL: [http://radlex.org/search http://radlex.org/search]
+
'''URL:''' [http://radlex.org/search http://radlex.org/search]
  
Parameters:  
+
'''Parameters:'''
 
* ''query'' - string to search for in the database
 
* ''query'' - string to search for in the database
  
Return:
+
'''Return:'''
 
See notes below.  <terms> structure.
 
See notes below.  <terms> structure.
  
Notes:
+
'''Notes:'''
 
Performs a search on the database for the ''query''' term or phrase.   
 
Performs a search on the database for the ''query''' term or phrase.   
 
*If the query matches "^RID([0-9]+)$", a search for that radlexID is performed, which should yield 0 or 1 results.  If 1 result is found, the search exits and returns that one value.  
 
*If the query matches "^RID([0-9]+)$", a search for that radlexID is performed, which should yield 0 or 1 results.  If 1 result is found, the search exits and returns that one value.  
Line 21: Line 64:
  
  
 +
=== getRelationTypes ===
 +
'''URL:''' [http://radlex.org/getRelationTypes http://radlex.org/getRelationTypes]
 +
 +
'''Parameters:'''
 +
none
 +
 +
'''Return:'''
 +
[[#<relationTypes>]] structure. 
 +
 +
'''Notes:'''
 +
Returns all the types of relationships that are currently used or supported in the terminology.
 +
 +
 +
=== getTotalNumberOfTerms ===
 +
'''URL:''' [http://radlex.org/getTotalNumberOfTerms http://radlex.org/getTotalNumberOfTerms]
  
=== getTermByID ===
+
'''Parameters:'''
URL: [http://radlex.org/getTermByID http://radlex.org/getTermByID ]
+
none
  
Parameters:  
+
'''Return:'''
* ''radlexID'' - the RadLex ID to obtain in the form "^RID([0-9]+)$"
+
A number, not enclosed in any xml, of the number of RadLex terms in the database.
  
Return:
+
'''Notes:'''
[[#<term>]] structure.
+
Returns the number of terms that are in the terminology.
  
Notes:
 
Obtains all information pertaining to the ''radlexID'' in the terminology.
 
  
 
== Return Structures ==
 
== Return Structures ==
As a convention for this API, elements preceeded by a dollar sign ($) are variable content.
+
As a convention for this API, elements preceded by a dollar sign ($) are variable content.
 
=== <term> ===
 
=== <term> ===
 
=== <terms> ===
 
=== <terms> ===

Revision as of 23:28, 25 February 2007

Warning: This documentation is currently being updated to reflect version 2 of the servlet.

The RadLex API acts as a webservice, which allows developers to query the RadLex terminology and retrieve an XML response. For more information about the RadLexID's, see RadLex Term Browser#RadLex URI's.

1 Methods

1.1 getTermByID

URL: http://radlex.org/getTermByID

Parameters:

  • radlexID - the RadLex ID to obtain in the form "^RID([0-9]+)$"

Return: #<term> structure.

Notes: Obtains all information pertaining to the radlexID in the terminology.


1.2 getTree

URL: http://radlex.org/getTree

Parameters:

  • relationType - the type of relation the tree should show.
  • (baseID) - optional. The RadLex ID to start the tree at. Default: RID0
  • (radlexID) - optional. The RadLex ID to enumerate the tree to.

Return: #<links> structure.

Notes: Returns a tree structure that represents the terms and their relationships. It returns all links starting with the baseID as the root term related via the relationType. If no radlexID is present only a single layer of children below the baseID term will be returned. If radlexID is present, all nodes that will create the structure from the baseID term to the radlexID term are given—this is "filled" out with the children of the nodes above the radlexID level. That is, if baseID = A and radlexID = a1, and A has children a, b, c, d, and a has children a1, a2, a3. The links of all of A’s children will be given, followed by all of a’s children. If no baseID is given, the root term for the terminology ("RID0") is used.


1.3 getChildren

URL: http://radlex.org/getChildren

Parameters:

  • radlexID - the RadLex term for which you which to find its children
  • (relationType) - optional. The relation that the children must have with the radlexID term. Default: all relationships

Return: #<children> structure. All the children of the radlexID, based upon the relationType (if defined)

Notes: Serves as an extension of the getTree method, by allowing the program to see one level farther down the tree. Calls to the #getTermByID method, automatically include any child information.


1.4 search

URL: http://radlex.org/search

Parameters:

  • query - string to search for in the database

Return: See notes below. <terms> structure.

Notes: Performs a search on the database for the query' term or phrase.

  • If the query matches "^RID([0-9]+)$", a search for that radlexID is performed, which should yield 0 or 1 results. If 1 result is found, the search exits and returns that one value.
  • If the query has fewer than 4 characters, the database is queried via several LIKE statements. The 4 character minimum is a result of MySQL's Fulltext Search default limit. The query will return all, if any, matches and exit the search.
  • If the search has not already been exited, a MySQL Fulltext Search will be initiated on the database. This is the preferred method, as it uses MySQL's native natural language search (MySQL Documentation).


1.5 getRelationTypes

URL: http://radlex.org/getRelationTypes

Parameters: none

Return: #<relationTypes> structure.

Notes: Returns all the types of relationships that are currently used or supported in the terminology.


1.6 getTotalNumberOfTerms

URL: http://radlex.org/getTotalNumberOfTerms

Parameters: none

Return: A number, not enclosed in any xml, of the number of RadLex terms in the database.

Notes: Returns the number of terms that are in the terminology.


2 Return Structures

As a convention for this API, elements preceded by a dollar sign ($) are variable content.

2.1 <term>

2.2 <terms>

2.3 <children>

2.4 <relationTypes>

2.5 <error>

For a more detailed discussion of error messages, see below.

<program>
   <error id="$errorid">$errormessage</error>
</program>

3 Errors

4 Examples