Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
schema_term.h
Go to the documentation of this file.
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_SHARED_SERVICES_INCLUDE_SCHEMA_TERM_H_
24 #define CORE_SHARED_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 
118 GRASSROOTS_SERVICE_API bool SetSchemaTermValues (SchemaTerm *term_p, const char *url_s, const char *name_s, const char *description_s);
119 
120 
121 
122 GRASSROOTS_SERVICE_API bool DoSchemaTermsMatch (const SchemaTerm *term0_p, const SchemaTerm *term1_p);
123 
124 
125 
133 
134 
142 
143 
156 GRASSROOTS_SERVICE_API SchemaTermNode *AllocateSchemaTermNodeByParts (const char *url_s, const char *name_s, const char *description_s);
157 
158 
167 
168 
178 
179 
188 
189 
198 GRASSROOTS_SERVICE_API bool AddSchemaTermToJSON (const SchemaTerm *term_p, json_t *root_p);
199 
200 
208 GRASSROOTS_SERVICE_API SchemaTerm *GetSchemaTermFromJSON (const json_t *term_json_p);
209 
210 
211 GRASSROOTS_SERVICE_API bool SetSchemaTermValues (SchemaTerm *term_p, const char *url_s, const char *name_s, const char *description_s);
212 
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 
219 #endif /* CORE_SHARED_SERVICES_INCLUDE_SCHEMA_TERM_H_ */
SchemaTerm::GetSchemaTermAsJSON
json_t * GetSchemaTermAsJSON(const SchemaTerm *term_p)
Get the JSON fragment for a given SchemaTerm.
SchemaTermNode::stn_node
ListItem stn_node
The base list node.
Definition: schema_term.h:77
grassroots_service_library.h
SchemaTerm::FreeSchemaTerm
void FreeSchemaTerm(SchemaTerm *term_p)
Free a SchemaTerm.
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
SchemaTerm::GetSchemaTermFromJSON
SchemaTerm * GetSchemaTermFromJSON(const json_t *term_json_p)
Get the JSON fragment for a given SchemaTerm.
SchemaTermNode::AllocateSchemaTermNode
SchemaTermNode * AllocateSchemaTermNode(SchemaTerm *term_p)
Allocate a SchemaTermNode to store the given SchemaTerm.
SchemaTerm::AllocateSchemaTerm
SchemaTerm * AllocateSchemaTerm(const char *url_s, const char *name_s, const char *description_s)
Allocate a SchemaTerm.
SchemaTerm::AddSchemaTermToJSON
bool AddSchemaTermToJSON(const SchemaTerm *term_p, json_t *root_p)
Populate a JSON fragment with the details for a given SchemaTerm.
SchemaTerm::st_url_s
char * st_url_s
The URL for this SchemaTerm.
Definition: schema_term.h:43
SchemaTermNode::stn_term_p
SchemaTerm * stn_term_p
The SchemaTerm to store on the node.
Definition: schema_term.h:82
SchemaTerm::st_description_s
char * st_description_s
A more-verbose description of this SchemaTerm to display to the user.
Definition: schema_term.h:55
SchemaTermNode::AllocateSchemaTermNodeByParts
SchemaTermNode * AllocateSchemaTermNodeByParts(const char *url_s, const char *name_s, const char *description_s)
Allocate a SchemaTermNode.
SchemaTerm::ClearSchemaTerm
void ClearSchemaTerm(SchemaTerm *term_p)
Clear all of the data within a SchemaTerm.
SetSchemaTermValues
bool SetSchemaTermValues(SchemaTerm *term_p, const char *url_s, const char *name_s, const char *description_s)
SchemaTermNode::FreeSchemaTermNode
void FreeSchemaTermNode(ListItem *node_p)
Free a SchemaTermNode.
SchemaTerm::st_abbreviation_s
char * st_abbreviation_s
An optional abbreviation of this term.
Definition: schema_term.h:61
SchemaTerm::st_name_s
char * st_name_s
The user-friendly name for the term that should be displayed to the user.
Definition: schema_term.h:49
SchemaTerm::AllocateExtendedSchemaTerm
SchemaTerm * AllocateExtendedSchemaTerm(const char *url_s, const char *name_s, const char *description_s, const char *abbreviation_s)
Allocate a SchemaTerm with an abbreviation.
linked_list.h
A doubly-linked list.
DoSchemaTermsMatch
bool DoSchemaTermsMatch(const SchemaTerm *term0_p, const SchemaTerm *term1_p)
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
SchemaTermNode
A datatype for storing SchemaTerms in a LinkedList.
Definition: schema_term.h:72
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43