COPASI API  4.16.103
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CRDFPredicate Class Reference

#include <CRDFPredicate.h>

Collaboration diagram for CRDFPredicate:
Collaboration graph
[legend]

Classes

struct  sAllowedLocation
 

Public Types

typedef std::vector
< sAllowedLocation
AllowedLocationList
 
enum  ePredicateType {
  copasi_encodes = 0, copasi_hasPart, copasi_hasVersion, copasi_is,
  copasi_isDescribedBy, copasi_isEncodedBy, copasi_isHomologTo, copasi_isPartOf,
  copasi_isVersionOf, copasi_occursIn, bqbiol_encodes, bqbiol_hasPart,
  bqbiol_hasVersion, bqbiol_is, bqbiol_isDescribedBy, bqbiol_isEncodedBy,
  bqbiol_isHomologTo, bqbiol_isPartOf, bqbiol_isVersionOf, bqbiol_occursIn,
  bqmodel_is, bqmodel_isDescribedBy, dc_creator, dcterms_creator,
  dcterms_bibliographicCitation, dcterms_created, dcterms_description, dcterms_modified,
  dcterms_W3CDTF, vcard_EMAIL, vcard_Family, vcard_Given,
  vcard_N, vcard_ORG, vcard_Orgname, rdf_type,
  rdf_li, rdf__n, rdf_subject, rdf_predicate,
  rdf_object, unknown, about, any,
  end
}
 
typedef std::vector
< ePredicateType
Path
 

Public Member Functions

 CRDFPredicate (const ePredicateType &type=end)
 
 CRDFPredicate (const std::string &uri)
 
 CRDFPredicate (const CRDFPredicate &src)
 
const ePredicateTypegetType () const
 
const std::string & getURI () const
 
bool operator!= (const CRDFPredicate &rhs) const
 
bool operator< (const CRDFPredicate &rhs) const
 
CRDFPredicate operator= (const ePredicateType &type)
 
bool operator== (const CRDFPredicate &rhs) const
 
void setURI (const std::string &uri)
 
 ~CRDFPredicate ()
 

Static Public Member Functions

static const AllowedLocationListgetAllowedLocationList (const ePredicateType &predicate)
 
static const std::string & getDisplayName (const CRDFPredicate &predicate)
 
static ePredicateType getPredicateFromDisplayName (const std::string &displayName)
 
static ePredicateType getPredicateFromURI (const std::string &URI)
 
static size_t getSubPathIndex (const Path &fullPath, const Path &currentPath)
 
static const std::string & getURI (const CRDFPredicate &predicate)
 
static bool isReadOnly (const Path &currentPath)
 

Static Private Member Functions

static void createAllowedLocationsAbsolute ()
 
static void createAllowedLocationsAbsolute (const ePredicateType &predicate)
 
static void createAllowedLocationsRelative ()
 
static void createDisplayName2Predicate ()
 
static void createURI2Predicate ()
 
static void initialize ()
 

Private Attributes

ePredicateType mType
 
std::string mURI
 

Static Private Attributes

static std::map< std::string,
ePredicateType
DisplayName2Predicate
 
static std::vector
< AllowedLocationList
Predicate2AllowedLocationsAbsolute
 
static std::vector
< AllowedLocationList
Predicate2AllowedLocationsRelative
 
static const std::string PredicateDisplayName []
 
static const std::string PredicateURI []
 
static std::map< std::string,
ePredicateType
URI2Predicate
 

Friends

std::ostream & operator<< (std::ostream &os, const CRDFPredicate &p)
 

Detailed Description

Definition at line 29 of file CRDFPredicate.h.

Member Typedef Documentation

Definition at line 102 of file CRDFPredicate.h.

typedef std::vector< ePredicateType > CRDFPredicate::Path

Definition at line 91 of file CRDFPredicate.h.

Member Enumeration Documentation

Enumerator
copasi_encodes 
copasi_hasPart 
copasi_hasVersion 
copasi_is 
copasi_isDescribedBy 
copasi_isEncodedBy 
copasi_isHomologTo 
copasi_isPartOf 
copasi_isVersionOf 
copasi_occursIn 
bqbiol_encodes 
bqbiol_hasPart 
bqbiol_hasVersion 
bqbiol_is 
bqbiol_isDescribedBy 
bqbiol_isEncodedBy 
bqbiol_isHomologTo 
bqbiol_isPartOf 
bqbiol_isVersionOf 
bqbiol_occursIn 
bqmodel_is 
bqmodel_isDescribedBy 
dc_creator 
dcterms_creator 
dcterms_bibliographicCitation 
dcterms_created 
dcterms_description 
dcterms_modified 
dcterms_W3CDTF 
vcard_EMAIL 
vcard_Family 
vcard_Given 
vcard_N 
vcard_ORG 
vcard_Orgname 
rdf_type 
rdf_li 
rdf__n 
rdf_subject 
rdf_predicate 
rdf_object 
unknown 
about 
any 
end 

Definition at line 32 of file CRDFPredicate.h.

33  {
34  /* These are proposed to unify:
35  * http://biomodels.net/biology-qualifiers/...
36  * http://biomodels.net/model-qualifiers/...
37  */
38  copasi_encodes = 0,
41  copasi_is,
48  // copasi_modification,
52  bqbiol_is,
59  bqmodel_is,
61  dc_creator,
64  // dcterms_contributor,
67  // dcterms_license,
69  // dcterms_rights,
70  // dcterms_rightsHolder,
75  vcard_N,
76  vcard_ORG,
78  rdf_type,
79  rdf_li,
80  rdf__n,
83  rdf_object,
84  unknown,
85  // For internal use
86  about,
87  any,
88  end
89  };

Constructor & Destructor Documentation

CRDFPredicate::CRDFPredicate ( const ePredicateType type = end)

Default constructor

Parameters
constePredicateType & type (default CRDFPredicate::end)

Definition at line 555 of file CRDFPredicate.cpp.

References initialize(), mType, mURI, and PredicateURI.

Referenced by operator=().

555  :
556  mType(type),
557  mURI()
558 {
559  initialize();
561 }
std::string mURI
ePredicateType mType
static const std::string PredicateURI[]
static void initialize()
CRDFPredicate::CRDFPredicate ( const std::string &  uri)

Specific constructor

Parameters
conststd::string & uri

Definition at line 563 of file CRDFPredicate.cpp.

References getPredicateFromURI(), initialize(), mType, mURI, PredicateURI, and rdf_li.

563  :
564  mType(),
565  mURI(uri)
566 {
567  initialize();
569 
570  if (mType == rdf_li)
572 }
std::string mURI
static ePredicateType getPredicateFromURI(const std::string &URI)
ePredicateType mType
static const std::string PredicateURI[]
static void initialize()
CRDFPredicate::CRDFPredicate ( const CRDFPredicate src)

Copy constructor

Parameters
constCRDFPredicate & src

Definition at line 574 of file CRDFPredicate.cpp.

574  :
575  mType(src.mType),
576  mURI(src.mURI)
577 {}
std::string mURI
ePredicateType mType
CRDFPredicate::~CRDFPredicate ( )

Destructor

Definition at line 579 of file CRDFPredicate.cpp.

580 {}

Member Function Documentation

void CRDFPredicate::createAllowedLocationsAbsolute ( )
staticprivate

Create the list of absolute allowed locations for each predicate

Definition at line 452 of file CRDFPredicate.cpp.

References Predicate2AllowedLocationsRelative.

Referenced by createAllowedLocationsAbsolute(), and initialize().

453 {
454  size_t Predicate, PredicateMax = Predicate2AllowedLocationsRelative.size();
455 
456  for (Predicate = 0; Predicate < PredicateMax; Predicate++)
458 }
static void createAllowedLocationsAbsolute()
static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative
void CRDFPredicate::createAllowedLocationsAbsolute ( const ePredicateType predicate)
staticprivate

Create the list of absolute allowed locations for the given predicate

Parameters
constePredicateType & predicate

Definition at line 461 of file CRDFPredicate.cpp.

References about, any, createAllowedLocationsAbsolute(), CRDFPredicate::sAllowedLocation::Location, CRDFPredicate::sAllowedLocation::MaxOccurance, Predicate2AllowedLocationsAbsolute, Predicate2AllowedLocationsRelative, CRDFPredicate::sAllowedLocation::ReadOnly, and CRDFPredicate::sAllowedLocation::Type.

462 {
463  AllowedLocationList & RelativeList = Predicate2AllowedLocationsRelative[predicate];
464  AllowedLocationList & AbsoluteList = Predicate2AllowedLocationsAbsolute[predicate];
465 
466  // Since we are called recursively the absolute locations might already have been build.
467  if (AbsoluteList.size() > 0) return;
468 
469  sAllowedLocation Relative;
470 
471  size_t i, imax = RelativeList.size();
472 
473  for (i = 0; i < imax; i++)
474  {
475  sAllowedLocation & Relative = RelativeList[i];
476 
477  sAllowedLocation Absolute;
478  Absolute.MaxOccurance = Relative.MaxOccurance;
479  Absolute.Type = Relative.Type;
480 
481  // Debugging
482  assert(Relative.Location.size() > 0);
483 
484  ePredicateType Parent = Relative.Location[0];
485  size_t StartIndex = 0;
486 
487  // about is the root, i.e., the path is absolute
488  if (Parent == about)
489  {
490  Absolute.ReadOnly = Relative.ReadOnly;
491  Absolute.Location = Relative.Location;
492 
493  // Add the predicate itself.
494  Absolute.Location.push_back(predicate);
495  AbsoluteList.push_back(Absolute);
496 
497  continue;
498  }
499 
500  if (Parent == any)
501  {
502  // Debugging
503  assert(Relative.Location.size() > 1);
504  Parent = Relative.Location[1];
505  StartIndex = 1;
506  }
507 
508  // Make sure that the absolute path of the parent is known
511 
512  // For each parent path append the relative path
513  size_t j, jmax = ParentList.size();
514 
515  for (j = 0; j < jmax; j++)
516  {
517  Absolute.ReadOnly = ParentList[j].ReadOnly || Relative.ReadOnly;
518  Absolute.Location = ParentList[j].Location;
519 
520  size_t k, kmax = Relative.Location.size();
521 
522  for (k = StartIndex + 1; k < kmax; k++)
523  Absolute.Location.push_back(Relative.Location[k]);
524 
525  // Add the predicate itself.
526  Absolute.Location.push_back(predicate);
527  AbsoluteList.push_back(Absolute);
528  }
529  }
530 }
std::vector< sAllowedLocation > AllowedLocationList
static void createAllowedLocationsAbsolute()
static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative
static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute
void CRDFPredicate::createAllowedLocationsRelative ( )
staticprivate

Create the list of relative allowed locations for each predicate

Definition at line 179 of file CRDFPredicate.cpp.

References about, any, CRDFObject::BLANK_NODE, bqbiol_encodes, bqbiol_hasPart, bqbiol_hasVersion, bqbiol_is, bqbiol_isDescribedBy, bqbiol_isEncodedBy, bqbiol_isHomologTo, bqbiol_isPartOf, bqbiol_isVersionOf, bqbiol_occursIn, bqmodel_is, bqmodel_isDescribedBy, C_INVALID_INDEX, copasi_encodes, copasi_hasPart, copasi_hasVersion, copasi_is, copasi_isDescribedBy, copasi_isEncodedBy, copasi_isHomologTo, copasi_isPartOf, copasi_isVersionOf, copasi_occursIn, dc_creator, dcterms_bibliographicCitation, dcterms_created, dcterms_creator, dcterms_description, dcterms_modified, dcterms_W3CDTF, CRDFObject::LITERAL, Predicate2AllowedLocationsRelative, CRDFObject::RESOURCE, vcard_EMAIL, vcard_Family, vcard_Given, vcard_N, vcard_ORG, and vcard_Orgname.

Referenced by initialize().

180 {
181  AllowedLocationList AboutUnboundedResource;
182  AboutUnboundedResource.resize(1);
183  AboutUnboundedResource[0].MaxOccurance = C_INVALID_INDEX;
184  AboutUnboundedResource[0].ReadOnly = false;
185  AboutUnboundedResource[0].Type = CRDFObject::RESOURCE;
186  AboutUnboundedResource[0].Location.resize(1);
187  AboutUnboundedResource[0].Location[0] = about;
188 
189  AllowedLocationList AboutOneLiteral;
190  AboutOneLiteral.resize(1);
191  AboutOneLiteral[0].MaxOccurance = 1;
192  AboutOneLiteral[0].ReadOnly = false;
193  AboutOneLiteral[0].Type = CRDFObject::LITERAL;
194  AboutOneLiteral[0].Location.resize(1);
195  AboutOneLiteral[0].Location[0] = about;
196 
197  /* These are proposed to replace:
198  * http://biomodels.net/biology-qualifiers/...
199  * http://biomodels.net/model-qualifiers/...
200  */
201  // copasi_encodes:
202  Predicate2AllowedLocationsRelative[copasi_encodes] = AboutUnboundedResource;
203 
204  // copasi_hasPart:
205  Predicate2AllowedLocationsRelative[copasi_hasPart] = AboutUnboundedResource;
206 
207  // copasi_hasVersion:
208  Predicate2AllowedLocationsRelative[copasi_hasVersion] = AboutUnboundedResource;
209 
210  // copasi_is:
211  Predicate2AllowedLocationsRelative[copasi_is] = AboutUnboundedResource;
212 
213  // copasi_isDescribedBy:
215  // *.dcterms_bibliographicCitation, *
222 
223  // copasi_isEncodedBy:
224  Predicate2AllowedLocationsRelative[copasi_isEncodedBy] = AboutUnboundedResource;
225 
226  // copasi_isHomologTo:
227  Predicate2AllowedLocationsRelative[copasi_isHomologTo] = AboutUnboundedResource;
228 
229  // copasi_isPartOf:
230  Predicate2AllowedLocationsRelative[copasi_isPartOf] = AboutUnboundedResource;
231 
232  // copasi_isVersionOf:
233  Predicate2AllowedLocationsRelative[copasi_isVersionOf] = AboutUnboundedResource;
234 
235  // copasi_occursIn:
236  Predicate2AllowedLocationsRelative[copasi_occursIn] = AboutUnboundedResource;
237 
238  /*
239  copasi_modification:
240  about, *
241  */
242 
243  // bq* is read only
244  AboutUnboundedResource[0].ReadOnly = true;
245 
246  // bqbiol_encodes:
247  Predicate2AllowedLocationsRelative[bqbiol_encodes] = AboutUnboundedResource;
248 
249  // bqbiol_hasPart:
250  Predicate2AllowedLocationsRelative[bqbiol_hasPart] = AboutUnboundedResource;
251 
252  // bqbiol_hasVersion:
253  Predicate2AllowedLocationsRelative[bqbiol_hasVersion] = AboutUnboundedResource;
254 
255  // bqbiol_is:
256  Predicate2AllowedLocationsRelative[bqbiol_is] = AboutUnboundedResource;
257 
258  // bqbiol_isDescribedBy:
260 
261  // bqbiol_isEncodedBy:
262  Predicate2AllowedLocationsRelative[bqbiol_isEncodedBy] = AboutUnboundedResource;
263 
264  // bqbiol_isHomologTo:
265  Predicate2AllowedLocationsRelative[bqbiol_isHomologTo] = AboutUnboundedResource;
266 
267  // bqbiol_isPartOf:
268  Predicate2AllowedLocationsRelative[bqbiol_isPartOf] = AboutUnboundedResource;
269 
270  // bqbiol_isVersionOf:
271  Predicate2AllowedLocationsRelative[bqbiol_isVersionOf] = AboutUnboundedResource;
272 
273  // bqbiol_occursIn:
274  Predicate2AllowedLocationsRelative[bqbiol_occursIn] = AboutUnboundedResource;
275 
276  // bqmodel_is:
277  Predicate2AllowedLocationsRelative[bqmodel_is] = AboutUnboundedResource;
278 
279  // bqmodel_isDescribedBy:
281 
282  // dc_creator:
283  Predicate2AllowedLocationsRelative[dc_creator] = AboutUnboundedResource;
285 
286  // change back to writable
287  AboutUnboundedResource[0].ReadOnly = false;
288 
289  // dcterms_creator:
290  Predicate2AllowedLocationsRelative[dcterms_creator] = AboutUnboundedResource;
292 
293  // dcterms_bibliographicCitation:
295  // about, *
301  // *.copasi_modification, *
302  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].MaxOccurance = C_INVALID_INDEX;
303  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].ReadOnly = false;
304  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].Type = CRDFObject::BLANK_NODE;
305  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].Location.resize(2);
306  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].Location[0] = any;
307  // Predicate2AllowedLocationsRelative[dcterms_bibliographicCitation][1].Location[1] = copasi_modification;
308 
309  // dcterms_contributor:
310  // Predicate2AllowedLocationsRelative[dcterms_modified].resize(1);
311  // *.copasi_modification, *
312  // Predicate2AllowedLocationsRelative[dcterms_modified][0].MaxOccurance = C_INVALID_INDEX;
313  // Predicate2AllowedLocationsRelative[dcterms_modified][0].ReadOnly = false;
314  // Predicate2AllowedLocationsRelative[dcterms_modified][0].Type = CRDFObject::BLANK_NODE;
315  // Predicate2AllowedLocationsRelative[dcterms_modified][0].Location.resize(2);
316  // Predicate2AllowedLocationsRelative[dcterms_modified][0].Location[0] = any;
317  // Predicate2AllowedLocationsRelative[dcterms_modified][0].Location[1] = copasi_modification;
318 
319  // dcterms_created:
321  // about, 1
327 
328  // dcterms_description
330  // bibliographicCitation, 1
337 
338  // dcterms_license:
339  // Predicate2AllowedLocationsRelative[dcterms_license] = AboutOneLiteral;
340 
341  // dcterms_modified:
343  // about, *
349 
350  // *.copasi_modification, *
351  // Predicate2AllowedLocationsRelative[dcterms_modified][1].MaxOccurance = C_INVALID_INDEX;
352  // Predicate2AllowedLocationsRelative[dcterms_modified][1].ReadOnly = false;
353  // Predicate2AllowedLocationsRelative[dcterms_modified][1].Type = CRDFObject::BLANK_NODE;
354  // Predicate2AllowedLocationsRelative[dcterms_modified][1].Location.resize(2);
355  // Predicate2AllowedLocationsRelative[dcterms_modified][1].Location[0] = any;
356  // Predicate2AllowedLocationsRelative[dcterms_modified][1].Location[1] = copasi_modification;
357 
358  // dcterms_rights:
359  // Predicate2AllowedLocationsRelative[dcterms_rights] = AboutOneLiteral;
360 
361  // dcterms_rightsHolder:
362  // Predicate2AllowedLocationsRelative[dcterms_rights] = AboutOneLiteral;
363 
364  // dcterms_W3CDTF:
366  // *.dcterms_created, 1
370  Predicate2AllowedLocationsRelative[dcterms_W3CDTF][0].Location.resize(2);
373  // *.dcterms_modified, 1
377  Predicate2AllowedLocationsRelative[dcterms_W3CDTF][1].Location.resize(2);
380 
381  AllowedLocationList VCardOneBlankNode;
382  VCardOneBlankNode.resize(2);
383  // *.dcterms_creator, 1
384  VCardOneBlankNode[0].MaxOccurance = 1;
385  VCardOneBlankNode[0].ReadOnly = false;
386  VCardOneBlankNode[0].Type = CRDFObject::BLANK_NODE;
387  VCardOneBlankNode[0].Location.resize(2);
388  VCardOneBlankNode[0].Location[0] = any;
389  VCardOneBlankNode[0].Location[1] = dcterms_creator;
390  // *.dc_creator, 1
391  VCardOneBlankNode[1].MaxOccurance = 1;
392  VCardOneBlankNode[1].ReadOnly = true;
393  VCardOneBlankNode[1].Type = CRDFObject::BLANK_NODE;
394  VCardOneBlankNode[1].Location.resize(2);
395  VCardOneBlankNode[1].Location[0] = any;
396  VCardOneBlankNode[1].Location[1] = dc_creator;
397  // *.dcterms_contributor, 1
398  // VCardOneBlankNode[1].MaxOccurance = 1;
399  // VCardOneBlankNode[1].ReadOnly = false;
400  // VCardOneBlankNode[1].Type = CRDFObject::BLANK_NODE;
401  // VCardOneBlankNode[1].Location.resize(2);
402  // VCardOneBlankNode[1].Location[0] = any;
403  // VCardOneBlankNode[1].Location[1] = dcterms_contributor;
404 
405  // vcard_EMAIL:
406  Predicate2AllowedLocationsRelative[vcard_EMAIL] = VCardOneBlankNode;
407  // Override the default for vcard which is literal = true;
410 
411  // vcard_Family:
413  // *.vcard_N, 1
417  Predicate2AllowedLocationsRelative[vcard_Family][0].Location.resize(2);
420 
421  // vcard_Given:
423  // *.vcard_N, 1
424  Predicate2AllowedLocationsRelative[vcard_Given][0].MaxOccurance = 1;
425  Predicate2AllowedLocationsRelative[vcard_Given][0].ReadOnly = false;
427  Predicate2AllowedLocationsRelative[vcard_Given][0].Location.resize(2);
430 
431  // vcard_N:
432  Predicate2AllowedLocationsRelative[vcard_N] = VCardOneBlankNode;
433 
434  // vcard_ORG:
435  Predicate2AllowedLocationsRelative[vcard_ORG] = VCardOneBlankNode;
436 
437  // vcard_Orgname:
439  // *.vcard_ORG, 1
443  Predicate2AllowedLocationsRelative[vcard_Orgname][0].Location.resize(2);
446 }
std::vector< sAllowedLocation > AllowedLocationList
#define C_INVALID_INDEX
Definition: copasi.h:222
static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative
void CRDFPredicate::createDisplayName2Predicate ( )
staticprivate

Initialize the map from display name to predicate

Definition at line 165 of file CRDFPredicate.cpp.

References DisplayName2Predicate, and PredicateDisplayName.

Referenced by initialize().

166 {
167  int Predicate = 0;
168 
169  for (; PredicateDisplayName[Predicate] != "end"; Predicate++)
170  DisplayName2Predicate.insert(std::map< std::string, ePredicateType >::value_type(PredicateDisplayName[Predicate], (ePredicateType) Predicate));
171 
172  DisplayName2Predicate.insert(std::map< std::string, ePredicateType >::value_type(PredicateDisplayName[Predicate], (ePredicateType) Predicate));
173 }
static std::map< std::string, ePredicateType > DisplayName2Predicate
static const std::string PredicateDisplayName[]
void CRDFPredicate::createURI2Predicate ( )
staticprivate

Initialize the map from URI to predicate

Definition at line 87 of file CRDFPredicate.cpp.

References Predicate2AllowedLocationsAbsolute, Predicate2AllowedLocationsRelative, PredicateURI, and URI2Predicate.

Referenced by initialize().

88 {
89  int Predicate = 0;
90 
91  for (; PredicateURI[Predicate] != "end"; Predicate++)
92  URI2Predicate[PredicateURI[Predicate]] = (ePredicateType) Predicate;
93 
94  URI2Predicate[PredicateURI[Predicate]] = (ePredicateType) Predicate;
95 
96  // Now we now the number of supported predicates.
99 }
static const std::string PredicateURI[]
static std::vector< AllowedLocationList > Predicate2AllowedLocationsRelative
static std::map< std::string, ePredicateType > URI2Predicate
static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute
const CRDFPredicate::AllowedLocationList & CRDFPredicate::getAllowedLocationList ( const ePredicateType predicate)
static

Retrieve the list of allowed locations in the RDF graph for the given predicate

Parameters
constePredicateType & predicate
Returns
const AllowedLocationList & listOfAllowedLocations

Definition at line 618 of file CRDFPredicate.cpp.

References Predicate2AllowedLocationsAbsolute.

Referenced by CRDFGraphConverter::convert(), and CRDFNode::createMissingAncestors().

619 {
620  return Predicate2AllowedLocationsAbsolute[predicate];
621 }
static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute
const std::string & CRDFPredicate::getDisplayName ( const CRDFPredicate predicate)
static

Retrieve the display name for the given predicate

Parameters
constCRDFPredicate & predicate
Returns
const std::string & displayName

Definition at line 644 of file CRDFPredicate.cpp.

References mType, and PredicateDisplayName.

Referenced by CQMiriamWidget::CQMiriamWidget(), and CBiologicalDescription::getPredicate().

645 {
646  return PredicateDisplayName[predicate.mType];
647 }
ePredicateType mType
static const std::string PredicateDisplayName[]
CRDFPredicate::ePredicateType CRDFPredicate::getPredicateFromDisplayName ( const std::string &  displayName)
static

Retrieve the type of predicate from the given display name

Parameters
conststd::string & displayName
Returns
ePredicateType type

Definition at line 650 of file CRDFPredicate.cpp.

References DisplayName2Predicate, and unknown.

Referenced by CBiologicalDescription::setPredicate().

651 {
652  std::map< std::string, ePredicateType >::iterator it = DisplayName2Predicate.find(displayName);
653 
654  if (it != DisplayName2Predicate.end())
655  return it->second;
656  else
657  return unknown;
658 }
static std::map< std::string, ePredicateType > DisplayName2Predicate
CRDFPredicate::ePredicateType CRDFPredicate::getPredicateFromURI ( const std::string &  URI)
static

Retrieve the type of predicate for the given URI

Parameters
conststd::string & URI
Returns
ePredicateType type

Definition at line 630 of file CRDFPredicate.cpp.

References if(), PredicateURI, rdf__n, rdf_li, unknown, and URI2Predicate.

Referenced by CRDFPredicate(), and setURI().

631 {
632  std::map< std::string, ePredicateType >::iterator it = URI2Predicate.find(URI);
633 
634  if (it != URI2Predicate.end())
635  return it->second;
636  // Handle rdf:_n and map it to rdf:li
637  else if (URI.compare(0, PredicateURI[rdf__n].length(), PredicateURI[rdf__n]) == 0)
638  return rdf_li;
639  else
640  return unknown;
641 }
static const std::string PredicateURI[]
static std::map< std::string, ePredicateType > URI2Predicate
if(!yymsg) yymsg
size_t CRDFPredicate::getSubPathIndex ( const Path fullPath,
const Path currentPath 
)
static

Retrieve the index of the next path element of the full path beyond the current path. If the current path is not part of the full path C_INVALID_INDEX is returned

Parameters
constPath & fullPath
constPath & currentPath
Returns
size_t index

Definition at line 661 of file CRDFPredicate.cpp.

References C_INVALID_INDEX.

Referenced by CRDFGraphConverter::convert(), and CRDFNode::createMissingAncestors().

663 {
664  // If the current path is longer than the full path we fail
665  if (currentPath.size() > fullPath.size())
666  return C_INVALID_INDEX;
667 
668  // Check whether the current path is part of the full path;
669  Path::const_iterator itCurrent = currentPath.begin();
670  Path::const_iterator endCurrent = currentPath.end();
671  Path::const_iterator itFull = fullPath.begin();
672 
673  for (; itCurrent != endCurrent; ++itCurrent, ++itFull)
674  if (*itCurrent != *itFull)
675  return C_INVALID_INDEX;
676 
677  return currentPath.size();
678 }
#define C_INVALID_INDEX
Definition: copasi.h:222
const CRDFPredicate::ePredicateType & CRDFPredicate::getType ( ) const

Retrieve the type og the predicate.

Returns
const ePredicateType & type

Definition at line 585 of file CRDFPredicate.cpp.

References mType.

Referenced by CSBMLExporter::updateMIRIAMAnnotation().

586 {return mType;}
ePredicateType mType
const std::string & CRDFPredicate::getURI ( ) const
const std::string & CRDFPredicate::getURI ( const CRDFPredicate predicate)
static

Retrieve the URI for the given predicate

Parameters
constCRDFPredicate & predicate
Returns
const std::string & uri

Definition at line 624 of file CRDFPredicate.cpp.

References mType, and PredicateURI.

625 {
626  return PredicateURI[predicate.mType];
627 }
ePredicateType mType
static const std::string PredicateURI[]
void CRDFPredicate::initialize ( )
staticprivate

Initialize the static information

Definition at line 532 of file CRDFPredicate.cpp.

References createAllowedLocationsAbsolute(), createAllowedLocationsRelative(), createDisplayName2Predicate(), and createURI2Predicate().

Referenced by CRDFPredicate().

533 {
534  static bool Initialized = false;
535 
536  if (Initialized)
537  return;
538 
539  Initialized = true;
540 
541  // Fill URI2Predicate
543 
544  // Fill DisplayName2Predicate
546 
547  // Fill relative allowed locations
549 
550  // Fill relative allowed locations
552 }
static void createURI2Predicate()
static void createAllowedLocationsRelative()
static void createAllowedLocationsAbsolute()
static void createDisplayName2Predicate()
bool CRDFPredicate::isReadOnly ( const Path currentPath)
static

Checks whether the element pointed to by the current path is read-only

Parameters
constPath & currentPath
Returns
bool isReadOnly

Definition at line 681 of file CRDFPredicate.cpp.

References Predicate2AllowedLocationsAbsolute.

Referenced by CRDFNode::isReadOnly().

682 {
683  // Iterate over each predicate
684  std::vector< AllowedLocationList >::const_iterator itPredicate = Predicate2AllowedLocationsAbsolute.begin();
685  std::vector< AllowedLocationList >::const_iterator endPredicate = Predicate2AllowedLocationsAbsolute.end();
686 
687  for (; itPredicate != endPredicate; ++itPredicate)
688  {
689  // Iterate over each location
690  AllowedLocationList::const_iterator itLocation = itPredicate->begin();
691  AllowedLocationList::const_iterator endLocation = itPredicate->end();
692 
693  for (; itLocation != endLocation; ++itLocation)
694  if (itLocation->ReadOnly &&
695  currentPath.size() == itLocation->Location.size())
696  {
697  // Compare the path.
698  Path::const_iterator itCurrent = currentPath.begin();
699  Path::const_iterator endCurrent = currentPath.end();
700  Path::const_iterator itAbsolute = itLocation->Location.begin();
701 
702  for (; itCurrent != endCurrent; ++itCurrent, ++itAbsolute)
703  if (*itCurrent != *itAbsolute)
704  break;
705 
706  if (itCurrent == endCurrent)
707  return true;
708  }
709  }
710 
711  return false;
712 }
static std::vector< AllowedLocationList > Predicate2AllowedLocationsAbsolute
bool CRDFPredicate::operator!= ( const CRDFPredicate rhs) const

Comparison operator for inequality.

Parameters
constCRDFPredicate & rhs
Returns
bool isNotEqual

Definition at line 604 of file CRDFPredicate.cpp.

References mURI.

605 {return mURI != rhs.mURI;}
std::string mURI
bool CRDFPredicate::operator< ( const CRDFPredicate rhs) const

Comparison operator for less.

Parameters
constCRDFPredicate & rhs
Returns
bool isLess

Definition at line 607 of file CRDFPredicate.cpp.

References mURI.

608 {return mURI < rhs.mURI;}
std::string mURI
CRDFPredicate CRDFPredicate::operator= ( const ePredicateType type)

Assignment operator.

Parameters
constePredicateType & type
Returns
CRDFPredicate predicate

Definition at line 582 of file CRDFPredicate.cpp.

References CRDFPredicate().

583 {return CRDFPredicate(type);}
CRDFPredicate(const ePredicateType &type=end)
bool CRDFPredicate::operator== ( const CRDFPredicate rhs) const

Comparison operator for equality.

Parameters
constCRDFPredicate & rhs
Returns
bool isEqual

Definition at line 601 of file CRDFPredicate.cpp.

References mURI.

602 {return mURI == rhs.mURI;}
std::string mURI
void CRDFPredicate::setURI ( const std::string &  uri)

Set the URI.

Parameters
conststd::string & URI

Definition at line 588 of file CRDFPredicate.cpp.

References getPredicateFromURI(), mType, mURI, PredicateURI, and rdf_li.

589 {
590  mType = getPredicateFromURI(uri);
591 
592  if (mType == rdf_li)
594  else
595  mURI = uri;
596 }
std::string mURI
static ePredicateType getPredicateFromURI(const std::string &URI)
ePredicateType mType
static const std::string PredicateURI[]

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CRDFPredicate p 
)
friend

Friend declaration of ostream operator

Parameters
std::ostream& os
constCRDFPredicate & p
Returns
std::ostream & os

Definition at line 611 of file CRDFPredicate.cpp.

612 {
613  os << p.mType;
614  return os;
615 }
ePredicateType mType

Member Data Documentation

std::map< std::string, CRDFPredicate::ePredicateType > CRDFPredicate::DisplayName2Predicate
staticprivate

Map from display name to predicate type

Definition at line 296 of file CRDFPredicate.h.

Referenced by createDisplayName2Predicate(), and getPredicateFromDisplayName().

ePredicateType CRDFPredicate::mType
private

The type of the predicate

Definition at line 271 of file CRDFPredicate.h.

Referenced by CRDFPredicate(), getDisplayName(), getType(), getURI(), operator<<(), and setURI().

std::string CRDFPredicate::mURI
private

The URI

Definition at line 276 of file CRDFPredicate.h.

Referenced by CRDFPredicate(), getURI(), operator!=(), operator<(), operator==(), and setURI().

std::vector< CRDFPredicate::AllowedLocationList > CRDFPredicate::Predicate2AllowedLocationsAbsolute
staticprivate

Vector of absolute allowed locations

Definition at line 306 of file CRDFPredicate.h.

Referenced by createAllowedLocationsAbsolute(), createURI2Predicate(), getAllowedLocationList(), and isReadOnly().

std::vector< CRDFPredicate::AllowedLocationList > CRDFPredicate::Predicate2AllowedLocationsRelative
staticprivate

Vector of relative allowed locations

Definition at line 301 of file CRDFPredicate.h.

Referenced by createAllowedLocationsAbsolute(), createAllowedLocationsRelative(), and createURI2Predicate().

const std::string CRDFPredicate::PredicateDisplayName
staticprivate

Static strings for display names

Definition at line 291 of file CRDFPredicate.h.

Referenced by createDisplayName2Predicate(), and getDisplayName().

const std::string CRDFPredicate::PredicateURI
staticprivate

Static strings for URIs

Definition at line 281 of file CRDFPredicate.h.

Referenced by CRDFPredicate(), createURI2Predicate(), getPredicateFromURI(), getURI(), and setURI().

std::map< std::string, CRDFPredicate::ePredicateType > CRDFPredicate::URI2Predicate
staticprivate

Map from URI to predicate type

Definition at line 286 of file CRDFPredicate.h.

Referenced by createURI2Predicate(), and getPredicateFromURI().


The documentation for this class was generated from the following files: