diff options
Diffstat (limited to 'src/core/model')
-rw-r--r-- | src/core/model/Document.hpp | 8 | ||||
-rw-r--r-- | src/core/model/Domain.hpp | 41 | ||||
-rw-r--r-- | src/core/model/Typesystem.hpp | 2 |
3 files changed, 34 insertions, 17 deletions
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 3114480..a31e52f 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -26,9 +26,11 @@ * * A Document, from top to bottom, consists of "Document" instance, * which "owns" the structural root node of the in-document graph. This might - * for example be a "book" node, if the respective document implements the - * "book" domain. That root node in turn has structure nodes as children as well - * as annotations that refer to the content of that structure node. + * for example be a "book" node of the "book" domain. That root node in turn has + * structure nodes as children, which in turn may have children. This + * constitutes a Structure Tree. Additionally annotations may be attached to + * Structure Nodes, effectively resulting in a Document Graph instead of a + * Document Tree (other references may introduce cycles as well). * * Consider this simplified XML representation of a document (TODO: Use * non-simplified XML as soon as possible): diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 9ae8871..e348136 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -91,8 +91,9 @@ namespace ousia { namespace model { -class StructuredClass; class Descriptor; +class StructuredClass; +class Domain; /** * As mentioned in the description above a FieldDescriptor specifies the @@ -147,17 +148,18 @@ public: * set to "PRIMITIVE". * * @param mgr is the global Manager instance. - * @param name is the name of this field. * @param parent is a handle of the Descriptor node that has this * FieldDescriptor. * @param primitiveType is a handle to some Type in some Typesystem of which * one instance is allowed to fill this field. + * @param name is the name of this field. * @param optional should be set to 'false' is this field needs to be * filled in order for an instance of the parent * Descriptor to be valid. */ - FieldDescriptor(Manager &mgr, std::string name, Handle<Descriptor> parent, - Handle<Type> primitiveType, bool optional) + FieldDescriptor(Manager &mgr, Handle<Descriptor> parent, + Handle<Type> primitiveType, std::string name = "", + bool optional = false) : Node(mgr, std::move(name), parent), children(this), fieldType(FieldType::PRIMITIVE), @@ -171,18 +173,19 @@ public: * children here. * * @param mgr is the global Manager instance. - * @param name is the name of this field. * @param parent is a handle of the Descriptor node that has this * FieldDescriptor. * @param fieldType is the FieldType of this FieldDescriptor, either * TREE for the main or default structure or SUBTREE * for supporting structures. + * @param name is the name of this field. * @param optional should be set to 'false' is this field needs to be * filled in order for an instance of the parent * Descriptor to be valid. */ - FieldDescriptor(Manager &mgr, std::string name, Handle<Descriptor> parent, - FieldType fieldType, bool optional) + FieldDescriptor(Manager &mgr, Handle<Descriptor> parent, + FieldType fieldType = FieldType::TREE, + std::string name = "", bool optional = false) : Node(mgr, std::move(name), parent), children(this), fieldType(fieldType), @@ -239,10 +242,10 @@ private: ManagedVector<FieldDescriptor> fieldDescriptors; public: - Descriptor(Manager &mgr, std::string name, Handle<Node> parent, + Descriptor(Manager &mgr, std::string name, Handle<Domain> domain, // TODO: What would be a wise default value for attributes? Handle<StructType> attributesDescriptor) - : Node(mgr, std::move(name), parent), + : Node(mgr, std::move(name), domain), attributesDescriptor(acquire(attributesDescriptor)), fieldDescriptors(this) { @@ -351,12 +354,13 @@ private: public: const bool transparent; - StructuredClass(Manager &mgr, std::string name, Handle<Node> parent, - Handle<StructType> attributesDescriptor, + StructuredClass(Manager &mgr, std::string name, Handle<Domain> domain, const Cardinality &cardinality, + Handle<StructType> attributesDescriptor = {nullptr}, // TODO: What would be a wise default value for isa? - Handle<StructuredClass> isa, bool transparent) - : Descriptor(mgr, std::move(name), parent, attributesDescriptor), + Handle<StructuredClass> isa = {nullptr}, + bool transparent = false) + : Descriptor(mgr, std::move(name), domain, attributesDescriptor), cardinality(cardinality), isa(acquire(isa)), parents(this), @@ -393,13 +397,15 @@ class Domain : public Node { private: ManagedVector<StructuredClass> rootStructures; ManagedVector<AnnotationClass> annotationClasses; + ManagedVector<Typesystem> typesystems; public: Domain(Manager &mgr, std::string name) // TODO: Can a domain have a parent? : Node(mgr, std::move(name), nullptr), rootStructures(this), - annotationClasses(this) + annotationClasses(this), + typesystems(this) { } @@ -423,6 +429,13 @@ public: { return annotationClasses; } + + ManagedVector<Typesystem> &getTypesystems() { return typesystems; } + + const ManagedVector<Typesystem> &getTypesystems() const + { + return typesystems; + } }; } } diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp index 347adb8..90154ce 100644 --- a/src/core/model/Typesystem.hpp +++ b/src/core/model/Typesystem.hpp @@ -372,6 +372,8 @@ public: * TODO: DOC */ void addType(Handle<Type> type) { types.push_back(type); } + + const NodeVector<Type> &getTypes() const { return types; } }; } } |