schema_term.h
1 /*
2  ** Copyright 2014-2017 The Earlham Institute
3  **
4  ** Licensed under the Apache License, Version 2.0 (the "License");
5  ** you may not use this file except in compliance with the License.
6  ** You may obtain a copy of the License at
7  **
8  ** http://www.apache.org/licenses/LICENSE-2.0
9  **
10  ** Unless required by applicable law or agreed to in writing, software
11  ** distributed under the License is distributed on an "AS IS" BASIS,
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ** See the License for the specific language governing permissions and
14  ** limitations under the License.
15  */
16 /*
17  * schema_term.h
18  *
19  * Created on: 14 Nov 2017
20  * Author: billy
21  */
22 
23 #ifndef CORE_SERVER_SERVICES_INCLUDE_SCHEMA_TERM_H_
24 #define CORE_SERVER_SERVICES_INCLUDE_SCHEMA_TERM_H_
25 
26 
28 #include "linked_list.h"
29 
30 #include "jansson.h"
31 
38 typedef struct SchemaTerm
39 {
43  char *st_url_s;
44 
49  char *st_name_s;
50 
56 
57 
62 
63 } SchemaTerm;
64 
65 
66 
67 
68 
72 typedef struct SchemaTermNode
73 {
78 
84 
85 
86 
87 #ifdef __cplusplus
88 extern "C"
89 {
90 #endif
91 
92 
103 GRASSROOTS_SERVICE_API SchemaTerm *AllocateExtendedSchemaTerm (const char *url_s, const char *name_s, const char *description_s, const char *abbreviation_s);
104 
105 
115 GRASSROOTS_SERVICE_API SchemaTerm *AllocateSchemaTerm (const char *url_s, const char *name_s, const char *description_s);
116 
117 
124 GRASSROOTS_SERVICE_API void FreeSchemaTerm (SchemaTerm *term_p);
125 
126 
139 GRASSROOTS_SERVICE_API SchemaTermNode *AllocateSchemaTermNodeByParts (const char *url_s, const char *name_s, const char *description_s);
140 
141 
149 GRASSROOTS_SERVICE_API SchemaTermNode *AllocateSchemaTermNode (SchemaTerm *term_p);
150 
151 
160 GRASSROOTS_SERVICE_API void FreeSchemaTermNode (ListItem *node_p);
161 
162 
170 GRASSROOTS_SERVICE_API json_t *GetSchemaTermAsJSON (const SchemaTerm *term_p);
171 
172 
180 GRASSROOTS_SERVICE_API SchemaTerm *GetSchemaTermFromJSON (const json_t *term_json_p);
181 
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 
188 #endif /* CORE_SERVER_SERVICES_INCLUDE_SCHEMA_TERM_H_ */
SchemaTerm * GetSchemaTermFromJSON(const json_t *term_json_p)
Get the JSON fragment for a given SchemaTerm.
SchemaTermNode * AllocateSchemaTermNode(SchemaTerm *term_p)
Allocate a SchemaTermNode to store the given SchemaTerm.
A datatype for specifying ontological terms as a way to describe the data that each of the Services c...
Definition: schema_term.h:38
char * st_description_s
A more-verbose description of this SchemaTerm to display to the user.
Definition: schema_term.h:55
A datatype for storing SchemaTerms in a LinkedList.
Definition: schema_term.h:72
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
char * st_name_s
The user-friendly name for the term that should be displayed to the user.
Definition: schema_term.h:49
ListItem stn_node
The base list node.
Definition: schema_term.h:77
SchemaTerm * AllocateExtendedSchemaTerm(const char *url_s, const char *name_s, const char *description_s, const char *abbreviation_s)
Allocate a SchemaTerm with an abbreviation.
void FreeSchemaTermNode(ListItem *node_p)
Free a SchemaTermNode.
A doubly-linked list.
SchemaTerm * stn_term_p
The SchemaTerm to store on the node.
Definition: schema_term.h:82
char * st_url_s
The URL for this SchemaTerm.
Definition: schema_term.h:43
SchemaTermNode * AllocateSchemaTermNodeByParts(const char *url_s, const char *name_s, const char *description_s)
Allocate a SchemaTermNode.
json_t * GetSchemaTermAsJSON(const SchemaTerm *term_p)
Get the JSON fragment for a given SchemaTerm.
SchemaTerm * AllocateSchemaTerm(const char *url_s, const char *name_s, const char *description_s)
Allocate a SchemaTerm.
void FreeSchemaTerm(SchemaTerm *term_p)
Free a SchemaTerm.
char * st_abbreviation_s
An optional abbreviation of this term.
Definition: schema_term.h:61