From a7019614896fdd3e29b9a28f6a8cfd2c1b365983 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Sun, 1 Mar 2015 20:47:25 +0100 Subject: Renamed domain to ontology. --- test/formats/osml/OsmlParserTest.cpp | 18 ++++---- test/formats/osxml/OsxmlParserTest.cpp | 80 +++++++++++++++++----------------- 2 files changed, 49 insertions(+), 49 deletions(-) (limited to 'test/formats') diff --git a/test/formats/osml/OsmlParserTest.cpp b/test/formats/osml/OsmlParserTest.cpp index 5127b32..c88232b 100644 --- a/test/formats/osml/OsmlParserTest.cpp +++ b/test/formats/osml/OsmlParserTest.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ namespace ousia { namespace RttiTypes { extern const Rtti Document; -extern const Rtti Domain; +extern const Rtti Ontology; extern const Rtti Typesystem; } @@ -70,15 +70,15 @@ TEST(OsmlParser, emptyDocument) ASSERT_TRUE(node->isa(&RttiTypes::Document)); } -TEST(OsmlParser, emptyDomain) +TEST(OsmlParser, emptyOntology) { OsmlStandaloneEnvironment env(logger); Rooted node = - env.parse("empty_domain.osml", "", "", RttiSet{&RttiTypes::Node}); + env.parse("empty_ontology.osml", "", "", RttiSet{&RttiTypes::Node}); ASSERT_TRUE(node != nullptr); - ASSERT_TRUE(node->isa(&RttiTypes::Domain)); - ASSERT_EQ("testDomain", node->getName()); + ASSERT_TRUE(node->isa(&RttiTypes::Ontology)); + ASSERT_EQ("testOntology", node->getName()); } TEST(OsmlParser, emptyTypesystem) @@ -106,13 +106,13 @@ TEST(OsmlParser, rollbackOnInvalidElement) ASSERT_TRUE(node->isa(&RttiTypes::Document)); } -TEST(OsmlParser, inlineDomain) +TEST(OsmlParser, inlineOntology) { OsmlStandaloneEnvironment env(logger); logger.reset(); Rooted node = - env.parse("inline_domain.osml", "", "", RttiSet{&RttiTypes::Node}); + env.parse("inline_ontology.osml", "", "", RttiSet{&RttiTypes::Node}); ASSERT_FALSE(logger.hasError()); ASSERT_TRUE(node != nullptr); @@ -156,7 +156,7 @@ TEST(OsmlParser, structureInheritance) ASSERT_FALSE(logger.hasError()); ASSERT_TRUE(node != nullptr); - ASSERT_TRUE(node->isa(&RttiTypes::Domain)); + ASSERT_TRUE(node->isa(&RttiTypes::Ontology)); } TEST(OsmlParser, structWithNoField) diff --git a/test/formats/osxml/OsxmlParserTest.cpp b/test/formats/osxml/OsxmlParserTest.cpp index 3bf4a47..79dd58b 100644 --- a/test/formats/osxml/OsxmlParserTest.cpp +++ b/test/formats/osxml/OsxmlParserTest.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ namespace ousia { namespace RttiTypes { extern const Rtti Document; -extern const Rtti Domain; +extern const Rtti Ontology; extern const Rtti Typesystem; } @@ -88,7 +88,7 @@ static void checkAttributes(Handle expected, } static void checkStructuredClass( - Handle n, const std::string &name, Handle domain, + Handle n, const std::string &name, Handle ontology, Variant cardinality = Cardinality::any(), Handle attributesDescriptor = nullptr, Handle superclass = nullptr, bool transparent = false, @@ -98,7 +98,7 @@ static void checkStructuredClass( Handle sc = n.cast(); ASSERT_FALSE(sc == nullptr); ASSERT_EQ(name, sc->getName()); - ASSERT_EQ(domain, sc->getParent()); + ASSERT_EQ(ontology, sc->getParent()); ASSERT_EQ(cardinality, sc->getCardinality()); ASSERT_EQ(transparent, sc->isTransparent()); ASSERT_EQ(root, sc->hasRootPermission()); @@ -106,44 +106,44 @@ static void checkStructuredClass( } static Rooted checkStructuredClass( - const std::string &resolve, const std::string &name, Handle domain, + const std::string &resolve, const std::string &name, Handle ontology, Variant cardinality = Cardinality::any(), Handle attributesDescriptor = nullptr, Handle superclass = nullptr, bool transparent = false, bool root = false) { - auto res = domain->resolve(&RttiTypes::StructuredClass, resolve); + auto res = ontology->resolve(&RttiTypes::StructuredClass, resolve); if (res.size() != 1) { throw OusiaException("resolution error!"); } Handle sc = res[0].node.cast(); - checkStructuredClass(sc, name, domain, cardinality, attributesDescriptor, + checkStructuredClass(sc, name, ontology, cardinality, attributesDescriptor, superclass, transparent, root); return sc; } static void checkAnnotationClass( - Handle n, const std::string &name, Handle domain, + Handle n, const std::string &name, Handle ontology, Handle attributesDescriptor = nullptr) { ASSERT_FALSE(n == nullptr); Handle ac = n.cast(); ASSERT_FALSE(ac == nullptr); ASSERT_EQ(name, ac->getName()); - ASSERT_EQ(domain, ac->getParent()); + ASSERT_EQ(ontology, ac->getParent()); checkAttributes(attributesDescriptor, ac); } static Rooted checkAnnotationClass( - const std::string &resolve, const std::string &name, Handle domain, + const std::string &resolve, const std::string &name, Handle ontology, Handle attributesDescriptor = nullptr) { - auto res = domain->resolve(&RttiTypes::AnnotationClass, resolve); + auto res = ontology->resolve(&RttiTypes::AnnotationClass, resolve); if (res.size() != 1) { throw OusiaException("resolution error!"); } Handle ac = res[0].node.cast(); - checkAnnotationClass(ac, name, domain, attributesDescriptor); + checkAnnotationClass(ac, name, ontology, attributesDescriptor); return ac; } @@ -192,33 +192,33 @@ static void checkFieldDescriptor( optional); } -TEST(OsxmlParser, domainParsing) +TEST(OsxmlParser, ontologyParsing) { XmlStandaloneEnvironment env(logger); - Rooted book_domain_node = - env.parse("book_domain.osxml", "", "", RttiSet{&RttiTypes::Domain}); - ASSERT_FALSE(book_domain_node == nullptr); + Rooted book_ontology_node = + env.parse("book_ontology.osxml", "", "", RttiSet{&RttiTypes::Ontology}); + ASSERT_FALSE(book_ontology_node == nullptr); ASSERT_FALSE(logger.hasError()); - // check the domain node. - Rooted book_domain = book_domain_node.cast(); - ASSERT_EQ("book", book_domain->getName()); + // check the ontology node. + Rooted book_ontology = book_ontology_node.cast(); + ASSERT_EQ("book", book_ontology->getName()); // get the book struct node. Cardinality single; single.merge({1}); Rooted book = checkStructuredClass( - "book", "book", book_domain, single, nullptr, nullptr, false, true); + "book", "book", book_ontology, single, nullptr, nullptr, false, true); // get the chapter struct node. Rooted chapter = - checkStructuredClass("chapter", "chapter", book_domain); + checkStructuredClass("chapter", "chapter", book_ontology); Rooted section = - checkStructuredClass("section", "section", book_domain); + checkStructuredClass("section", "section", book_ontology); Rooted subsection = - checkStructuredClass("subsection", "subsection", book_domain); + checkStructuredClass("subsection", "subsection", book_ontology); Rooted paragraph = - checkStructuredClass("paragraph", "paragraph", book_domain, + checkStructuredClass("paragraph", "paragraph", book_ontology, Cardinality::any(), nullptr, nullptr, true, false); Rooted text = - checkStructuredClass("text", "text", book_domain, Cardinality::any(), + checkStructuredClass("text", "text", book_ontology, Cardinality::any(), nullptr, nullptr, true, false); // check the FieldDescriptors. @@ -231,19 +231,19 @@ TEST(OsxmlParser, domainParsing) text, {}, "", FieldDescriptor::FieldType::TREE, env.project->getSystemTypesystem()->getStringType(), false); - // check parent handling using the headings domain. - Rooted headings_domain_node = - env.parse("headings_domain.osxml", "", "", RttiSet{&RttiTypes::Domain}); - ASSERT_FALSE(headings_domain_node == nullptr); + // check parent handling using the headings ontology. + Rooted headings_ontology_node = + env.parse("headings_ontology.osxml", "", "", RttiSet{&RttiTypes::Ontology}); + ASSERT_FALSE(headings_ontology_node == nullptr); ASSERT_FALSE(logger.hasError()); - Rooted headings_domain = headings_domain_node.cast(); + Rooted headings_ontology = headings_ontology_node.cast(); // now there should be a heading struct. Rooted heading = - checkStructuredClass("heading", "heading", headings_domain, single, + checkStructuredClass("heading", "heading", headings_ontology, single, nullptr, nullptr, true, false); // which should be a reference to the paragraph descriptor. checkFieldDescriptor(heading, paragraph, {text}); - // and each struct in the book domain (except for text) should have a + // and each struct in the book ontology (except for text) should have a // heading field now. checkFieldDescriptor(book, {heading}, "heading", FieldDescriptor::FieldType::SUBTREE, nullptr, true); @@ -256,21 +256,21 @@ TEST(OsxmlParser, domainParsing) checkFieldDescriptor(paragraph, {heading}, "heading", FieldDescriptor::FieldType::SUBTREE, nullptr, true); - // check annotation handling using the comments domain. - Rooted comments_domain_node = - env.parse("comments_domain.osxml", "", "", RttiSet{&RttiTypes::Domain}); - ASSERT_FALSE(comments_domain_node == nullptr); + // check annotation handling using the comments ontology. + Rooted comments_ontology_node = + env.parse("comments_ontology.osxml", "", "", RttiSet{&RttiTypes::Ontology}); + ASSERT_FALSE(comments_ontology_node == nullptr); ASSERT_FALSE(logger.hasError()); - Rooted comments_domain = comments_domain_node.cast(); + Rooted comments_ontology = comments_ontology_node.cast(); // now we should be able to find a comment annotation. Rooted comment_anno = - checkAnnotationClass("comment", "comment", comments_domain); + checkAnnotationClass("comment", "comment", comments_ontology); // as well as a comment struct Rooted comment = - checkStructuredClass("comment", "comment", comments_domain); + checkStructuredClass("comment", "comment", comments_ontology); // and a reply struct Rooted reply = - checkStructuredClass("reply", "reply", comments_domain); + checkStructuredClass("reply", "reply", comments_ontology); // check the fields for each of them. { std::vector> descs{comment_anno, comment, reply}; -- cgit v1.2.3