1 /** 2 * @cond doxygenLibsbmlInternal 3 * 4 * @file InternalConsistencyConstraints.cpp 5 * @brief Consistency check constraints. See SBML Wiki 6 * @author Sarah Keating 7 * 8 * <!-------------------------------------------------------------------------- 9 * This file is part of libSBML. Please visit http://sbml.org for more 10 * information about SBML, and the latest version of libSBML. 11 * 12 * Copyright (C) 2020 jointly by the following organizations: 13 * 1. California Institute of Technology, Pasadena, CA, USA 14 * 2. University of Heidelberg, Heidelberg, Germany 15 * 3. University College London, London, UK 16 * 17 * Copyright (C) 2019 jointly by the following organizations: 18 * 1. California Institute of Technology, Pasadena, CA, USA 19 * 2. University of Heidelberg, Heidelberg, Germany 20 * 21 * Copyright (C) 2013-2018 jointly by the following organizations: 22 * 1. California Institute of Technology, Pasadena, CA, USA 23 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 24 * 3. University of Heidelberg, Heidelberg, Germany 25 * 26 * Copyright (C) 2009-2013 jointly by the following organizations: 27 * 1. California Institute of Technology, Pasadena, CA, USA 28 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 29 * 30 * Copyright (C) 2006-2008 by the California Institute of Technology, 31 * Pasadena, CA, USA 32 * 33 * Copyright (C) 2002-2005 jointly by the following organizations: 34 * 1. California Institute of Technology, Pasadena, CA, USA 35 * 2. Japan Science and Technology Agency, Japan 36 * 37 * This library is free software; you can redistribute it and/or modify it 38 * under the terms of the GNU Lesser General Public License as published by 39 * the Free Software Foundation. A copy of the license agreement is provided 40 * in the file named "LICENSE.txt" included with this software distribution 41 * and also available online as http://sbml.org/software/libsbml/license.html 42 * ---------------------------------------------------------------------- -->*/ 43 44 #ifndef AddingConstraintsToValidator 45 46 //#include <string> 47 #include <cstring> 48 49 #include <sbml/SBMLTypeCodes.h> 50 #include <sbml/SBO.h> 51 #include <sbml/validator/VConstraint.h> 52 #include <sbml/units/UnitFormulaFormatter.h> 53 #include <sbml/units/FormulaUnitsData.h> 54 #include <sbml/AssignmentRule.h> 55 #include <sbml/RateRule.h> 56 #include <sbml/AlgebraicRule.h> 57 58 #include <sbml/util/List.h> 59 60 61 #endif 62 63 64 #include <sbml/validator/ConstraintMacros.h> 65 66 /** @cond doxygenIgnored */ 67 using namespace std; 68 /** @endcond */ 69 70 // Compartment validation 71 72 START_CONSTRAINT (99901, Compartment, c) 73 { 74 // level 1 compartment spatial dimensions should be 3 75 pre( c.getLevel() == 1); 76 77 inv( c.getSpatialDimensions() == 3 ); 78 } 79 END_CONSTRAINT 80 81 82 START_CONSTRAINT (99902, Compartment, c) 83 { 84 // level 1 and L2V1 and L3 compartment shouldnt have compartmentType 85 pre( c.getLevel() == 1 || (c.getLevel() == 2 && c.getVersion() == 1) 86 || c.getLevel() == 3 ); 87 88 inv( c.isSetCompartmentType() == false ); 89 } 90 END_CONSTRAINT 91 92 93 // 99903 constant not valid attribute 94 START_CONSTRAINT (99903, Compartment, c) 95 { 96 // level 1 compartment constant didnt exist 97 // if compartment appears as the variable in a rule it should be false 98 // otherwise it can be either 99 pre( c.getLevel() == 1); 100 101 const Rule *r = m.getRule(c.getId()); 102 103 if (r != NULL) 104 { 105 inv( c.getConstant() == false ); 106 } 107 } 108 END_CONSTRAINT 109 110 111 START_CONSTRAINT (99903, Parameter, p) 112 { 113 // level 1 parameter constant didnt exist 114 // if parameter appears as the variable in a rule it should be false 115 // otherwise it can be either 116 // BUT a local parameter must be true 117 pre( p.getLevel() == 1); 118 119 SBase *sb = const_cast <Parameter *> (&p)->getParentSBMLObject(); 120 if (sb->getParentSBMLObject()->getTypeCode() == SBML_KINETIC_LAW) 121 { 122 // local parameter 123 inv (p.getConstant() == true); 124 } 125 else 126 { 127 const Rule *r = m.getRule(p.getId()); 128 129 if (r != NULL) 130 { 131 inv( p.getConstant() == false ); 132 } 133 } 134 } 135 END_CONSTRAINT 136 137 138 // 99904 - metaid did not exist in l1 139 // this constraint applies to any component that did exist in l1 140 START_CONSTRAINT (99904, Compartment, c) 141 { 142 // level 1 metaid didnt exist 143 pre( c.getLevel() == 1); 144 145 inv( c.isSetMetaId() == false ); 146 } 147 END_CONSTRAINT 148 149 150 START_CONSTRAINT (99904, KineticLaw, kl) 151 { 152 // level 1 metaid didnt exist 153 pre( kl.getLevel() == 1); 154 155 inv( kl.isSetMetaId() == false ); 156 } 157 END_CONSTRAINT 158 159 160 START_CONSTRAINT (99904, Model, x) 161 { 162 // level 1 metaid didnt exist 163 pre( x.getLevel() == 1); 164 165 inv( x.isSetMetaId() == false ); 166 } 167 END_CONSTRAINT 168 169 170 START_CONSTRAINT (99904, Parameter, p) 171 { 172 // level 1 metaid didnt exist 173 pre( p.getLevel() == 1); 174 175 inv( p.isSetMetaId() == false ); 176 } 177 END_CONSTRAINT 178 179 180 START_CONSTRAINT (99904, Reaction, r) 181 { 182 // level 1 metaid didnt exist 183 pre( r.getLevel() == 1); 184 185 inv( r.isSetMetaId() == false ); 186 } 187 END_CONSTRAINT 188 189 190 START_CONSTRAINT (99904, AssignmentRule, r) 191 { 192 // level 1 metaid didnt exist 193 pre( r.getLevel() == 1); 194 195 inv( r.isSetMetaId() == false ); 196 } 197 END_CONSTRAINT 198 199 200 START_CONSTRAINT (99904, RateRule, r) 201 { 202 // level 1 metaid didnt exist 203 pre( r.getLevel() == 1); 204 205 inv( r.isSetMetaId() == false ); 206 } 207 END_CONSTRAINT 208 209 210 START_CONSTRAINT (99904, AlgebraicRule, r) 211 { 212 // level 1 metaid didnt exist 213 pre( r.getLevel() == 1); 214 215 inv( r.isSetMetaId() == false ); 216 } 217 END_CONSTRAINT 218 219 220 START_CONSTRAINT (99904, Species, s) 221 { 222 // level 1 metaid didnt exist 223 pre( s.getLevel() == 1); 224 225 inv( s.isSetMetaId() == false ); 226 } 227 END_CONSTRAINT 228 229 230 START_CONSTRAINT (99904, SpeciesReference, sr) 231 { 232 // level 1 metaid didnt exist 233 pre( sr.getLevel() == 1); 234 235 inv( sr.isSetMetaId() == false ); 236 } 237 END_CONSTRAINT 238 239 240 START_CONSTRAINT (99904, Unit, u) 241 { 242 // level 1 metaid didnt exist 243 pre( u.getLevel() == 1); 244 245 inv( u.isSetMetaId() == false ); 246 } 247 END_CONSTRAINT 248 249 250 START_CONSTRAINT (99904, UnitDefinition, u) 251 { 252 // level 1 metaid didnt exist 253 pre( u.getLevel() == 1); 254 255 inv( u.isSetMetaId() == false ); 256 } 257 END_CONSTRAINT 258 259 260 // 99905 SBOTerm not valid before l2v3 261 // this constraint applies to any component that existed in l2v2 262 // but did not have an sboterm 263 START_CONSTRAINT (99905, Compartment, c) 264 { 265 // level 1; l2v1; l2v2 sboTerm didnt exist 266 pre( c.getLevel() == 1 || (c.getLevel() == 2 && c.getVersion() < 3)); 267 268 inv( c.isSetSBOTerm() == false ); 269 } 270 END_CONSTRAINT 271 272 273 START_CONSTRAINT (99905, CompartmentType, ct) 274 { 275 // level 1; l2v1; l2v2 sboTerm didnt exist 276 pre( ct.getLevel() == 1 || (ct.getLevel() == 2 && ct.getVersion() < 3)); 277 278 inv( ct.isSetSBOTerm() == false ); 279 } 280 END_CONSTRAINT 281 282 283 START_CONSTRAINT (99905, Delay, d) 284 { 285 // level 1; l2v1; l2v2 sboTerm didnt exist 286 pre( d.getLevel() == 1 || (d.getLevel() == 2 && d.getVersion() < 3)); 287 288 inv( d.isSetSBOTerm() == false ); 289 } 290 END_CONSTRAINT 291 292 293 START_CONSTRAINT (99905, Species, s) 294 { 295 // level 1; l2v1; l2v2 sboTerm didnt exist 296 pre( s.getLevel() == 1 || (s.getLevel() == 2 && s.getVersion() < 3)); 297 298 inv( s.isSetSBOTerm() == false ); 299 } 300 END_CONSTRAINT 301 302 303 START_CONSTRAINT (99905, SpeciesType, s) 304 { 305 // level 1; l2v1; l2v2 sboTerm didnt exist 306 pre( s.getLevel() == 1 || (s.getLevel() == 2 && s.getVersion() < 3)); 307 308 inv( s.isSetSBOTerm() == false ); 309 } 310 END_CONSTRAINT 311 312 313 START_CONSTRAINT (99905, SpeciesReference, sr) 314 { 315 pre( sr.isModifier() == false); 316 // testing the stoichiometrymath element 317 pre( sr.isSetStoichiometryMath()); 318 // level 1; l2v1; l2v2 sboTerm didnt exist 319 pre( sr.getLevel() == 1 || (sr.getLevel() == 2 && sr.getVersion() < 3)); 320 321 const StoichiometryMath * sm = sr.getStoichiometryMath(); 322 323 inv( sm->isSetSBOTerm() == false ); 324 } 325 END_CONSTRAINT 326 327 328 START_CONSTRAINT (99905, Trigger, t) 329 { 330 // level 1; l2v1; l2v2 sboTerm didnt exist 331 pre( t.getLevel() == 1 || (t.getLevel() == 2 && t.getVersion() < 3)); 332 333 inv( t.isSetSBOTerm() == false ); 334 } 335 END_CONSTRAINT 336 337 338 START_CONSTRAINT (99905, Unit, u) 339 { 340 // level 1; l2v1; l2v2 sboTerm didnt exist 341 pre( u.getLevel() == 1 || (u.getLevel() == 2 && u.getVersion() < 3)); 342 343 inv( u.isSetSBOTerm() == false ); 344 } 345 END_CONSTRAINT 346 347 348 START_CONSTRAINT (99905, UnitDefinition, u) 349 { 350 // level 1; l2v1; l2v2 sboTerm didnt exist 351 pre( u.getLevel() == 1 || (u.getLevel() == 2 && u.getVersion() < 3)); 352 353 inv( u.isSetSBOTerm() == false ); 354 } 355 END_CONSTRAINT 356 357 358 START_CONSTRAINT (99906, Compartment, c) 359 { 360 // level 1 units check gets missed in check consistency 361 pre( c.getLevel() == 1 && c.isSetUnits()) 362 363 const string& units = c.getUnits(); 364 const UnitDefinition* defn = m.getUnitDefinition(units); 365 366 inv_or( units == "volume" ); 367 inv_or( units == "litre" ); 368 inv_or( units == "liter" ); 369 inv_or( defn != NULL && defn->isVariantOfVolume() ); 370 } 371 END_CONSTRAINT 372 373 374 START_CONSTRAINT (99907, Compartment, c) 375 { 376 // level 1 version 1 volume required 377 pre( c.getLevel() == 1 && c.getVersion() == 1) 378 379 inv( c.isSetVolume() == true ); 380 } 381 END_CONSTRAINT 382 383 384 START_CONSTRAINT (99908, Model, x) 385 { 386 // compartmentType not valid in L1 or L2v1 or L3 387 pre( x.getLevel() == 1 ||(x.getLevel() == 2 && x.getVersion() == 1) 388 || x.getLevel() == 3 ); 389 390 inv( x.getNumCompartmentTypes() == 0 ); 391 } 392 END_CONSTRAINT 393 394 395 START_CONSTRAINT (99909, Model, x) 396 { 397 // constraint not valid in L1 or L2v1 398 pre( x.getLevel() == 1 ||(x.getLevel() == 2 && x.getVersion() == 1)); 399 400 inv( x.getNumConstraints() == 0 ); 401 } 402 END_CONSTRAINT 403 404 405 START_CONSTRAINT (99910, Model, x) 406 { 407 // event not valid in L1 408 pre( x.getLevel() == 1 ); 409 410 inv( x.getNumEvents() == 0 ); 411 } 412 END_CONSTRAINT 413 414 // 99911 SBOTerm not valid before l2v2 415 // this constraint applies to any component that existed in l2v1 and earlier 416 // but did not have an sboterm 417 START_CONSTRAINT (99911, Event, e) 418 { 419 // level 1; l2v1 sboTerm didnt exist 420 pre( e.getLevel() == 1 || (e.getLevel() == 2 && e.getVersion() == 1)); 421 422 inv( e.isSetSBOTerm() == false ); 423 } 424 END_CONSTRAINT 425 426 427 START_CONSTRAINT (99911, EventAssignment, ea) 428 { 429 // level 1; l2v1 sboTerm didnt exist 430 pre( ea.getLevel() == 1 || (ea.getLevel() == 2 && ea.getVersion() == 1)); 431 432 inv( ea.isSetSBOTerm() == false ); 433 } 434 END_CONSTRAINT 435 436 437 START_CONSTRAINT (99911, FunctionDefinition, fd) 438 { 439 // level 1; l2v1 sboTerm didnt exist 440 pre( fd.getLevel() == 1 || (fd.getLevel() == 2 && fd.getVersion() == 1)); 441 442 inv( fd.isSetSBOTerm() == false ); 443 } 444 END_CONSTRAINT 445 446 447 START_CONSTRAINT (99911, KineticLaw, kl) 448 { 449 // level 1; l2v1 sboTerm didnt exist 450 pre( kl.getLevel() == 1 || (kl.getLevel() == 2 && kl.getVersion() == 1)); 451 452 inv( kl.isSetSBOTerm() == false ); 453 } 454 END_CONSTRAINT 455 456 457 START_CONSTRAINT (99911, Model, m1) 458 { 459 // level 1; l2v1 sboTerm didnt exist 460 pre( m1.getLevel() == 1 || (m1.getLevel() == 2 && m1.getVersion() == 1)); 461 462 inv( m1.isSetSBOTerm() == false ); 463 } 464 END_CONSTRAINT 465 466 467 START_CONSTRAINT (99911, Parameter, p) 468 { 469 // level 1; l2v1 sboTerm didnt exist 470 pre( p.getLevel() == 1 || (p.getLevel() == 2 && p.getVersion() == 1)); 471 472 inv( p.isSetSBOTerm() == false ); 473 } 474 END_CONSTRAINT 475 476 477 START_CONSTRAINT (99911, Reaction, r) 478 { 479 // level 1; l2v1 sboTerm didnt exist 480 pre( r.getLevel() == 1 || (r.getLevel() == 2 && r.getVersion() == 1)); 481 482 inv( r.isSetSBOTerm() == false ); 483 } 484 END_CONSTRAINT 485 486 487 START_CONSTRAINT (99911, AssignmentRule, r) 488 { 489 // level 1; l2v1 sboTerm didnt exist 490 pre( r.getLevel() == 1 || (r.getLevel() == 2 && r.getVersion() == 1)); 491 492 inv( r.isSetSBOTerm() == false ); 493 } 494 END_CONSTRAINT 495 496 497 START_CONSTRAINT (99911, RateRule, r) 498 { 499 // level 1; l2v1 sboTerm didnt exist 500 pre( r.getLevel() == 1 || (r.getLevel() == 2 && r.getVersion() == 1)); 501 502 inv( r.isSetSBOTerm() == false ); 503 } 504 END_CONSTRAINT 505 506 507 START_CONSTRAINT (99911, AlgebraicRule, r) 508 { 509 // level 1; l2v1 sboTerm didnt exist 510 pre( r.getLevel() == 1 || (r.getLevel() == 2 && r.getVersion() == 1)); 511 512 inv( r.isSetSBOTerm() == false ); 513 } 514 END_CONSTRAINT 515 516 517 START_CONSTRAINT (99911, SpeciesReference, sr) 518 { 519 // level 1; l2v1 sboTerm didnt exist 520 pre( sr.getLevel() == 1 || (sr.getLevel() == 2 && sr.getVersion() == 1)); 521 522 inv( sr.isSetSBOTerm() == false ); 523 } 524 END_CONSTRAINT 525 526 527 START_CONSTRAINT (99912, Model, x) 528 { 529 // functionDefinition not valid in L1 530 pre( x.getLevel() == 1 ); 531 532 inv( x.getNumFunctionDefinitions() == 0 ); 533 } 534 END_CONSTRAINT 535 536 537 START_CONSTRAINT (99913, Model, x) 538 { 539 // initial assignment not valid in L1 or L2v1 540 pre( x.getLevel() == 1 ||(x.getLevel() == 2 && x.getVersion() == 1)); 541 542 inv( x.getNumInitialAssignments() == 0 ); 543 } 544 END_CONSTRAINT 545 546 547 START_CONSTRAINT (99914, AlgebraicRule, ar) 548 { 549 // might have been set internally 550 pre (ar.getInternalIdOnly() == false); 551 // algebraic rule shouldnt have a variable 552 inv( ar.isSetVariable() == false ); 553 } 554 END_CONSTRAINT 555 556 557 START_CONSTRAINT (99915, AssignmentRule, r) 558 { 559 // units only valid for l1 ParameterRule 560 pre(r.isSetUnits()); 561 562 inv(r.getLevel() == 1 && r.getL1TypeCode() == SBML_PARAMETER_RULE ); 563 } 564 END_CONSTRAINT 565 566 567 START_CONSTRAINT (99915, RateRule, r) 568 { 569 // units only valid for l1 ParameterRule 570 pre(r.isSetUnits()); 571 572 inv(r.getLevel() == 1 && r.getL1TypeCode() == SBML_PARAMETER_RULE ); 573 } 574 END_CONSTRAINT 575 576 577 START_CONSTRAINT (99915, AlgebraicRule, r) 578 { 579 // units only valid for l1 ParameterRule 580 inv(r.isSetUnits() == false); 581 } 582 END_CONSTRAINT 583 584 585 START_CONSTRAINT (99916, Species, s) 586 { 587 // level 1 species constant didnt exist 588 // if species appears as the variable in a rule it should be false 589 // if the species is product/reactant in a reaction 590 // with boundaryCondition false it should be false 591 // otherwise it can be either 592 593 //NOTE: the product/reactant check is easier to do on a speciesreference 594 pre( s.getLevel() == 1); 595 596 const Rule *r = m.getRule(s.getId()); 597 598 if (r != NULL) 599 { 600 inv( s.getConstant() == false ); 601 } 602 } 603 END_CONSTRAINT 604 605 606 START_CONSTRAINT (99916, SpeciesReference, sr) 607 { 608 // level 1 species constant didnt exist 609 // if species appears as the variable in a rule it should be false 610 // if the species is product/reactant in a reaction 611 // with boundaryCondition false it should be false 612 // otherwise it can be either 613 pre( sr.getLevel() == 1); 614 615 const Species* s = m.getSpecies( sr.getSpecies() ); 616 617 pre( s != NULL ); 618 619 inv( ! (s->getConstant() == true && s->getBoundaryCondition() == false) ); 620 } 621 END_CONSTRAINT 622 623 624 START_CONSTRAINT (99917, Species, s) 625 { 626 // level 1; spatialSizeUnits didnt exist 627 pre( s.getLevel() == 1 628 || (s.getLevel() == 2 && s.getVersion() > 2) 629 || s.getLevel() == 3); 630 631 inv( s.isSetSpatialSizeUnits() == false ); 632 } 633 END_CONSTRAINT 634 635 636 START_CONSTRAINT (99918, Species, s) 637 { 638 // level 1 and L2V1 or L3 species shouldnt have speciesType 639 pre( s.getLevel() == 1 || (s.getLevel() == 2 && s.getVersion() == 1) 640 || s.getLevel() == 3); 641 642 inv( s.isSetSpeciesType() == false ); 643 } 644 END_CONSTRAINT 645 646 647 START_CONSTRAINT (99919, Species, s) 648 { 649 // level 1 species shouldnt have hasOnlySubstanceUnits 650 pre( s.getLevel() == 1); 651 652 inv( s.getHasOnlySubstanceUnits() == false ); 653 } 654 END_CONSTRAINT 655 656 657 START_CONSTRAINT (99920, SpeciesReference, sr) 658 { 659 // level 1 and L2V1 speciesReference shouldnt have id 660 pre( sr.getLevel() == 1 || (sr.getLevel() == 2 && sr.getVersion() == 1)); 661 662 inv( sr.isSetId() == false ); 663 } 664 END_CONSTRAINT 665 666 667 START_CONSTRAINT (99921, SpeciesReference, sr) 668 { 669 // level 1 and L2V1 speciesReference shouldnt have name 670 pre( sr.getLevel() == 1 || (sr.getLevel() == 2 && sr.getVersion() == 1)); 671 672 inv( sr.isSetName() == false ); 673 } 674 END_CONSTRAINT 675 676 677 START_CONSTRAINT (99922, Model, x) 678 { 679 // speciesType not valid in L1 or L2v1 or L3 680 pre( x.getLevel() == 1 ||(x.getLevel() == 2 && x.getVersion() == 1) 681 || x.getLevel() == 3); 682 683 inv( x.getNumSpeciesTypes() == 0 ); 684 } 685 END_CONSTRAINT 686 687 688 START_CONSTRAINT (99923, SpeciesReference, sr) 689 { 690 pre( sr.isModifier() == false); 691 // testing the stoichiometrymath element 692 pre( sr.isSetStoichiometryMath()); 693 // level 1 stoichiometryMath didnt exist 694 pre( sr.getLevel() == 1 || sr.getLevel() == 3); 695 696 inv( sr.isSetStoichiometryMath() == false ); 697 } 698 END_CONSTRAINT 699 700 701 START_CONSTRAINT (99924, Unit, u) 702 { 703 // multiplier not valid in L1 704 // a value of 1 will not alter the unit 705 pre( u.getLevel() == 1); 706 707 inv (u.getMultiplier() == 1.0) 708 } 709 END_CONSTRAINT 710 711 712 START_CONSTRAINT (99925, Unit, u) 713 { 714 // offset not valid in L1 715 // a value of 0 will not alter the unit 716 pre( u.getLevel() == 1 717 || (u.getLevel() == 2 && u.getVersion() != 1) 718 || u.getLevel() == 3); 719 720 inv( u.getOffset() == 0 ); 721 } 722 END_CONSTRAINT 723 724 725 START_CONSTRAINT (20306, FunctionDefinition, fd) 726 { 727 inv( fd.hasRequiredElements() == true ); 728 } 729 END_CONSTRAINT 730 731 732 START_CONSTRAINT (20804, InitialAssignment, ia) 733 { 734 inv( ia.hasRequiredElements() == true ); 735 } 736 END_CONSTRAINT 737 738 739 740 START_CONSTRAINT (20907, AssignmentRule, r) 741 { 742 inv( r.hasRequiredElements() == true ); 743 } 744 END_CONSTRAINT 745 746 747 START_CONSTRAINT (20907, RateRule, r) 748 { 749 inv( r.hasRequiredElements() == true ); 750 } 751 END_CONSTRAINT 752 753 754 START_CONSTRAINT (20907, AlgebraicRule, r) 755 { 756 inv( r.hasRequiredElements() == true ); 757 } 758 END_CONSTRAINT 759 760 761 START_CONSTRAINT (21007, Constraint, c) 762 { 763 inv( c.hasRequiredElements() == true ); 764 } 765 END_CONSTRAINT 766 767 768 START_CONSTRAINT (21101, Reaction, r) 769 { 770 // does not apply to l3v2 771 if (r.getLevel() == 3) 772 { 773 pre(r.getVersion() < 2); 774 } 775 776 inv( r.getNumReactants() > 0 || r.getNumProducts() > 0 ); 777 } 778 END_CONSTRAINT 779 780 781 START_CONSTRAINT (21130, KineticLaw, kl) 782 { 783 inv( kl.hasRequiredElements() == true ); 784 } 785 END_CONSTRAINT 786 787 788 START_CONSTRAINT(21152, Reaction, r) 789 { 790 // only applies to l3v2 791 pre(r.getLevel() == 3) 792 pre(r.getVersion() > 1); 793 794 795 inv(r.isSetFast()); 796 } 797 END_CONSTRAINT 798 799 800 801 802 START_CONSTRAINT (21201, Event, e) 803 { 804 // does not apply to l3v2 805 if (e.getLevel() == 3) 806 { 807 pre(e.getVersion() < 2); 808 } 809 inv( e.isSetTrigger() == true ); 810 } 811 END_CONSTRAINT 812 813 814 START_CONSTRAINT (21203, Event, e) 815 { 816 pre( e.getLevel() < 3 ); 817 inv( e.getNumEventAssignments() > 0 ); 818 } 819 END_CONSTRAINT 820 821 822 START_CONSTRAINT (21209, Trigger, t) 823 { 824 inv( t.hasRequiredElements() == true ); 825 } 826 END_CONSTRAINT 827 828 829 START_CONSTRAINT (21210, Delay, d) 830 { 831 inv( d.hasRequiredElements() == true ); 832 } 833 END_CONSTRAINT 834 835 836 START_CONSTRAINT (21213, EventAssignment, e) 837 { 838 inv( e.hasRequiredElements() == true); 839 } 840 END_CONSTRAINT 841 842 843 START_CONSTRAINT (21231, Priority, p) 844 { 845 inv( p.hasRequiredElements() == true); 846 } 847 END_CONSTRAINT 848 /** @endcond */ 849 850