summaryrefslogtreecommitdiff
path: root/src/core/model
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-03-03 15:54:14 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-03-03 15:54:14 +0100
commitf6b22312127f29f71aa26ca28142ad3e5f193445 (patch)
treef499d0d5414bcec2d03904ff078a7acbefcedf42 /src/core/model
parente1f71b37d632418390b2aac2f89c9d05297a413c (diff)
Do not allow structs to be transparent and root at the same time
Diffstat (limited to 'src/core/model')
-rw-r--r--src/core/model/Ontology.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/model/Ontology.cpp b/src/core/model/Ontology.cpp
index f52f8ca..e7bc7c4 100644
--- a/src/core/model/Ontology.cpp
+++ b/src/core/model/Ontology.cpp
@@ -800,6 +800,7 @@ bool StructuredClass::doValidate(Logger &logger) const
valid = false;
}
}
+
// check the cardinality.
if (!cardinality.isCardinality()) {
logger.error(cardinality.toString() + " is not a cardinality!", *this);
@@ -819,6 +820,15 @@ bool StructuredClass::doValidate(Logger &logger) const
if (superclass != nullptr) {
valid = valid & superclass->validate(logger);
}
+
+ // Make sure root classes are not transparent
+ if (root && transparent) {
+ logger.error(
+ std::string("Descriptor \"") + getName() +
+ std::string("\" cannot be transparent and root at the same time."));
+ valid = false;
+ }
+
// check the validity as a Descriptor.
/*
* Note that we do not check the validity of all subclasses. This is because
@@ -1126,7 +1136,7 @@ const Rtti StructuredClass =
const Rtti AnnotationClass =
RttiBuilder<ousia::AnnotationClass>("AnnotationClass").parent(&Descriptor);
const Rtti Ontology = RttiBuilder<ousia::Ontology>("Ontology")
- .parent(&RootNode)
- .composedOf({&StructuredClass, &AnnotationClass});
+ .parent(&RootNode)
+ .composedOf({&StructuredClass, &AnnotationClass});
}
}