COPASI API  4.16.103
CRDFPredicate.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/MIRIAM/CRDFPredicate.h,v $
3 // $Revision: 1.6 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:30:19 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 #ifndef COPASI_CRDFPredicate
20 #define COPASI_CRDFPredicate
21 
22 #include <string>
23 #include <vector>
24 #include <map>
25 #include <iostream>
26 
28 
30 {
31 public:
33  {
34  /* These are proposed to unify:
35  * http://biomodels.net/biology-qualifiers/...
36  * http://biomodels.net/model-qualifiers/...
37  */
48  // copasi_modification,
64  // dcterms_contributor,
67  // dcterms_license,
69  // dcterms_rights,
70  // dcterms_rightsHolder,
85  // For internal use
87  any,
89  };
90 
91  typedef std::vector< ePredicateType > Path;
92 
94  {
95 public:
96  size_t MaxOccurance;
97  bool ReadOnly;
100  };
101 
102  typedef std::vector< sAllowedLocation > AllowedLocationList;
103 
104 public:
105  // Methods
106  /**
107  * Default constructor
108  * @param const ePredicateType & type (default CRDFPredicate::end)
109  */
110  CRDFPredicate(const ePredicateType & type = end);
111 
112  /**
113  * Specific constructor
114  * @param const std::string & uri
115  */
116  CRDFPredicate(const std::string & uri);
117 
118  /**
119  * Copy constructor
120  * @param const CRDFPredicate & src
121  */
122  CRDFPredicate(const CRDFPredicate & src);
123 
124  /**
125  * Destructor
126  */
127  ~CRDFPredicate();
128 
129  /**
130  * Assignment operator.
131  * @param const ePredicateType & type
132  * @return CRDFPredicate predicate
133  */
135 
136  /**
137  * Retrieve the URI.
138  * @return const std::string & URI
139  */
140  const std::string & getURI() const;
141 
142  /**
143  * Set the URI.
144  * @param const std::string & URI
145  */
146  void setURI(const std::string & uri);
147 
148  /**
149  * Comparison operator for equality.
150  * @param const CRDFPredicate & rhs
151  * @return bool isEqual
152  */
153  bool operator == (const CRDFPredicate & rhs) const;
154 
155  /**
156  * Comparison operator for inequality.
157  * @param const CRDFPredicate & rhs
158  * @return bool isNotEqual
159  */
160  bool operator != (const CRDFPredicate & rhs) const;
161 
162  /**
163  * Comparison operator for less.
164  * @param const CRDFPredicate & rhs
165  * @return bool isLess
166  */
167  bool operator < (const CRDFPredicate & rhs) const;
168 
169  /**
170  * Retrieve the type og the predicate.
171  * @return const ePredicateType & type
172  */
173  const ePredicateType & getType() const;
174 
175  /**
176  * Retrieve the list of allowed locations in the RDF graph for the given predicate
177  * @param const ePredicateType & predicate
178  * @return const AllowedLocationList & listOfAllowedLocations
179  */
180  static const AllowedLocationList & getAllowedLocationList(const ePredicateType & predicate);
181 
182  /**
183  * Retrieve the URI for the given predicate
184  * @param const CRDFPredicate & predicate
185  * @return const std::string & uri
186  */
187  static const std::string & getURI(const CRDFPredicate & predicate);
188 
189  /**
190  * Retrieve the type of predicate for the given URI
191  * @param const std::string & URI
192  * @return ePredicateType type
193  */
194  static ePredicateType getPredicateFromURI(const std::string & URI);
195 
196  /**
197  * Retrieve the display name for the given predicate
198  * @param const CRDFPredicate & predicate
199  * @return const std::string & displayName
200  */
201  static const std::string & getDisplayName(const CRDFPredicate & predicate);
202 
203  /**
204  * Retrieve the type of predicate from the given display name
205  * @param const std::string & displayName
206  * @return ePredicateType type
207  */
208  static ePredicateType getPredicateFromDisplayName(const std::string & displayName);
209 
210  /**
211  * Retrieve the index of the next path element of the full path beyond the current path.
212  * If the current path is not part of the full path C_INVALID_INDEX is returned
213  * @param const Path & fullPath
214  * @param const Path & currentPath
215  * @return size_t index
216  */
217  static size_t getSubPathIndex(const Path & fullPath, const Path & currentPath);
218 
219  /**
220  * Checks whether the element pointed to by the current path is read-only
221  * @param const Path & currentPath
222  * @return bool isReadOnly
223  */
224  static bool isReadOnly(const Path & currentPath);
225 
226  /**
227  * Friend declaration of ostream operator
228  * @param std::ostream & os
229  * @param const CRDFPredicate & p
230  * @return std::ostream & os
231  */
232  friend std::ostream & operator << (std::ostream & os, const CRDFPredicate & p);
233 
234 private:
235  // Methods
236  /**
237  * Initialize the static information
238  */
239  static void initialize();
240 
241  /**
242  * Initialize the map from URI to predicate
243  */
244  static void createURI2Predicate();
245 
246  /**
247  * Initialize the map from display name to predicate
248  */
249  static void createDisplayName2Predicate();
250 
251  /**
252  * Create the list of relative allowed locations for each predicate
253  */
254  static void createAllowedLocationsRelative();
255 
256  /**
257  * Create the list of absolute allowed locations for each predicate
258  */
259  static void createAllowedLocationsAbsolute();
260 
261  /**
262  * Create the list of absolute allowed locations for the given predicate
263  * @param const ePredicateType & predicate
264  */
265  static void createAllowedLocationsAbsolute(const ePredicateType & predicate);
266 
267  // Attributes
268  /**
269  * The type of the predicate
270  */
272 
273  /**
274  * The URI
275  */
276  std::string mURI;
277 
278  /**
279  * Static strings for URIs
280  */
281  static const std::string PredicateURI[];
282 
283  /**
284  * Map from URI to predicate type
285  */
286  static std::map< std::string, ePredicateType > URI2Predicate;
287 
288  /**
289  * Static strings for display names
290  */
291  static const std::string PredicateDisplayName[];
292 
293  /**
294  * Map from display name to predicate type
295  */
296  static std::map< std::string, ePredicateType > DisplayName2Predicate;
297 
298  /**
299  * Vector of relative allowed locations
300  */
301  static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative;
302 
303  /**
304  * Vector of absolute allowed locations
305  */
306  static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute;
307 };
308 
309 std::ostream & operator << (std::ostream & os, const CRDFPredicate::Path & path);
310 std::ostream & operator << (std::ostream & os, const CRDFPredicate::sAllowedLocation & location);
311 
312 #endif // COPASI_CRDFPredicate
std::string mURI
static bool isReadOnly(const Path &currentPath)
bool operator!=(const CRDFPredicate &rhs) const
std::ostream & operator<<(std::ostream &os, const CRDFPredicate::Path &path)
static ePredicateType getPredicateFromDisplayName(const std::string &displayName)
bool operator==(const CRDFPredicate &rhs) const
std::vector< sAllowedLocation > AllowedLocationList
static std::map< std::string, ePredicateType > DisplayName2Predicate
static ePredicateType getPredicateFromURI(const std::string &URI)
ePredicateType mType
static const std::string PredicateURI[]
static void createURI2Predicate()
static void createAllowedLocationsRelative()
CRDFObject::eObjectType Type
Definition: CRDFPredicate.h:98
static void createAllowedLocationsAbsolute()
CRDFPredicate operator=(const ePredicateType &type)
static const std::string & getDisplayName(const CRDFPredicate &predicate)
static size_t getSubPathIndex(const Path &fullPath, const Path &currentPath)
static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative
static const AllowedLocationList & getAllowedLocationList(const ePredicateType &predicate)
friend std::ostream & operator<<(std::ostream &os, const CRDFPredicate &p)
bool operator<(const CRDFPredicate &rhs) const
static std::map< std::string, ePredicateType > URI2Predicate
const std::string & getURI() const
void setURI(const std::string &uri)
static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute
static void createDisplayName2Predicate()
std::vector< ePredicateType > Path
Definition: CRDFPredicate.h:91
static void initialize()
CRDFPredicate(const ePredicateType &type=end)
static const std::string PredicateDisplayName[]
const ePredicateType & getType() const