diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-03-01 20:47:25 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-03-01 20:47:25 +0100 |
commit | a7019614896fdd3e29b9a28f6a8cfd2c1b365983 (patch) | |
tree | 8a9f102649e88ebf24de0a07cf5f348804a6212d /src/core | |
parent | 0d4ce5c555a1ba3a87cb9a1e350854eda7a243e1 (diff) |
Renamed domain to ontology.
Diffstat (limited to 'src/core')
19 files changed, 315 insertions, 315 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 2fcd20d..fc39348 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -723,7 +723,7 @@ void Document::doResolve(ResolutionState &state) if (root != nullptr) { continueResolveCompositum(root, state); } - continueResolveReferences(domains, state); + continueResolveReferences(ontologies, state); continueResolveReferences(typesystems, state); } @@ -761,8 +761,8 @@ bool Document::doValidate(Logger &logger) const void Document::doReference(Handle<Node> node) { - if (node->isa(&RttiTypes::Domain)) { - referenceDomain(node.cast<Domain>()); + if (node->isa(&RttiTypes::Ontology)) { + referenceOntology(node.cast<Ontology>()); } if (node->isa(&RttiTypes::Typesystem)) { referenceTypesystem(node.cast<Typesystem>()); @@ -771,7 +771,7 @@ void Document::doReference(Handle<Node> node) RttiSet Document::doGetReferenceTypes() const { - return RttiSet{&RttiTypes::Domain, &RttiTypes::Typesystem}; + return RttiSet{&RttiTypes::Ontology, &RttiTypes::Typesystem}; } Rooted<StructuredEntity> Document::createRootStructuredEntity( diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index a5e40ce..dc0f73f 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -22,29 +22,29 @@ * This header contains the class hierarchy of actual document classes. A graph * of connected instances of these nodes is a "Document". How the different * DocumentEntity instances may be connected within the graph is subject to the - * specification in the respective Domain(s) (see also the Domain.hpp). + * specification in the respective Ontology(s) (see also the Ontology.hpp). * * 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 of the "book" domain. That root node in turn has + * for example be a "book" node of the "book" ontology. 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 XML representation of a document using the "book" domain: + * Consider this XML representation of a document using the "book" ontology: * * \code{.xml} * <doc> * <head> - * <import rel="domain" src="book_domain.oxm"/> - * <import rel="domain" src="emphasized_domain.oxm"/> + * <import rel="ontology" src="book_ontology.oxm"/> + * <import rel="ontology" src="emphasized_ontology.oxm"/> * <alias tag="paragraph" aka="p"/> * </head> * <book> * This might be some introductory text or a dedication. Ideally, of * course, such elements would be semantically specified as such in - * additional domains (or in this one). + * additional ontologies (or in this one). * <chapter name="myFirstChapter"> * Here we might have an introduction to the chapter, including some * overview of the chapters structure. @@ -63,9 +63,9 @@ * \endcode * * As can be seen the StructureEntities inherently follow a tree structure that - * is restricted by the implicit context free grammar of the "book" Domain + * is restricted by the implicit context free grammar of the "book" Ontology * definition (e.g. it is not allowed to have a "book" node inside a "section"; - * refer to te Domain.hpp for more information). + * refer to te Ontology.hpp for more information). * * Another interesting fact is the special place of AnnotationEntities: They are * Defined by start and end Anchors in the text. Note that this allows for @@ -114,7 +114,7 @@ #include <core/common/Variant.hpp> #include "Node.hpp" -#include "Domain.hpp" +#include "Ontology.hpp" #include "RootNode.hpp" #include "Typesystem.hpp" @@ -131,7 +131,7 @@ class Anchor; /** * A DocumentEntity is the common superclass for StructuredEntities and - * AnnotationEntities. Similarly to DescriptorEntity in the Domain.hpp it + * AnnotationEntities. Similarly to DescriptorEntity in the Ontology.hpp it * defines that each node in the Document graph may have attributes (in form * of a struct Variant), and fields. * The fields here are a vector of vectors. The first vector implements all @@ -215,7 +215,7 @@ public: * If the name is unknown an exception is thrown. * * @param fieldName is the name of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. * @return a NodeVector of all StructuredEntities in that field. */ const NodeVector<StructureNode> &getField( @@ -243,7 +243,7 @@ public: * If the index is out of bounds an exception is thrown. * * @param idx is the index of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. * @return a NodeVector of all StructuredEntities in that field. */ const NodeVector<StructureNode> &getField(const size_t &idx) const; @@ -257,7 +257,7 @@ public: * * @param s is the StructureNode that shall be added. * @param fieldIdx is the index of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. */ void addStructureNode(Handle<StructureNode> s, const size_t &fieldIdx); /** @@ -271,7 +271,7 @@ public: * * @param s is the StructureNode that shall be added. * @param fieldName is the name of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. */ void addStructureNode(Handle<StructureNode> s, const std::string &fieldName = DEFAULT_FIELD_NAME); @@ -287,7 +287,7 @@ public: * * @param ss are the StructureNodes that shall be added. * @param fieldName is the name of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. */ void addStructureNodes(const std::vector<Handle<StructureNode>> &ss, const std::string &fieldName = DEFAULT_FIELD_NAME); @@ -298,7 +298,7 @@ public: * * @param s is the StructureNode that shall be removed. * @param fieldIdx is the index of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. * @return true if this StructureNode was a child here and false if * if was not found. */ @@ -313,7 +313,7 @@ public: * * @param s is the StructureNode that shall be removed. * @param fieldName is the name of a field as specified in the - * FieldDescriptor in the Domain description. + * FieldDescriptor in the Ontology description. * @return true if this StructureNode was a child here and false if * if was not found. */ @@ -866,7 +866,7 @@ public: /** * A Document is mainly a wrapper for the Root structure node of the Document - * Graph. It also references the domains that have been used within this + * Graph. It also references the ontologies that have been used within this * document and the AnnotationEntities that span over Anchors in this Document. */ class Document : public RootNode { @@ -874,7 +874,7 @@ private: // TODO: Might there be several roots? E.g. metadata? Owned<StructuredEntity> root; NodeVector<AnnotationEntity> annotations; - NodeVector<Domain> domains; + NodeVector<Ontology> ontologies; NodeVector<Typesystem> typesystems; protected: @@ -893,7 +893,7 @@ public: Document(Manager &mgr, std::string name) : RootNode(mgr, std::move(name), nullptr), annotations(this), - domains(this), + ontologies(this), typesystems(this) { } @@ -987,30 +987,30 @@ public: std::string name = ""); /** - * Returns a const reference to the NodeVector of Domains that are used + * Returns a const reference to the NodeVector of ontologies that are used * within this Document. * - * @return a const reference to the NodeVector of Domains that are used + * @return a const reference to the NodeVector of ontologies that are used * within this Document. */ - const NodeVector<Domain> &getDomains() const { return domains; } + const NodeVector<Ontology> &getOntologys() const { return ontologies; } /** - * Adds a Domain reference to this Document. + * Adds a Ontology reference to this Document. */ - void referenceDomain(Handle<Domain> d) + void referenceOntology(Handle<Ontology> d) { invalidate(); - domains.push_back(d); + ontologies.push_back(d); } /** - * Adds multiple Domain references to this Document. + * Adds multiple Ontology references to this Document. */ - void referenceDomains(const std::vector<Handle<Domain>> &d) + void referenceOntologys(const std::vector<Handle<Ontology>> &d) { invalidate(); - domains.insert(domains.end(), d.begin(), d.end()); + ontologies.insert(ontologies.end(), d.begin(), d.end()); } /** diff --git a/src/core/model/Node.hpp b/src/core/model/Node.hpp index fe8db16..0567e67 100644 --- a/src/core/model/Node.hpp +++ b/src/core/model/Node.hpp @@ -88,7 +88,7 @@ struct ResolutionResult { /** * Root node of the subtree in which the node was found. This e.g. points to - * the Domain in which a Structure was defined or the Typesystem in which a + * the Ontology in which a Structure was defined or the Typesystem in which a * Type was defined. May be nullptr. */ Rooted<Node> resolutionRoot; @@ -119,7 +119,7 @@ class ResolutionState; /** * The Node class builds the base class for any Node within the DOM graph. A - * node may either be a descriptive node (such as a domain description etc.) + * node may either be a descriptive node (such as a ontology description etc.) * or a document element. Each node is identified by acharacteristic name and * a parent element. Note that the node name is not required to be unique. Nodes * without parent are considered root nodes. diff --git a/src/core/model/Domain.cpp b/src/core/model/Ontology.cpp index 8255401..8829139 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Ontology.cpp @@ -23,7 +23,7 @@ #include <core/common/RttiBuilder.hpp> #include <core/common/Exceptions.hpp> -#include "Domain.hpp" +#include "Ontology.hpp" namespace ousia { @@ -416,9 +416,9 @@ bool Descriptor::doValidate(Logger &logger) const std::string("Descriptor \"") + getName() + "\" has no parent!", *this); valid = false; - } else if (!getParent()->isa(&RttiTypes::Domain)) { + } else if (!getParent()->isa(&RttiTypes::Ontology)) { logger.error(std::string("The parent of Descriptor \"") + getName() + - "\" is not a Domain!", + "\" is not a Ontology!", *this); valid = false; } @@ -672,10 +672,10 @@ std::pair<Rooted<FieldDescriptor>, bool> Descriptor::createFieldDescriptor( /* Class StructuredClass */ StructuredClass::StructuredClass(Manager &mgr, std::string name, - Handle<Domain> domain, Variant cardinality, + Handle<Ontology> ontology, Variant cardinality, Handle<StructuredClass> superclass, bool transparent, bool root) - : Descriptor(mgr, std::move(name), domain), + : Descriptor(mgr, std::move(name), ontology), cardinality(cardinality), superclass(acquire(superclass)), subclasses(this), @@ -686,8 +686,8 @@ StructuredClass::StructuredClass(Manager &mgr, std::string name, if (superclass != nullptr) { superclass->addSubclass(this, logger); } - if (domain != nullptr) { - domain->addStructuredClass(this); + if (ontology != nullptr) { + ontology->addStructuredClass(this); } } @@ -843,27 +843,27 @@ NodeVector<FieldDescriptor> StructuredClass::getFieldDescriptors() const /* Class AnnotationClass */ AnnotationClass::AnnotationClass(Manager &mgr, std::string name, - Handle<Domain> domain) - : Descriptor(mgr, std::move(name), domain) + Handle<Ontology> ontology) + : Descriptor(mgr, std::move(name), ontology) { - if (domain != nullptr) { - domain->addAnnotationClass(this); + if (ontology != nullptr) { + ontology->addAnnotationClass(this); } } -/* Class Domain */ +/* Class Ontology */ -void Domain::doResolve(ResolutionState &state) +void Ontology::doResolve(ResolutionState &state) { continueResolveComposita(structuredClasses, structuredClasses.getIndex(), state); continueResolveComposita(annotationClasses, annotationClasses.getIndex(), state); continueResolveReferences(typesystems, state); - continueResolveReferences(domains, state); + continueResolveReferences(ontologies, state); } -bool Domain::doValidate(Logger &logger) const +bool Ontology::doValidate(Logger &logger) const { // check validity of name, of StructuredClasses, of AnnotationClasses and // TypeSystems. @@ -873,22 +873,22 @@ bool Domain::doValidate(Logger &logger) const continueValidationCheckDuplicates(typesystems, logger); } -void Domain::doReference(Handle<Node> node) +void Ontology::doReference(Handle<Node> node) { if (node->isa(&RttiTypes::Typesystem)) { referenceTypesystem(node.cast<Typesystem>()); } - if (node->isa(&RttiTypes::Domain)) { - referenceDomain(node.cast<Domain>()); + if (node->isa(&RttiTypes::Ontology)) { + referenceOntology(node.cast<Ontology>()); } } -RttiSet Domain::doGetReferenceTypes() const +RttiSet Ontology::doGetReferenceTypes() const { - return RttiSet{&RttiTypes::Domain, &RttiTypes::Typesystem}; + return RttiSet{&RttiTypes::Ontology, &RttiTypes::Typesystem}; } -void Domain::addStructuredClass(Handle<StructuredClass> s) +void Ontology::addStructuredClass(Handle<StructuredClass> s) { // only add it if we need to. if (structuredClasses.find(s) == structuredClasses.end()) { @@ -899,13 +899,13 @@ void Domain::addStructuredClass(Handle<StructuredClass> s) if (par != this) { if (par != nullptr) { // remove the StructuredClass from the old parent. - par.cast<Domain>()->removeStructuredClass(s); + par.cast<Ontology>()->removeStructuredClass(s); } s->setParent(this); } } -bool Domain::removeStructuredClass(Handle<StructuredClass> s) +bool Ontology::removeStructuredClass(Handle<StructuredClass> s) { auto it = structuredClasses.find(s); if (it != structuredClasses.end()) { @@ -917,7 +917,7 @@ bool Domain::removeStructuredClass(Handle<StructuredClass> s) return false; } -Rooted<StructuredClass> Domain::createStructuredClass( +Rooted<StructuredClass> Ontology::createStructuredClass( std::string name, Variant cardinality, Handle<StructuredClass> superclass, bool transparent, bool root) { @@ -926,7 +926,7 @@ Rooted<StructuredClass> Domain::createStructuredClass( std::move(transparent), std::move(root))}; } -void Domain::addAnnotationClass(Handle<AnnotationClass> a) +void Ontology::addAnnotationClass(Handle<AnnotationClass> a) { // only add it if we need to. if (annotationClasses.find(a) == annotationClasses.end()) { @@ -937,13 +937,13 @@ void Domain::addAnnotationClass(Handle<AnnotationClass> a) if (par != this) { if (par != nullptr) { // remove the StructuredClass from the old parent. - par.cast<Domain>()->removeAnnotationClass(a); + par.cast<Ontology>()->removeAnnotationClass(a); } a->setParent(this); } } -bool Domain::removeAnnotationClass(Handle<AnnotationClass> a) +bool Ontology::removeAnnotationClass(Handle<AnnotationClass> a) { auto it = annotationClasses.find(a); if (it != annotationClasses.end()) { @@ -955,7 +955,7 @@ bool Domain::removeAnnotationClass(Handle<AnnotationClass> a) return false; } -Rooted<AnnotationClass> Domain::createAnnotationClass(std::string name) +Rooted<AnnotationClass> Ontology::createAnnotationClass(std::string name) { return Rooted<AnnotationClass>{ new AnnotationClass(getManager(), std::move(name), this)}; @@ -974,7 +974,7 @@ const Rtti StructuredClass = .composedOf(&FieldDescriptor); const Rtti AnnotationClass = RttiBuilder<ousia::AnnotationClass>("AnnotationClass").parent(&Descriptor); -const Rtti Domain = RttiBuilder<ousia::Domain>("Domain") +const Rtti Ontology = RttiBuilder<ousia::Ontology>("Ontology") .parent(&RootNode) .composedOf({&StructuredClass, &AnnotationClass}); } diff --git a/src/core/model/Domain.hpp b/src/core/model/Ontology.hpp index 7e10d91..948caa5 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Ontology.hpp @@ -17,11 +17,11 @@ */ /** - * @file Domain.hpp + * @file Ontology.hpp * - * This header contains the class hierarchy of descriptor classes for domains. - * Properly connected instances of these classes with a Domain node as root - * describe a semantic Domain in a formal way. It specifies the allowed (tree) + * This header contains the class hierarchy of descriptor classes for ontologies. + * Properly connected instances of these classes with a Ontology node as root + * describe a semantic Ontology in a formal way. It specifies the allowed (tree) * structure of a document by means of StructuredClasses as well as the allowed * Annotations by means of AnnotationClasses. * @@ -33,7 +33,7 @@ * book and one for the actual structure. Consider the following XML: * * \code{.xml} - * <domain name="book"> + * <ontology name="book"> * <struct name="book" cardinality="1" isRoot="true"> * <field> * <childRef ref="book.chapter"/> @@ -65,7 +65,7 @@ * <struct name="text" transparent="true"> * <primitive type="string"/> * </struct> - * </domain> + * </ontology> * \endcode * * Note that we define one field as the TREE (meaning the main or default @@ -95,12 +95,12 @@ * the proper StructuredClass. This can be regulated by the "cardinality" * property of a StructuredClass. * - * It is possible to add further fields, like we would in the "headings" domain + * It is possible to add further fields, like we would in the "headings" ontology * to add titles to our structure. * * \code{.xml} - * <domain name="headings"> - * <import rel="domain" src="./book_domain.osxml"/> + * <ontology name="headings"> + * <import rel="ontology" src="./book_ontology.osxml"/> * <struct name="heading" cardinality="1" transparent="true"> * <parentRef ref="book.book"> * <field name="heading" isSubtree="true" optional="true"/> @@ -108,7 +108,7 @@ * ... * <fieldRef name="book.paragraph."> * </struct> - * </domain> + * </ontology> * \endcode * * This would change the context free grammar as follows: @@ -119,14 +119,14 @@ * \endcode * * AnnotationClasses on the other hand do not specify a context free grammar. - * They merely specify what kinds of Annotations are allowed within this domain + * They merely specify what kinds of Annotations are allowed within this ontology * and which fields or attributes they have. Note that Annotations are allowed * to define structured children that manifest e.g. meta information of that - * Annotation. An example for that would be the "comment" domain: + * Annotation. An example for that would be the "comment" ontology: * * \code{.xml} - * <domain name="comments"> - * <import rel="domain" src="./book_domain.osxml"/> + * <ontology name="comments"> + * <import rel="ontology" src="./book_ontology.osxml"/> * * <annotation name="comment"> * <field name="content" isSubtree="true"> @@ -156,7 +156,7 @@ * <childRef ref="reply"/> * </field> * </struct> - * </domain> + * </ontology> * \endcode * * Here we have comment annotations, which have a reply tree as sub structure. @@ -180,7 +180,7 @@ namespace ousia { class Rtti; class Descriptor; class StructuredClass; -class Domain; +class Ontology; /** * Magic field name used to identify the default field. The default field is @@ -481,8 +481,8 @@ protected: bool doValidate(Logger &logger) const override; public: - Descriptor(Manager &mgr, std::string name, Handle<Domain> domain) - : Node(mgr, std::move(name), domain), + Descriptor(Manager &mgr, std::string name, Handle<Ontology> ontology) + : Node(mgr, std::move(name), ontology), attributesDescriptor(acquire(new StructType(mgr, "", nullptr))), fieldDescriptors(this) { @@ -490,10 +490,10 @@ public: /** * Returns a reference to the StructType that specifies the attribute keys - * as well as value domains for this Descriptor. + * as well as value ontologies for this Descriptor. * * @return a reference to the StructType that specifies the attribute keys - * as well as value domains for this Descriptor. + * as well as value ontologies for this Descriptor. */ Rooted<StructType> getAttributesDescriptor() const { @@ -645,7 +645,7 @@ public: /** * This tries to construct the shortest possible path of this Descriptor - * to the given child Descriptor. As an example consider the book domain + * to the given child Descriptor. As an example consider the book ontology * from above. * * First consider the call book->pathTo(chapter). This is an easy example: @@ -729,17 +729,17 @@ public: /** * A StructuredClass specifies nodes in the StructureTree of a document that - * implements this domain. For more information on the StructureTree please + * implements this ontology. For more information on the StructureTree please * consult the Header documentation above. * - * Note that a StructuredClass may "invade" an existing Domain description by + * Note that a StructuredClass may "invade" an existing Ontology description by * defining itself as a viable child in one existing field. Consider the - * example of the "heading" domain from the header documentation again: + * example of the "heading" ontology from the header documentation again: * * \code{.xml} - * <domain name="headings"> + * <ontology name="headings"> * <head> - * <import rel="domain" src="book.oxm"/> + * <import rel="ontology" src="book.oxm"/> * </head> * <structs> * <struct name="heading" cardinality="0-1" transparent="true"> @@ -753,14 +753,14 @@ public: * <fieldRef name="book.paragraph."> * </fields> * </structs> - * </domain> + * </ontology> * \endcode * - * The "parent" construct allows to "invade" another domain. + * The "parent" construct allows to "invade" another ontology. * - * This does indeed interfere with an existing domain and one must carefully + * This does indeed interfere with an existing ontology and one must carefully * craft such parent references to not create undesired side effects. However - * they provide the most convenient mechanism to extend existing domains + * they provide the most convenient mechanism to extend existing ontologies * without having to rewrite them. * * Another important factor is the 'transparent' flag. Transparent @@ -798,7 +798,7 @@ public: * Inheritance therefore also goes for fields. */ class StructuredClass : public Descriptor { - friend Domain; + friend Ontology; private: const Variant cardinality; @@ -824,7 +824,7 @@ public: * * @param mgr is the current Manager. * @param name is the name of the StructuredClass. - * @param domain is the Domain this StructuredClass belongs + * @param ontology is the Ontology this StructuredClass belongs * to. * @param cardinality specifies how often an element of this type * may occur at a specific point in the @@ -846,7 +846,7 @@ public: * allowed to be at the root of a Document. */ StructuredClass(Manager &mgr, std::string name, - Handle<Domain> domain = nullptr, + Handle<Ontology> ontology = nullptr, Variant cardinality = Cardinality::any(), Handle<StructuredClass> superclass = nullptr, bool transparent = false, bool root = false); @@ -972,7 +972,7 @@ public: * This class has no special properties and is in essence just a Descriptor. */ class AnnotationClass : public Descriptor { - friend Domain; + friend Ontology; public: /** @@ -983,18 +983,18 @@ public: * @param name is a name for this AnnotationClass that will * be used for later references to this * AnnotationClass. - * @param domain is the Domain this AnnotationClass belongs + * @param ontology is the Ontology this AnnotationClass belongs * to. */ - AnnotationClass(Manager &mgr, std::string name, Handle<Domain> domain); + AnnotationClass(Manager &mgr, std::string name, Handle<Ontology> ontology); }; /** - * A Domain node specifies which StructuredClasses and which AnnotationClasses - * are part of this domain. TODO: Do we want to be able to restrict Annotations + * A Ontology node specifies which StructuredClasses and which AnnotationClasses + * are part of this ontology. TODO: Do we want to be able to restrict Annotations * to certain Structures? */ -class Domain : public RootNode { +class Ontology : public RootNode { friend StructuredClass; friend AnnotationClass; @@ -1002,7 +1002,7 @@ private: NodeVector<StructuredClass> structuredClasses; NodeVector<AnnotationClass> annotationClasses; NodeVector<Typesystem> typesystems; - NodeVector<Domain> domains; + NodeVector<Ontology> ontologies; protected: void doResolve(ResolutionState &state) override; @@ -1012,81 +1012,81 @@ protected: public: /** - * The constructor for a new domain. Note that this is an empty Domain and + * The constructor for a new ontology. Note that this is an empty Ontology and * still has to be filled with StructuredClasses and AnnotationClasses. * * @param mgr is the Manager instance. - * @param name is a name for this domain which will be used for later - * references to this Domain. + * @param name is a name for this ontology which will be used for later + * references to this Ontology. */ - Domain(Manager &mgr, std::string name = "") + Ontology(Manager &mgr, std::string name = "") : RootNode(mgr, std::move(name), nullptr), structuredClasses(this), annotationClasses(this), typesystems(this), - domains(this) + ontologies(this) { } /** - * The constructor for a new domain. Note that this is an empty Domain and + * The constructor for a new ontology. Note that this is an empty Ontology and * still has to be filled with StructuredClasses and AnnotationClasses. * * @param mgr is the Manager instance. * @param sys is the SystemTypesystem instance. - * @param name is a name for this domain which will be used for later - * references to this Domain. + * @param name is a name for this ontology which will be used for later + * references to this Ontology. */ - Domain(Manager &mgr, Handle<SystemTypesystem> sys, std::string name = "") - : Domain(mgr, std::move(name)) + Ontology(Manager &mgr, Handle<SystemTypesystem> sys, std::string name = "") + : Ontology(mgr, std::move(name)) { referenceTypesystem(sys); } /** - * Creates a new Domain and returns it. + * Creates a new Ontology and returns it. * * @param mgr is the Manager instance. - * @param name is a name for this domain which will be used for later - * references to this Domain. + * @param name is a name for this ontology which will be used for later + * references to this Ontology. */ - static Rooted<Domain> createEmptyDomain(Manager &mgr, std::string name) + static Rooted<Ontology> createEmptyOntology(Manager &mgr, std::string name) { - return Rooted<Domain>{new Domain(mgr, std::move(name))}; + return Rooted<Ontology>{new Ontology(mgr, std::move(name))}; } /** * Returns a const reference to the NodeVector of StructuredClasses that are - * part of this Domain. + * part of this Ontology. * * @return a const reference to the NodeVector of StructuredClasses that are - * part of this Domain. + * part of this Ontology. */ const NodeVector<StructuredClass> &getStructureClasses() const { return structuredClasses; } /** - * Adds a StructuredClass to this domain. This also sets the parent of the - * given StructuredClass if it is not set to this Domain already and removes - * it from the old Domain. + * Adds a StructuredClass to this ontology. This also sets the parent of the + * given StructuredClass if it is not set to this Ontology already and removes + * it from the old Ontology. * * @param s is some StructuredClass. */ void addStructuredClass(Handle<StructuredClass> s); /** - * Removes a StructuredClass from this domain. This also sets the parent of + * Removes a StructuredClass from this ontology. This also sets the parent of * the given StructuredClass to null. * * @param s is some StructuredClass. * @return true if the given StructuredClass was removed and false if this - * Domain did not have the given StructuredClass as child. + * Ontology did not have the given StructuredClass as child. */ bool removeStructuredClass(Handle<StructuredClass> s); /** - * This creates a new StructuredClass and appends it to this Domain. + * This creates a new StructuredClass and appends it to this Ontology. * * @param name is the name of the StructuredClass. * @param cardinality specifies how often an element of this type @@ -1117,36 +1117,36 @@ public: /** * Returns a const reference to the NodeVector of AnnotationClasses that are - * part of this Domain. + * part of this Ontology. * * @return a const reference to the NodeVector of AnnotationClasses that are - * part of this Domain. + * part of this Ontology. */ const NodeVector<AnnotationClass> &getAnnotationClasses() const { return annotationClasses; } /** - * Adds an AnnotationClass to this domain. This also sets the parent of the - * given AnnotationClass if it is not set to this Domain already and removes - * it from the old Domain. + * Adds an AnnotationClass to this ontology. This also sets the parent of the + * given AnnotationClass if it is not set to this Ontology already and removes + * it from the old Ontology. * * @param a is some AnnotationClass. */ void addAnnotationClass(Handle<AnnotationClass> a); /** - * Removes a AnnotationClass from this domain. This also sets the parent of + * Removes a AnnotationClass from this ontology. This also sets the parent of * the given AnnotationClass to null. * * @param a is some AnnotationClass. * @return true if the given AnnotationClass was removed and false if this - * Domain did not have the given AnnotationClass as child. + * Ontology did not have the given AnnotationClass as child. */ bool removeAnnotationClass(Handle<AnnotationClass> a); /** - * This creates a new AnnotationClass and appends it to this Domain. + * This creates a new AnnotationClass and appends it to this Ontology. * * @param name is a name for this AnnotationClass that will * be used for later references to this @@ -1156,20 +1156,20 @@ public: /** * Returns a const reference to the NodeVector of TypeSystems that are - * references in this Domain. + * references in this Ontology. * * @return a const reference to the NodeVector of TypeSystems that are - * references in this Domain. + * references in this Ontology. */ const NodeVector<Typesystem> &getTypesystems() const { return typesystems; } /** - * Adds a Typesystem reference to this Domain. + * Adds a Typesystem reference to this Ontology. */ void referenceTypesystem(Handle<Typesystem> t) { typesystems.push_back(t); } /** - * Adds multiple Typesystem references to this Domain. + * Adds multiple Typesystem references to this Ontology. */ void referenceTypesystems(const std::vector<Handle<Typesystem>> &ts) { @@ -1177,16 +1177,16 @@ public: } /** - * Adds a Domain reference to this Domain. + * Adds a Ontology reference to this Ontology. */ - void referenceDomain(Handle<Domain> d) { domains.push_back(d); } + void referenceOntology(Handle<Ontology> d) { ontologies.push_back(d); } /** - * Adds multiple Domain references to this Domain. + * Adds multiple Ontology references to this Ontology. */ - void referenceDomains(const std::vector<Handle<Domain>> &ds) + void referenceOntologys(const std::vector<Handle<Ontology>> &ds) { - domains.insert(domains.end(), ds.begin(), ds.end()); + ontologies.insert(ontologies.end(), ds.begin(), ds.end()); } }; @@ -1196,7 +1196,7 @@ extern const Rtti FieldDescriptor; extern const Rtti Descriptor; extern const Rtti StructuredClass; extern const Rtti AnnotationClass; -extern const Rtti Domain; +extern const Rtti Ontology; } } diff --git a/src/core/model/Project.cpp b/src/core/model/Project.cpp index f7dab8a..ecc0589 100644 --- a/src/core/model/Project.cpp +++ b/src/core/model/Project.cpp @@ -18,7 +18,7 @@ #include <core/common/RttiBuilder.hpp> -#include "Domain.hpp" +#include "Ontology.hpp" #include "Document.hpp" #include "Project.hpp" #include "Typesystem.hpp" @@ -69,9 +69,9 @@ Rooted<Document> Project::createDocument(const std::string &name) return document; } -Rooted<Domain> Project::createDomain(const std::string &name) +Rooted<Ontology> Project::createOntology(const std::string &name) { - return Rooted<Domain>{new Domain(getManager(), systemTypesystem, name)}; + return Rooted<Ontology>{new Ontology(getManager(), systemTypesystem, name)}; } void Project::referenceDocument(Handle<Document> document) diff --git a/src/core/model/Project.hpp b/src/core/model/Project.hpp index 480609c..97c711c 100644 --- a/src/core/model/Project.hpp +++ b/src/core/model/Project.hpp @@ -20,7 +20,7 @@ * @file Project.hpp * * Contains the concept of the "Project" class which represents the entity into - * which domains, documents, typesystems and other resources are embedded. + * which ontologies, documents, typesystems and other resources are embedded. * * @author Andreas Stöckel (astoecke@techfak.uni-bielefeld.de) */ @@ -40,12 +40,12 @@ class Registry; class SystemTypesystem; class Typesystem; class Document; -class Domain; +class Ontology; /** * The Project class constitutes the top-level node in which a collection of * documents are stored. It also contains an instance of the SystemTypesystem - * and allows for simple creation of new Typesystem and Domain instances. + * and allows for simple creation of new Typesystem and Ontology instances. */ class Project : public RootNode { private: @@ -99,12 +99,12 @@ public: Rooted<Document> createDocument(const std::string &name); /** - * Returns a new domain with the given name and adds it to the list of - * domains. Provides a reference of the system typesystem to the domain. + * Returns a new ontology with the given name and adds it to the list of + * ontologies. Provides a reference of the system typesystem to the ontology. * - * @param name is the name of the domain that should be created. + * @param name is the name of the ontology that should be created. */ - Rooted<Domain> createDomain(const std::string &name); + Rooted<Ontology> createOntology(const std::string &name); /** * Adds the given document to the list of documents in the project. diff --git a/src/core/model/RootNode.hpp b/src/core/model/RootNode.hpp index 173a6e4..d26917f 100644 --- a/src/core/model/RootNode.hpp +++ b/src/core/model/RootNode.hpp @@ -37,7 +37,7 @@ namespace ousia { /** * The RootNode class represents a Node that may be a Root node (such as - * Documents, Typesystems and Domains). Root nodes have the property, that the + * Documents, Typesystems and Ontologys). Root nodes have the property, that the * allow importing/referencing other Nodes. */ class RootNode : public Node { diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp index dabb03c..c46dc51 100644 --- a/src/core/parser/ParserScope.cpp +++ b/src/core/parser/ParserScope.cpp @@ -19,7 +19,7 @@ #include <core/common/Exceptions.hpp> #include <core/common/Utils.hpp> #include <core/common/VariantWriter.hpp> -#include <core/model/Domain.hpp> +#include <core/model/Ontology.hpp> #include <core/model/Typesystem.hpp> #include <core/model/RootNode.hpp> diff --git a/src/core/parser/stack/DocumentHandler.cpp b/src/core/parser/stack/DocumentHandler.cpp index bb04bd3..2144c34 100644 --- a/src/core/parser/stack/DocumentHandler.cpp +++ b/src/core/parser/stack/DocumentHandler.cpp @@ -22,7 +22,7 @@ #include <core/common/Utils.hpp> #include <core/common/VariantReader.hpp> #include <core/model/Document.hpp> -#include <core/model/Domain.hpp> +#include <core/model/Ontology.hpp> #include <core/model/Project.hpp> #include <core/model/Typesystem.hpp> #include <core/parser/ParserScope.hpp> diff --git a/src/core/parser/stack/DocumentHandler.hpp b/src/core/parser/stack/DocumentHandler.hpp index 862081c..44feb2b 100644 --- a/src/core/parser/stack/DocumentHandler.hpp +++ b/src/core/parser/stack/DocumentHandler.hpp @@ -46,7 +46,7 @@ namespace parser_stack { /** * The DocumentHandler class parses the "document" tag that is used to introduce * a new document. Note that this tag is not mandatory in osml files -- if the - * first command is not a typesystem, domain or any other declarative command, + * first command is not a typesystem, ontology or any other declarative command, * the DocumentHandler will be implicitly called. */ class DocumentHandler : public StaticHandler { diff --git a/src/core/parser/stack/GenericParserStates.cpp b/src/core/parser/stack/GenericParserStates.cpp index 69a6e0e..7287524 100644 --- a/src/core/parser/stack/GenericParserStates.cpp +++ b/src/core/parser/stack/GenericParserStates.cpp @@ -17,7 +17,7 @@ */ #include "DocumentHandler.hpp" -#include "DomainHandler.hpp" +#include "OntologyHandler.hpp" #include "GenericParserStates.hpp" #include "ImportIncludeHandler.hpp" #include "TypesystemHandler.hpp" @@ -28,18 +28,18 @@ namespace parser_stack { const std::multimap<std::string, const State *> GenericParserStates{ {"document", &States::Document}, {"*", &States::DocumentChild}, - {"domain", &States::Domain}, - {"struct", &States::DomainStruct}, - {"annotation", &States::DomainAnnotation}, - {"attributes", &States::DomainAttributes}, - {"attribute", &States::DomainAttribute}, - {"field", &States::DomainField}, - {"fieldRef", &States::DomainFieldRef}, - {"primitive", &States::DomainStructPrimitive}, - {"childRef", &States::DomainStructChild}, - {"parentRef", &States::DomainStructParent}, - {"field", &States::DomainStructParentField}, - {"fieldRef", &States::DomainStructParentFieldRef}, + {"ontology", &States::Ontology}, + {"struct", &States::OntologyStruct}, + {"annotation", &States::OntologyAnnotation}, + {"attributes", &States::OntologyAttributes}, + {"attribute", &States::OntologyAttribute}, + {"field", &States::OntologyField}, + {"fieldRef", &States::OntologyFieldRef}, + {"primitive", &States::OntologyStructPrimitive}, + {"childRef", &States::OntologyStructChild}, + {"parentRef", &States::OntologyStructParent}, + {"field", &States::OntologyStructParentField}, + {"fieldRef", &States::OntologyStructParentFieldRef}, {"typesystem", &States::Typesystem}, {"enum", &States::TypesystemEnum}, {"entry", &States::TypesystemEnumEntry}, diff --git a/src/core/parser/stack/ImportIncludeHandler.cpp b/src/core/parser/stack/ImportIncludeHandler.cpp index d1ea97d..a6cbaea 100644 --- a/src/core/parser/stack/ImportIncludeHandler.cpp +++ b/src/core/parser/stack/ImportIncludeHandler.cpp @@ -20,7 +20,7 @@ #include <core/parser/ParserScope.hpp> #include <core/parser/ParserContext.hpp> -#include "DomainHandler.hpp" +#include "OntologyHandler.hpp" #include "DocumentHandler.hpp" #include "ImportIncludeHandler.hpp" #include "State.hpp" @@ -38,7 +38,7 @@ void ImportHandler::doHandle(const Variant &fieldData, Variant::mapType &args) Rooted<Node> leaf = scope().getLeaf(); if (leaf == nullptr || !leaf->isa(&RttiTypes::RootNode)) { logger().error( - "Import not supported here, must be inside a document, domain " + "Import not supported here, must be inside a document, ontology " "or typesystem command.", location()); return; @@ -66,7 +66,7 @@ void IncludeHandler::doHandle(const Variant &fieldData, Variant::mapType &args) namespace States { const State Import = StateBuilder() - .parents({&Document, &Typesystem, &Domain}) + .parents({&Document, &Typesystem, &Ontology}) .elementHandler(ImportHandler::create) .arguments({Argument::String("rel", ""), Argument::String("type", ""), Argument::String("src", "")}); diff --git a/src/core/parser/stack/DomainHandler.cpp b/src/core/parser/stack/OntologyHandler.cpp index e86f893..8c0e4d9 100644 --- a/src/core/parser/stack/DomainHandler.cpp +++ b/src/core/parser/stack/OntologyHandler.cpp @@ -18,52 +18,52 @@ #include <core/common/RttiBuilder.hpp> #include <core/model/Document.hpp> -#include <core/model/Domain.hpp> +#include <core/model/Ontology.hpp> #include <core/model/Project.hpp> #include <core/parser/ParserScope.hpp> #include <core/parser/ParserContext.hpp> #include "DocumentHandler.hpp" -#include "DomainHandler.hpp" +#include "OntologyHandler.hpp" #include "State.hpp" #include "TypesystemHandler.hpp" namespace ousia { namespace parser_stack { -/* DomainHandler */ +/* OntologyHandler */ -bool DomainHandler::start(Variant::mapType &args) +bool OntologyHandler::start(Variant::mapType &args) { - // Create the Domain node - Rooted<Domain> domain = - context().getProject()->createDomain(args["name"].asString()); - domain->setLocation(location()); + // Create the Ontology node + Rooted<Ontology> ontology = + context().getProject()->createOntology(args["name"].asString()); + ontology->setLocation(location()); - // If the domain is defined inside a document, add the reference to the + // If the ontology is defined inside a document, add the reference to the // document Rooted<Document> document = scope().select<Document>(); if (document != nullptr) { - document->reference(domain); + document->reference(ontology); } // Push the typesystem onto the scope, set the POST_HEAD flag to true - scope().push(domain); + scope().push(ontology); scope().setFlag(ParserFlag::POST_HEAD, false); return true; } -void DomainHandler::end() { scope().pop(logger()); } +void OntologyHandler::end() { scope().pop(logger()); } -/* DomainStructHandler */ +/* OntologyStructHandler */ -bool DomainStructHandler::start(Variant::mapType &args) +bool OntologyStructHandler::start(Variant::mapType &args) { scope().setFlag(ParserFlag::POST_HEAD, true); - Rooted<Domain> domain = scope().selectOrThrow<Domain>(); + Rooted<Ontology> ontology = scope().selectOrThrow<Ontology>(); - Rooted<StructuredClass> structuredClass = domain->createStructuredClass( + Rooted<StructuredClass> structuredClass = ontology->createStructuredClass( args["name"].asString(), args["cardinality"].asCardinality(), nullptr, args["transparent"].asBool(), args["isRoot"].asBool()); structuredClass->setLocation(location()); @@ -85,28 +85,28 @@ bool DomainStructHandler::start(Variant::mapType &args) return true; } -void DomainStructHandler::end() { scope().pop(logger()); } +void OntologyStructHandler::end() { scope().pop(logger()); } -/* DomainAnnotationHandler */ -bool DomainAnnotationHandler::start(Variant::mapType &args) +/* OntologyAnnotationHandler */ +bool OntologyAnnotationHandler::start(Variant::mapType &args) { scope().setFlag(ParserFlag::POST_HEAD, true); - Rooted<Domain> domain = scope().selectOrThrow<Domain>(); + Rooted<Ontology> ontology = scope().selectOrThrow<Ontology>(); Rooted<AnnotationClass> annotationClass = - domain->createAnnotationClass(args["name"].asString()); + ontology->createAnnotationClass(args["name"].asString()); annotationClass->setLocation(location()); scope().push(annotationClass); return true; } -void DomainAnnotationHandler::end() { scope().pop(logger()); } +void OntologyAnnotationHandler::end() { scope().pop(logger()); } -/* DomainAttributesHandler */ +/* OntologyAttributesHandler */ -bool DomainAttributesHandler::start(Variant::mapType &args) +bool OntologyAttributesHandler::start(Variant::mapType &args) { // Fetch the current typesystem and create the struct node Rooted<Descriptor> parent = scope().selectOrThrow<Descriptor>(); @@ -118,11 +118,11 @@ bool DomainAttributesHandler::start(Variant::mapType &args) return true; } -void DomainAttributesHandler::end() { scope().pop(logger()); } +void OntologyAttributesHandler::end() { scope().pop(logger()); } -/* DomainFieldHandler */ +/* OntologyFieldHandler */ -bool DomainFieldHandler::start(Variant::mapType &args) +bool OntologyFieldHandler::start(Variant::mapType &args) { FieldDescriptor::FieldType type; if (args["isSubtree"].asBool()) { @@ -148,11 +148,11 @@ bool DomainFieldHandler::start(Variant::mapType &args) return true; } -void DomainFieldHandler::end() { scope().pop(logger()); } +void OntologyFieldHandler::end() { scope().pop(logger()); } -/* DomainFieldRefHandler */ +/* OntologyFieldRefHandler */ -bool DomainFieldRefHandler::start(Variant::mapType &args) +bool OntologyFieldRefHandler::start(Variant::mapType &args) { Rooted<Descriptor> parent = scope().selectOrThrow<Descriptor>(); @@ -178,11 +178,11 @@ bool DomainFieldRefHandler::start(Variant::mapType &args) return true; } -void DomainFieldRefHandler::end() {} +void OntologyFieldRefHandler::end() {} -/* DomainPrimitiveHandler */ +/* OntologyPrimitiveHandler */ -bool DomainPrimitiveHandler::start(Variant::mapType &args) +bool OntologyPrimitiveHandler::start(Variant::mapType &args) { Rooted<Descriptor> parent = scope().selectOrThrow<Descriptor>(); @@ -218,11 +218,11 @@ bool DomainPrimitiveHandler::start(Variant::mapType &args) return true; } -void DomainPrimitiveHandler::end() { scope().pop(logger()); } +void OntologyPrimitiveHandler::end() { scope().pop(logger()); } -/* DomainChildHandler */ +/* OntologyChildHandler */ -bool DomainChildHandler::start(Variant::mapType &args) +bool OntologyChildHandler::start(Variant::mapType &args) { Rooted<FieldDescriptor> field = scope().selectOrThrow<FieldDescriptor>(); @@ -238,26 +238,26 @@ bool DomainChildHandler::start(Variant::mapType &args) return true; } -/* DomainParentHandler */ +/* OntologyParentHandler */ -bool DomainParentHandler::start(Variant::mapType &args) +bool OntologyParentHandler::start(Variant::mapType &args) { Rooted<StructuredClass> strct = scope().selectOrThrow<StructuredClass>(); - Rooted<DomainParent> parent{ - new DomainParent(strct->getManager(), args["ref"].asString(), strct)}; + Rooted<OntologyParent> parent{ + new OntologyParent(strct->getManager(), args["ref"].asString(), strct)}; parent->setLocation(location()); scope().push(parent); return true; } -void DomainParentHandler::end() { scope().pop(logger()); } +void OntologyParentHandler::end() { scope().pop(logger()); } -/* DomainParentFieldHandler */ +/* OntologyParentFieldHandler */ -bool DomainParentFieldHandler::start(Variant::mapType &args) +bool OntologyParentFieldHandler::start(Variant::mapType &args) { - Rooted<DomainParent> parentNameNode = scope().selectOrThrow<DomainParent>(); + Rooted<OntologyParent> parentNameNode = scope().selectOrThrow<OntologyParent>(); FieldDescriptor::FieldType type; if (args["isSubtree"].asBool()) { type = FieldDescriptor::FieldType::SUBTREE; @@ -286,11 +286,11 @@ bool DomainParentFieldHandler::start(Variant::mapType &args) return true; } -/* DomainParentFieldRefHandler */ +/* OntologyParentFieldRefHandler */ -bool DomainParentFieldRefHandler::start(Variant::mapType &args) +bool OntologyParentFieldRefHandler::start(Variant::mapType &args) { - Rooted<DomainParent> parentNameNode = scope().selectOrThrow<DomainParent>(); + Rooted<OntologyParent> parentNameNode = scope().selectOrThrow<OntologyParent>(); const std::string &name = args["ref"].asString(); Rooted<StructuredClass> strct = @@ -318,100 +318,100 @@ bool DomainParentFieldRefHandler::start(Variant::mapType &args) } namespace States { -const State Domain = StateBuilder() +const State Ontology = StateBuilder() .parents({&None, &Document}) - .createdNodeType(&RttiTypes::Domain) - .elementHandler(DomainHandler::create) + .createdNodeType(&RttiTypes::Ontology) + .elementHandler(OntologyHandler::create) .arguments({Argument::String("name")}); -const State DomainStruct = +const State OntologyStruct = StateBuilder() - .parent(&Domain) + .parent(&Ontology) .createdNodeType(&RttiTypes::StructuredClass) - .elementHandler(DomainStructHandler::create) + .elementHandler(OntologyStructHandler::create) .arguments({Argument::String("name"), Argument::Cardinality("cardinality", Cardinality::any()), Argument::Bool("isRoot", false), Argument::Bool("transparent", false), Argument::String("isa", "")}); -const State DomainAnnotation = +const State OntologyAnnotation = StateBuilder() - .parent(&Domain) + .parent(&Ontology) .createdNodeType(&RttiTypes::AnnotationClass) - .elementHandler(DomainAnnotationHandler::create) + .elementHandler(OntologyAnnotationHandler::create) .arguments({Argument::String("name")}); -const State DomainAttributes = +const State OntologyAttributes = StateBuilder() - .parents({&DomainStruct, &DomainAnnotation}) + .parents({&OntologyStruct, &OntologyAnnotation}) .createdNodeType(&RttiTypes::StructType) - .elementHandler(DomainAttributesHandler::create) + .elementHandler(OntologyAttributesHandler::create) .arguments({}); -const State DomainAttribute = +const State OntologyAttribute = StateBuilder() - .parent(&DomainAttributes) + .parent(&OntologyAttributes) .elementHandler(TypesystemStructFieldHandler::create) .arguments({Argument::String("name"), Argument::String("type"), Argument::Any("default", Variant::fromObject(nullptr))}); -const State DomainField = StateBuilder() - .parents({&DomainStruct, &DomainAnnotation}) +const State OntologyField = StateBuilder() + .parents({&OntologyStruct, &OntologyAnnotation}) .createdNodeType(&RttiTypes::FieldDescriptor) - .elementHandler(DomainFieldHandler::create) + .elementHandler(OntologyFieldHandler::create) .arguments({Argument::String("name", ""), Argument::Bool("isSubtree", false), Argument::Bool("optional", false)}); -const State DomainFieldRef = +const State OntologyFieldRef = StateBuilder() - .parents({&DomainStruct, &DomainAnnotation}) + .parents({&OntologyStruct, &OntologyAnnotation}) .createdNodeType(&RttiTypes::FieldDescriptor) - .elementHandler(DomainFieldRefHandler::create) + .elementHandler(OntologyFieldRefHandler::create) .arguments({Argument::String("ref", DEFAULT_FIELD_NAME)}); -const State DomainStructPrimitive = +const State OntologyStructPrimitive = StateBuilder() - .parents({&DomainStruct, &DomainAnnotation}) + .parents({&OntologyStruct, &OntologyAnnotation}) .createdNodeType(&RttiTypes::FieldDescriptor) - .elementHandler(DomainPrimitiveHandler::create) + .elementHandler(OntologyPrimitiveHandler::create) .arguments( {Argument::String("name", ""), Argument::Bool("isSubtree", false), Argument::Bool("optional", false), Argument::String("type")}); -const State DomainStructChild = StateBuilder() - .parent(&DomainField) - .elementHandler(DomainChildHandler::create) +const State OntologyStructChild = StateBuilder() + .parent(&OntologyField) + .elementHandler(OntologyChildHandler::create) .arguments({Argument::String("ref")}); -const State DomainStructParent = +const State OntologyStructParent = StateBuilder() - .parent(&DomainStruct) - .createdNodeType(&RttiTypes::DomainParent) - .elementHandler(DomainParentHandler::create) + .parent(&OntologyStruct) + .createdNodeType(&RttiTypes::OntologyParent) + .elementHandler(OntologyParentHandler::create) .arguments({Argument::String("ref")}); -const State DomainStructParentField = +const State OntologyStructParentField = StateBuilder() - .parent(&DomainStructParent) + .parent(&OntologyStructParent) .createdNodeType(&RttiTypes::FieldDescriptor) - .elementHandler(DomainParentFieldHandler::create) + .elementHandler(OntologyParentFieldHandler::create) .arguments({Argument::String("name", ""), Argument::Bool("isSubtree", false), Argument::Bool("optional", false)}); -const State DomainStructParentFieldRef = +const State OntologyStructParentFieldRef = StateBuilder() - .parent(&DomainStructParent) + .parent(&OntologyStructParent) .createdNodeType(&RttiTypes::FieldDescriptor) - .elementHandler(DomainParentFieldRefHandler::create) + .elementHandler(OntologyParentFieldRefHandler::create) .arguments({Argument::String("ref", DEFAULT_FIELD_NAME)}); } } namespace RttiTypes { -const Rtti DomainParent = RttiBuilder<ousia::parser_stack::DomainParent>( - "DomainParent").parent(&Node); +const Rtti OntologyParent = RttiBuilder<ousia::parser_stack::OntologyParent>( + "OntologyParent").parent(&Node); } } diff --git a/src/core/parser/stack/DomainHandler.hpp b/src/core/parser/stack/OntologyHandler.hpp index 76172d6..caeacc7 100644 --- a/src/core/parser/stack/DomainHandler.hpp +++ b/src/core/parser/stack/OntologyHandler.hpp @@ -17,10 +17,10 @@ */ /** - * @file DomainHandler.hpp + * @file OntologyHandler.hpp * - * Contains the Handler classes used for parsing Domain descriptors. This - * includes the "domain" tag and all describing tags below the "domain" tag. + * Contains the Handler classes used for parsing Ontology descriptors. This + * includes the "ontology" tag and all describing tags below the "ontology" tag. * * @author Benjamin Paaßen (bpaassen@techfak.uni-bielefeld.de) */ @@ -42,7 +42,7 @@ namespace parser_stack { // TODO: Documentation -class DomainHandler : public StaticHandler { +class OntologyHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -51,11 +51,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainHandler{handlerData}; + return new OntologyHandler{handlerData}; } }; -class DomainStructHandler : public StaticHandler { +class OntologyStructHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -64,11 +64,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainStructHandler{handlerData}; + return new OntologyStructHandler{handlerData}; } }; -class DomainAnnotationHandler : public StaticHandler { +class OntologyAnnotationHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -77,11 +77,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainAnnotationHandler{handlerData}; + return new OntologyAnnotationHandler{handlerData}; } }; -class DomainAttributesHandler : public StaticHandler { +class OntologyAttributesHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -90,11 +90,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainAttributesHandler{handlerData}; + return new OntologyAttributesHandler{handlerData}; } }; -class DomainFieldHandler : public StaticHandler { +class OntologyFieldHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -103,11 +103,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainFieldHandler{handlerData}; + return new OntologyFieldHandler{handlerData}; } }; -class DomainFieldRefHandler : public StaticHandler { +class OntologyFieldRefHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -116,11 +116,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainFieldRefHandler{handlerData}; + return new OntologyFieldRefHandler{handlerData}; } }; -class DomainPrimitiveHandler : public StaticHandler { +class OntologyPrimitiveHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -129,11 +129,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainPrimitiveHandler{handlerData}; + return new OntologyPrimitiveHandler{handlerData}; } }; -class DomainChildHandler : public StaticHandler { +class OntologyChildHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -141,16 +141,16 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainChildHandler{handlerData}; + return new OntologyChildHandler{handlerData}; } }; -class DomainParent : public Node { +class OntologyParent : public Node { public: using Node::Node; }; -class DomainParentHandler : public StaticHandler { +class OntologyParentHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -159,11 +159,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainParentHandler{handlerData}; + return new OntologyParentHandler{handlerData}; } }; -class DomainParentFieldHandler : public StaticHandler { +class OntologyParentFieldHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -171,11 +171,11 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainParentFieldHandler{handlerData}; + return new OntologyParentFieldHandler{handlerData}; } }; -class DomainParentFieldRefHandler : public StaticHandler { +class OntologyParentFieldRefHandler : public StaticHandler { public: using StaticHandler::StaticHandler; @@ -183,75 +183,75 @@ public: static Handler *create(const HandlerData &handlerData) { - return new DomainParentFieldRefHandler{handlerData}; + return new OntologyParentFieldRefHandler{handlerData}; } }; namespace States { /** - * State representing a "domain" struct. + * State representing a "ontology" struct. */ -extern const State Domain; +extern const State Ontology; /** - * State representing a "struct" tag within a domain description. + * State representing a "struct" tag within a ontology description. */ -extern const State DomainStruct; +extern const State OntologyStruct; /** - * State representing an "annotation" tag within a domain description. + * State representing an "annotation" tag within a ontology description. */ -extern const State DomainAnnotation; +extern const State OntologyAnnotation; /** * State representing an "attributes" tag within a structure or annotation. */ -extern const State DomainAttributes; +extern const State OntologyAttributes; /** * State representing an "attribute" tag within the "attributes". */ -extern const State DomainAttribute; +extern const State OntologyAttribute; /** * State representing a "field" tag within a structure or annotation. */ -extern const State DomainField; +extern const State OntologyField; /** * State representing a "fieldref" tag within a structure or annotation. */ -extern const State DomainFieldRef; +extern const State OntologyFieldRef; /** * State representing a "primitive" tag within a structure or annotation. */ -extern const State DomainStructPrimitive; +extern const State OntologyStructPrimitive; /** * State representing a "child" tag within a structure or annotation. */ -extern const State DomainStructChild; +extern const State OntologyStructChild; /** * State representing a "parent" tag within a structure or annotation. */ -extern const State DomainStructParent; +extern const State OntologyStructParent; /** * State representing a "field" tag within a "parent" tag. */ -extern const State DomainStructParentField; +extern const State OntologyStructParentField; /** * State representing a "fieldRef" tag within a "parent" tag. */ -extern const State DomainStructParentFieldRef; +extern const State OntologyStructParentFieldRef; } } namespace RttiTypes { -extern const Rtti DomainParent; +extern const Rtti OntologyParent; } } #endif diff --git a/src/core/parser/stack/TypesystemHandler.cpp b/src/core/parser/stack/TypesystemHandler.cpp index de8ee49..b62f684 100644 --- a/src/core/parser/stack/TypesystemHandler.cpp +++ b/src/core/parser/stack/TypesystemHandler.cpp @@ -17,13 +17,13 @@ */ #include <core/model/Document.hpp> -#include <core/model/Domain.hpp> +#include <core/model/Ontology.hpp> #include <core/model/Typesystem.hpp> #include <core/parser/ParserScope.hpp> #include <core/parser/ParserContext.hpp> #include "DocumentHandler.hpp" -#include "DomainHandler.hpp" +#include "OntologyHandler.hpp" #include "State.hpp" #include "TypesystemHandler.hpp" @@ -39,12 +39,12 @@ bool TypesystemHandler::start(Variant::mapType &args) context().getProject()->createTypesystem(args["name"].asString()); typesystem->setLocation(location()); - // If the typesystem is defined inside a domain, add a reference to the - // typesystem to the domain -- do the same with a document, if no domain + // If the typesystem is defined inside a ontology, add a reference to the + // typesystem to the ontology -- do the same with a document, if no ontology // is found - Rooted<Domain> domain = scope().select<Domain>(); - if (domain != nullptr) { - domain->reference(typesystem); + Rooted<Ontology> ontology = scope().select<Ontology>(); + if (ontology != nullptr) { + ontology->reference(typesystem); } else { Rooted<Document> document = scope().select<Document>(); if (document != nullptr) { @@ -190,7 +190,7 @@ bool TypesystemConstantHandler::start(Variant::mapType &args) namespace States { const State Typesystem = StateBuilder() - .parents({&None, &Domain, &Document}) + .parents({&None, &Ontology, &Document}) .createdNodeType(&RttiTypes::Typesystem) .elementHandler(TypesystemHandler::create) .arguments({Argument::String("name", "")}); diff --git a/src/core/resource/Resource.cpp b/src/core/resource/Resource.cpp index 4b9e496..7bcaf88 100644 --- a/src/core/resource/Resource.cpp +++ b/src/core/resource/Resource.cpp @@ -42,7 +42,7 @@ static std::unordered_map<ResourceType, std::string, Utils::EnumHash> reverseMap static const std::unordered_map<std::string, ResourceType> NAME_RESOURCE_TYPE_MAP{{"document", ResourceType::DOCUMENT}, - {"domain", ResourceType::DOMAIN_DESC}, + {"ontology", ResourceType::ONTOLOGY}, {"typesystem", ResourceType::TYPESYSTEM}, {"attributes", ResourceType::ATTRIBUTES}, {"stylesheet", ResourceType::STYLESHEET}, diff --git a/src/core/resource/Resource.hpp b/src/core/resource/Resource.hpp index 63ed591..548a255 100644 --- a/src/core/resource/Resource.hpp +++ b/src/core/resource/Resource.hpp @@ -48,9 +48,9 @@ enum class ResourceType { UNKNOWN, /** - * The resource contains a domain description. + * The resource contains a ontology description. */ - DOMAIN_DESC, + ONTOLOGY, /** * The resource contains a typesystem description. diff --git a/src/core/resource/ResourceRequest.cpp b/src/core/resource/ResourceRequest.cpp index f01a324..3c01e6a 100644 --- a/src/core/resource/ResourceRequest.cpp +++ b/src/core/resource/ResourceRequest.cpp @@ -33,7 +33,7 @@ namespace ousia { namespace RttiTypes { extern const Rtti Document; -extern const Rtti Domain; +extern const Rtti Ontology; extern const Rtti Node; extern const Rtti Typesystem; } @@ -43,7 +43,7 @@ extern const Rtti Typesystem; */ static const std::unordered_map<const Rtti *, ResourceType> RTTI_RESOURCE_TYPE_MAP{{&RttiTypes::Document, ResourceType::DOCUMENT}, - {&RttiTypes::Domain, ResourceType::DOMAIN_DESC}, + {&RttiTypes::Ontology, ResourceType::ONTOLOGY}, {&RttiTypes::Typesystem, ResourceType::TYPESYSTEM}}; /** |