summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/RegistryTest.cpp4
-rw-r--r--test/core/frontend/TerminalLoggerTest.cpp4
-rw-r--r--test/core/model/DocumentTest.cpp42
-rw-r--r--test/core/model/OntologyTest.cpp (renamed from test/core/model/DomainTest.cpp)312
-rw-r--r--test/core/model/TestAdvanced.hpp68
-rw-r--r--test/core/model/TestDocument.hpp8
-rw-r--r--test/core/model/TestDocumentBuilder.hpp12
-rw-r--r--test/core/model/TestOntology.hpp (renamed from test/core/model/TestDomain.hpp)24
-rw-r--r--test/core/resource/ResourceRequestTest.cpp52
-rw-r--r--test/formats/osml/OsmlParserTest.cpp18
-rw-r--r--test/formats/osxml/OsxmlParserTest.cpp80
-rw-r--r--test/plugins/filesystem/FileLocatorTest.cpp22
-rw-r--r--test/plugins/html/DemoOutputTest.cpp24
-rw-r--r--test/plugins/xml/XmlOutputTest.cpp34
14 files changed, 352 insertions, 352 deletions
diff --git a/test/core/RegistryTest.cpp b/test/core/RegistryTest.cpp
index 4e8fc6a..b557169 100644
--- a/test/core/RegistryTest.cpp
+++ b/test/core/RegistryTest.cpp
@@ -100,9 +100,9 @@ TEST(Registry, locateResource)
Resource res;
ASSERT_TRUE(
- registry.locateResource(res, "path", ResourceType::DOMAIN_DESC));
+ registry.locateResource(res, "path", ResourceType::ONTOLOGY));
ASSERT_TRUE(res.isValid());
- ASSERT_EQ(ResourceType::DOMAIN_DESC, res.getType());
+ ASSERT_EQ(ResourceType::ONTOLOGY, res.getType());
ASSERT_EQ("path", res.getLocation());
}
}
diff --git a/test/core/frontend/TerminalLoggerTest.cpp b/test/core/frontend/TerminalLoggerTest.cpp
index 99e8f29..acc379d 100644
--- a/test/core/frontend/TerminalLoggerTest.cpp
+++ b/test/core/frontend/TerminalLoggerTest.cpp
@@ -35,8 +35,8 @@ struct Pos {
};
static const std::string testStr =
- "\\link[domain]{book}\n" // 1
- "\\link[domain]{meta}\n" // 2
+ "\\link[ontology]{book}\n" // 1
+ "\\link[ontology]{meta}\n" // 2
"\n" // 3
"\\meta{\n" // 4
"\t\\title{The Adventures Of Tom Sawyer}\n" // 5
diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp
index 1bb2356..8ed59f5 100644
--- a/test/core/model/DocumentTest.cpp
+++ b/test/core/model/DocumentTest.cpp
@@ -23,10 +23,10 @@
#include <core/common/Rtti.hpp>
#include <core/frontend/TerminalLogger.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include "TestDocument.hpp"
-#include "TestDomain.hpp"
+#include "TestOntology.hpp"
namespace ousia {
@@ -36,10 +36,10 @@ TEST(Document, construct)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
+ // Get the ontology.
+ Rooted<Ontology> ontology = constructBookOntology(mgr, sys, logger);
// Construct the document.
- Rooted<Document> doc = constructBookDocument(mgr, logger, domain);
+ Rooted<Document> doc = constructBookDocument(mgr, logger, ontology);
// Check the document content.
ASSERT_FALSE(doc.isNull());
@@ -111,22 +111,22 @@ TEST(Document, construct)
TEST(Document, validate)
{
- // Let's start with a trivial domain and a trivial document.
+ // Let's start with a trivial ontology and a trivial document.
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- Rooted<Domain> domain{new Domain(mgr, sys, "trivial")};
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "trivial")};
Cardinality single;
single.merge({1});
// Set up the "root" StructuredClass.
Rooted<StructuredClass> rootClass{new StructuredClass(
- mgr, "root", domain, single, {nullptr}, false, true)};
+ mgr, "root", ontology, single, {nullptr}, false, true)};
// set up a document for it.
{
// first an invalid one, which is empty.
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState());
ASSERT_FALSE(doc->validate(logger));
// then add a root, which should make it valid.
@@ -138,7 +138,7 @@ TEST(Document, validate)
{
// A root with an invalid name, however, should make it invalid
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root = buildRootStructuredEntity(
doc, logger, {"root"}, {}, "my invalid root");
ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState());
@@ -150,7 +150,7 @@ TEST(Document, validate)
rootClass->createFieldDescriptor(logger).first;
// and add a child class for it.
Rooted<StructuredClass> childClass{
- new StructuredClass(mgr, "child", domain, single)};
+ new StructuredClass(mgr, "child", ontology, single)};
rootField->addChild(childClass);
{
/*
@@ -158,7 +158,7 @@ TEST(Document, validate)
* document should be invalid again.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState());
@@ -173,16 +173,16 @@ TEST(Document, validate)
ASSERT_FALSE(doc->validate(logger));
}
/*
- * Add a further extension to the domain: We add a subclass to child.
+ * Add a further extension to the ontology: We add a subclass to child.
*/
Rooted<StructuredClass> childSubClass{
- new StructuredClass(mgr, "childSub", domain, single, childClass)};
+ new StructuredClass(mgr, "childSub", ontology, single, childClass)};
{
/*
* A document with one instance of the Child subclass should be valid.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
buildStructuredEntity(doc, logger, root, {"childSub"});
@@ -202,7 +202,7 @@ TEST(Document, validate)
* invalid, because it has no children of itself.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
buildStructuredEntity(doc, logger, root, {"childSub"});
@@ -223,7 +223,7 @@ TEST(Document, validate)
* valid, because of the override.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
buildStructuredEntity(doc, logger, root, {"childSub"});
@@ -241,7 +241,7 @@ TEST(Document, validate)
* invalid again, because we are missing the primitive content.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
Rooted<StructuredEntity> child =
@@ -259,14 +259,14 @@ TEST(Document, validate)
ASSERT_TRUE(doc->validate(logger));
}
- // Now add an Annotation class to the domain.
- Rooted<AnnotationClass> annoClass{new AnnotationClass(mgr, "anno", domain)};
+ // Now add an Annotation class to the ontology.
+ Rooted<AnnotationClass> annoClass{new AnnotationClass(mgr, "anno", ontology)};
{
/*
* Create a valid document in itself.
*/
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(domain);
+ doc->referenceOntology(ontology);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
Rooted<Anchor> start{new Anchor(mgr, root)};
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/OntologyTest.cpp
index b3c5771..265e9e2 100644
--- a/test/core/model/DomainTest.cpp
+++ b/test/core/model/OntologyTest.cpp
@@ -22,9 +22,9 @@
#include <core/common/Rtti.hpp>
#include <core/frontend/TerminalLogger.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
-#include "TestDomain.hpp"
+#include "TestOntology.hpp"
namespace ousia {
@@ -38,45 +38,45 @@ void assert_path(const ResolutionResult &res, const Rtti *expected_type,
ASSERT_EQ(expected_path, res.node->path());
}
-TEST(Domain, testDomainResolving)
+TEST(Ontology, testOntologyResolving)
{
// Construct Manager
Logger logger;
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
+ // Get the ontology.
+ Rooted<Ontology> ontology = constructBookOntology(mgr, sys, logger);
std::vector<ResolutionResult> res;
- // There is one domain called "book"
- res = domain->resolve(&RttiTypes::Domain, "book");
+ // There is one ontology called "book"
+ res = ontology->resolve(&RttiTypes::Ontology, "book");
ASSERT_EQ(1U, res.size());
- assert_path(res[0], &RttiTypes::Domain, {"book"});
+ assert_path(res[0], &RttiTypes::Ontology, {"book"});
- // There is one domain called "book"
- res = domain->resolve(&RttiTypes::StructuredClass, "book");
+ // There is one ontology called "book"
+ res = ontology->resolve(&RttiTypes::StructuredClass, "book");
ASSERT_EQ(1U, res.size());
assert_path(res[0], &RttiTypes::StructuredClass, {"book", "book"});
// If we explicitly ask for the "book, book" path, then only the
// StructuredClass should be returned.
- res = domain->resolve(&RttiTypes::Domain,
+ res = ontology->resolve(&RttiTypes::Ontology,
std::vector<std::string>{"book", "book"});
ASSERT_EQ(0U, res.size());
- res = domain->resolve(&RttiTypes::StructuredClass,
+ res = ontology->resolve(&RttiTypes::StructuredClass,
std::vector<std::string>{"book", "book"});
ASSERT_EQ(1U, res.size());
// If we ask for "section" the result should be unique as well.
- res = domain->resolve(&RttiTypes::StructuredClass, "section");
+ res = ontology->resolve(&RttiTypes::StructuredClass, "section");
ASSERT_EQ(1U, res.size());
assert_path(res[0], &RttiTypes::StructuredClass, {"book", "section"});
- // If we ask for "paragraph" it is referenced two times in the Domain graph,
+ // If we ask for "paragraph" it is referenced two times in the Ontology graph,
// but should be returned only once.
- res = domain->resolve(&RttiTypes::StructuredClass, "paragraph");
+ res = ontology->resolve(&RttiTypes::StructuredClass, "paragraph");
ASSERT_EQ(1U, res.size());
assert_path(res[0], &RttiTypes::StructuredClass, {"book", "paragraph"});
}
@@ -113,10 +113,10 @@ TEST(StructuredClass, getFieldDescriptors)
TerminalLogger logger{std::cout};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- Rooted<Domain> domain{new Domain(mgr, sys, "myDomain")};
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "myOntology")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), nullptr, false, true)};
+ mgr, "A", ontology, Cardinality::any(), nullptr, false, true)};
Rooted<FieldDescriptor> A_a = createUnsortedPrimitiveField(
A, sys->getStringType(), logger, false, "a");
Rooted<FieldDescriptor> A_b = createUnsortedPrimitiveField(
@@ -125,7 +125,7 @@ TEST(StructuredClass, getFieldDescriptors)
A, sys->getStringType(), logger, true, "somename");
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, Cardinality::any(), A, false, true)};
+ mgr, "B", ontology, Cardinality::any(), A, false, true)};
Rooted<FieldDescriptor> B_b = createUnsortedPrimitiveField(
B, sys->getStringType(), logger, false, "b");
Rooted<FieldDescriptor> B_c = createUnsortedPrimitiveField(
@@ -134,11 +134,11 @@ TEST(StructuredClass, getFieldDescriptors)
B, sys->getStringType(), logger, true, "othername");
Rooted<StructuredClass> C{new StructuredClass(
- mgr, "C", domain, Cardinality::any(), B, false, true)};
+ mgr, "C", ontology, Cardinality::any(), B, false, true)};
Rooted<FieldDescriptor> C_a = createUnsortedPrimitiveField(
C, sys->getStringType(), logger, false, "a");
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_TRUE(ontology->validate(logger));
// check all FieldDescriptors
{
@@ -173,21 +173,21 @@ TEST(StructuredClass, getFieldDescriptorsCycles)
Logger logger;
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- Rooted<Domain> domain{new Domain(mgr, sys, "myDomain")};
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "myOntology")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), nullptr, false, true)};
+ mgr, "A", ontology, Cardinality::any(), nullptr, false, true)};
A->addSubclass(A, logger);
Rooted<FieldDescriptor> A_a = createUnsortedPrimitiveField(
A, sys->getStringType(), logger, false, "a");
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_FALSE(ontology->validate(logger));
// if we call getFieldDescriptors that should still return a valid result.
NodeVector<FieldDescriptor> fds = A->getFieldDescriptors();
ASSERT_EQ(1, fds.size());
ASSERT_EQ(A_a, fds[0]);
}
-Rooted<StructuredClass> getClass(const std::string name, Handle<Domain> dom)
+Rooted<StructuredClass> getClass(const std::string name, Handle<Ontology> dom)
{
std::vector<ResolutionResult> res =
dom->resolve(&RttiTypes::StructuredClass, name);
@@ -196,23 +196,23 @@ Rooted<StructuredClass> getClass(const std::string name, Handle<Domain> dom)
TEST(Descriptor, pathTo)
{
- // Start with some easy examples from the book domain.
+ // Start with some easy examples from the book ontology.
TerminalLogger logger{std::cout};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
+ // Get the ontology.
+ Rooted<Ontology> ontology = constructBookOntology(mgr, sys, logger);
// get the book node and the section node.
- Rooted<StructuredClass> book = getClass("book", domain);
- Rooted<StructuredClass> section = getClass("section", domain);
+ Rooted<StructuredClass> book = getClass("book", ontology);
+ Rooted<StructuredClass> section = getClass("section", ontology);
// get the path in between.
NodeVector<Node> path = book->pathTo(section, logger);
ASSERT_EQ(1U, path.size());
ASSERT_TRUE(path[0]->isa(&RttiTypes::FieldDescriptor));
// get the text node.
- Rooted<StructuredClass> text = getClass("text", domain);
+ Rooted<StructuredClass> text = getClass("text", ontology);
// get the path between book and text via paragraph.
path = book->pathTo(text, logger);
ASSERT_EQ(3U, path.size());
@@ -222,7 +222,7 @@ TEST(Descriptor, pathTo)
ASSERT_TRUE(path[2]->isa(&RttiTypes::FieldDescriptor));
// get the subsection node.
- Rooted<StructuredClass> subsection = getClass("subsection", domain);
+ Rooted<StructuredClass> subsection = getClass("subsection", ontology);
// try to get the path between book and subsection.
path = book->pathTo(subsection, logger);
// this should be impossible.
@@ -244,7 +244,7 @@ TEST(Descriptor, pathTo)
TEST(Descriptor, pathToAdvanced)
{
/*
- * Now we build a really nasty domain with lots of transparency
+ * Now we build a really nasty ontology with lots of transparency
* and inheritance. The basic idea is to have three paths from start to
* finish, where one is blocked by overriding fields and the longer valid
* one is found first such that it has to be replaced by the shorter one
@@ -266,30 +266,30 @@ TEST(Descriptor, pathToAdvanced)
Manager mgr{1};
TerminalLogger logger{std::cout};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "nasty")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "nasty")};
// Let's create the classes that we need first
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, false, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, false, true)};
Rooted<StructuredClass> start{new StructuredClass(
- mgr, "start", domain, Cardinality::any(), A, false, false)};
+ mgr, "start", ontology, Cardinality::any(), A, false, false)};
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, Cardinality::any(), {nullptr}, true, false)};
+ mgr, "B", ontology, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> C{new StructuredClass(
- mgr, "C", domain, Cardinality::any(), B, true, false)};
+ mgr, "C", ontology, Cardinality::any(), B, true, false)};
Rooted<StructuredClass> D{new StructuredClass(
- mgr, "D", domain, Cardinality::any(), {nullptr}, true, false)};
+ mgr, "D", ontology, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> E{new StructuredClass(
- mgr, "E", domain, Cardinality::any(), {nullptr}, true, false)};
+ mgr, "E", ontology, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> target{
- new StructuredClass(mgr, "target", domain, Cardinality::any())};
+ new StructuredClass(mgr, "target", ontology, Cardinality::any())};
// We create a field for A
Rooted<FieldDescriptor> A_field = A->createFieldDescriptor(logger).first;
@@ -309,11 +309,11 @@ TEST(Descriptor, pathToAdvanced)
Rooted<FieldDescriptor> E_field = E->createFieldDescriptor(logger).first;
E_field->addChild(target);
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_TRUE(ontology->validate(logger));
#ifdef MANAGER_GRAPHVIZ_EXPORT
// dump the manager state
- mgr.exportGraphviz("nastyDomain.dot");
+ mgr.exportGraphviz("nastyOntology.dot");
#endif
// and now we should be able to find the shortest path as suggested
@@ -329,18 +329,18 @@ TEST(Descriptor, pathToAdvanced)
TEST(Descriptor, pathToCycles)
{
- // build a domain with a cycle.
+ // build a ontology with a cycle.
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "cycles")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "cycles")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->addSubclass(A, logger);
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_FALSE(ontology->validate(logger));
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, Cardinality::any(), {nullptr}, false, true)};
+ mgr, "B", ontology, Cardinality::any(), {nullptr}, false, true)};
Rooted<FieldDescriptor> A_field = A->createFieldDescriptor(logger).first;
A_field->addChild(B);
/*
@@ -357,16 +357,16 @@ TEST(Descriptor, pathToCycles)
TEST(Descriptor, getDefaultFields)
{
- // construct a domain with lots of default fields to test.
+ // construct a ontology with lots of default fields to test.
// start with a single structure class.
Manager mgr{1};
TerminalLogger logger{std::cout};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "nasty")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "nasty")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), nullptr, false, true)};
+ mgr, "A", ontology, Cardinality::any(), nullptr, false, true)};
// in this trivial case no field should be found.
ASSERT_TRUE(A->getDefaultFields().empty());
@@ -382,7 +382,7 @@ TEST(Descriptor, getDefaultFields)
// remove that field from A and add it to another class.
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, Cardinality::any(), nullptr, false, true)};
+ mgr, "B", ontology, Cardinality::any(), nullptr, false, true)};
B->moveFieldDescriptor(A_prim_field, logger);
@@ -402,7 +402,7 @@ TEST(Descriptor, getDefaultFields)
// add a transparent child class.
Rooted<StructuredClass> C{new StructuredClass(
- mgr, "C", domain, Cardinality::any(), nullptr, true, false)};
+ mgr, "C", ontology, Cardinality::any(), nullptr, true, false)};
A_field->addChild(C);
// add a primitive field for it.
@@ -417,14 +417,14 @@ TEST(Descriptor, getDefaultFields)
// add another transparent child class to A with a daughter class that has
// in turn a subclass with a primitive field.
Rooted<StructuredClass> D{new StructuredClass(
- mgr, "D", domain, Cardinality::any(), nullptr, true, false)};
+ mgr, "D", ontology, Cardinality::any(), nullptr, true, false)};
A_field->addChild(D);
Rooted<FieldDescriptor> D_field = D->createFieldDescriptor(logger).first;
Rooted<StructuredClass> E{new StructuredClass(
- mgr, "E", domain, Cardinality::any(), nullptr, true, false)};
+ mgr, "E", ontology, Cardinality::any(), nullptr, true, false)};
D_field->addChild(E);
Rooted<StructuredClass> F{new StructuredClass(
- mgr, "E", domain, Cardinality::any(), E, true, false)};
+ mgr, "E", ontology, Cardinality::any(), E, true, false)};
Rooted<FieldDescriptor> F_field =
F->createPrimitiveFieldDescriptor(sys->getStringType(), logger).first;
@@ -437,16 +437,16 @@ TEST(Descriptor, getDefaultFields)
TEST(Descriptor, getDefaultFieldsCycles)
{
- // build a domain with a cycle.
+ // build a ontology with a cycle.
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "cycles")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "cycles")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->addSubclass(A, logger);
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_FALSE(ontology->validate(logger));
Rooted<FieldDescriptor> A_field =
A->createPrimitiveFieldDescriptor(sys->getStringType(), logger).first;
/*
@@ -460,17 +460,17 @@ TEST(Descriptor, getDefaultFieldsCycles)
TEST(Descriptor, getPermittedChildren)
{
- // analyze the book domain.
+ // analyze the book ontology.
TerminalLogger logger{std::cout};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
+ // Get the ontology.
+ Rooted<Ontology> ontology = constructBookOntology(mgr, sys, logger);
// get the relevant classes.
- Rooted<StructuredClass> book = getClass("book", domain);
- Rooted<StructuredClass> section = getClass("section", domain);
- Rooted<StructuredClass> paragraph = getClass("paragraph", domain);
- Rooted<StructuredClass> text = getClass("text", domain);
+ Rooted<StructuredClass> book = getClass("book", ontology);
+ Rooted<StructuredClass> section = getClass("section", ontology);
+ Rooted<StructuredClass> paragraph = getClass("paragraph", ontology);
+ Rooted<StructuredClass> text = getClass("text", ontology);
/*
* as permitted children we expect section, paragraph and text in exactly
* that order. section should be before paragraph because of declaration
@@ -485,7 +485,7 @@ TEST(Descriptor, getPermittedChildren)
// Now we add a subclass to text.
Rooted<StructuredClass> sub{new StructuredClass(
- mgr, "Subclass", domain, Cardinality::any(), text, true, false)};
+ mgr, "Subclass", ontology, Cardinality::any(), text, true, false)};
// And that should be in the result list as well now.
children = book->getPermittedChildren();
ASSERT_EQ(4U, children.size());
@@ -497,16 +497,16 @@ TEST(Descriptor, getPermittedChildren)
TEST(Descriptor, getPermittedChildrenCycles)
{
- // build a domain with a cycle.
+ // build a ontology with a cycle.
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "cycles")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "cycles")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->addSubclass(A, logger);
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_FALSE(ontology->validate(logger));
Rooted<FieldDescriptor> A_field = A->createFieldDescriptor(logger).first;
// we make the cycle worse by adding A as child of itself.
A_field->addChild(A);
@@ -526,10 +526,10 @@ TEST(Descriptor, getSyntaxDescriptor)
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "ontology")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "ontology")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->setStartToken(TokenDescriptor(Tokens::Indent));
A->setEndToken(TokenDescriptor(Tokens::Dedent));
{
@@ -554,11 +554,11 @@ TEST(Descriptor, getPermittedTokens)
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "ontology")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "ontology")};
// add one StructuredClass with all tokens set.
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->setStartToken(TokenDescriptor(Tokens::Indent));
A->setEndToken(TokenDescriptor(Tokens::Dedent));
{
@@ -571,7 +571,7 @@ TEST(Descriptor, getPermittedTokens)
A_field->setEndToken(TokenDescriptor(Tokens::Newline));
A_field->addChild(A);
// add an annotation with start and end set.
- Rooted<AnnotationClass> A_anno = domain->createAnnotationClass("A");
+ Rooted<AnnotationClass> A_anno = ontology->createAnnotationClass("A");
{
TokenDescriptor start{"<"};
start.id = 7;
@@ -583,8 +583,8 @@ TEST(Descriptor, getPermittedTokens)
A_anno->setEndToken(end);
}
// add a trivial annotation, which should not be returned.
- Rooted<AnnotationClass> B_anno = domain->createAnnotationClass("B");
- ASSERT_TRUE(domain->validate(logger));
+ Rooted<AnnotationClass> B_anno = ontology->createAnnotationClass("B");
+ ASSERT_TRUE(ontology->validate(logger));
// check result.
std::vector<SyntaxDescriptor> stxs = A->getPermittedTokens();
@@ -610,21 +610,21 @@ TEST(StructuredClass, isSubclassOf)
// create an inheritance hierarchy.
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- Rooted<Domain> domain{new Domain(mgr, sys, "inheritance")};
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "inheritance")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, false, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, false, true)};
// first branch
Rooted<StructuredClass> B{
- new StructuredClass(mgr, "B", domain, Cardinality::any(), A)};
+ new StructuredClass(mgr, "B", ontology, Cardinality::any(), A)};
Rooted<StructuredClass> C{
- new StructuredClass(mgr, "C", domain, Cardinality::any(), B)};
+ new StructuredClass(mgr, "C", ontology, Cardinality::any(), B)};
// second branch
Rooted<StructuredClass> D{
- new StructuredClass(mgr, "D", domain, Cardinality::any(), A)};
+ new StructuredClass(mgr, "D", ontology, Cardinality::any(), A)};
Rooted<StructuredClass> E{
- new StructuredClass(mgr, "E", domain, Cardinality::any(), D)};
+ new StructuredClass(mgr, "E", ontology, Cardinality::any(), D)};
Rooted<StructuredClass> F{
- new StructuredClass(mgr, "F", domain, Cardinality::any(), D)};
+ new StructuredClass(mgr, "F", ontology, Cardinality::any(), D)};
// check function results
ASSERT_FALSE(A->isSubclassOf(A));
@@ -670,132 +670,132 @@ TEST(StructuredClass, isSubclassOf)
ASSERT_FALSE(F->isSubclassOf(F));
}
-TEST(Domain, validate)
+TEST(Ontology, validate)
{
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // start with an easy example: Our book domain should be valid.
+ // start with an easy example: Our book ontology should be valid.
{
- Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ Rooted<Ontology> ontology = constructBookOntology(mgr, sys, logger);
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
}
{
- // Even easier: An empty domain should be valid.
- Rooted<Domain> domain{new Domain(mgr, sys, "domain")};
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ // Even easier: An empty ontology should be valid.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "ontology")};
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// if we add a StructureClass it should be valid still.
Rooted<StructuredClass> base{
- new StructuredClass(mgr, "myClass", domain)};
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ new StructuredClass(mgr, "myClass", ontology)};
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// if we tamper with the name, however, it shouldn't be valid anymore.
base->setName("");
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
base->setName("my class");
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
base->setName("myClass");
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// add an invalid short token.
base->setShortToken(TokenDescriptor("bla"));
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// make it valid.
base->setShortToken(TokenDescriptor("!bla!"));
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// Let's add a primitive field (without a primitive type at first)
Rooted<FieldDescriptor> base_field =
base->createPrimitiveFieldDescriptor(nullptr, logger).first;
// this should not be valid.
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// but it should be if we set the type.
base_field->setPrimitiveType(sys->getStringType());
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// add an invalid start token.
base_field->setStartToken(TokenDescriptor("< + >"));
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// make it valid.
base_field->setStartToken(TokenDescriptor("<"));
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// add a subclass for our base class.
- Rooted<StructuredClass> sub{new StructuredClass(mgr, "sub", domain)};
+ Rooted<StructuredClass> sub{new StructuredClass(mgr, "sub", ontology)};
// this should be valid in itself.
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// and still if we add a superclass.
sub->setSuperclass(base, logger);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// and still if we remove the subclass from the base class.
base->removeSubclass(sub, logger);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
ASSERT_EQ(nullptr, sub->getSuperclass());
// and still if we re-add it.
base->addSubclass(sub, logger);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
ASSERT_EQ(base, sub->getSuperclass());
// add a non-primitive field to the child class.
Rooted<FieldDescriptor> sub_field =
sub->createFieldDescriptor(logger).first;
// this should not be valid because we allow no children.
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// we should also be able to add a child and make it valid.
sub_field->addChild(base);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// it should be invalid if we add it twice.
sub_field->addChild(base);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// and valid again if we remove it once.
sub_field->removeChild(base);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// if we set a primitive type it should be invalid
sub_field->setPrimitiveType(sys->getStringType());
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// and valid again if we unset it.
sub_field->setPrimitiveType(nullptr);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
// It should be invalid if we set another TREE field.
Rooted<FieldDescriptor> sub_field2 =
sub->createFieldDescriptor(logger, FieldDescriptor::FieldType::TREE,
"test", false).first;
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_FALSE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_FALSE(ontology->validate(logger));
// but valid again if we remove it
sub->removeFieldDescriptor(sub_field2);
- ASSERT_EQ(ValidationState::UNKNOWN, domain->getValidationState());
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_EQ(ValidationState::UNKNOWN, ontology->getValidationState());
+ ASSERT_TRUE(ontology->validate(logger));
}
}
-TEST(Domain, getAllTokenDescriptors)
+TEST(Ontology, getAllTokenDescriptors)
{
// build an ontology with some custom syntax.
Manager mgr{1};
Logger logger;
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct the domain
- Rooted<Domain> domain{new Domain(mgr, sys, "ontology")};
+ // Construct the ontology
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "ontology")};
// add one StructuredClass with all tokens set.
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), {nullptr}, true, true)};
+ mgr, "A", ontology, Cardinality::any(), {nullptr}, true, true)};
A->setStartToken(TokenDescriptor(Tokens::Indent));
A->setEndToken(TokenDescriptor(Tokens::Dedent));
{
@@ -808,7 +808,7 @@ TEST(Domain, getAllTokenDescriptors)
A_field->setEndToken(TokenDescriptor(Tokens::Newline));
A_field->addChild(A);
// add an annotation with start and end set.
- Rooted<AnnotationClass> A_anno = domain->createAnnotationClass("A");
+ Rooted<AnnotationClass> A_anno = ontology->createAnnotationClass("A");
{
TokenDescriptor start{"<"};
start.id = 7;
@@ -820,11 +820,11 @@ TEST(Domain, getAllTokenDescriptors)
A_anno->setEndToken(end);
}
// add a trivial annotation, which should not be returned.
- Rooted<AnnotationClass> B_anno = domain->createAnnotationClass("B");
- ASSERT_TRUE(domain->validate(logger));
+ Rooted<AnnotationClass> B_anno = ontology->createAnnotationClass("B");
+ ASSERT_TRUE(ontology->validate(logger));
// check the result.
- std::vector<TokenDescriptor *> tks = domain->getAllTokenDescriptors();
+ std::vector<TokenDescriptor *> tks = ontology->getAllTokenDescriptors();
// A short token
ASSERT_EQ("<+>", tks[0]->token);
@@ -851,4 +851,4 @@ TEST(Domain, getAllTokenDescriptors)
ASSERT_EQ(8, tks[5]->id);
ASSERT_FALSE(tks[5]->special);
}
-} \ No newline at end of file
+}
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index 71379d2..c92effa 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -20,19 +20,19 @@
#define _MODEL_TEST_ADVANCED_HPP_
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Typesystem.hpp>
#include "TestDocumentBuilder.hpp"
namespace ousia {
-static Rooted<StructuredClass> resolveDescriptor(Handle<Domain> domain,
+static Rooted<StructuredClass> resolveDescriptor(Handle<Ontology> ontology,
const std::string &className)
{
// use the actual resolve method.
std::vector<ResolutionResult> resolved =
- domain->resolve(&RttiTypes::StructuredClass, className);
+ ontology->resolve(&RttiTypes::StructuredClass, className);
// take the first valid result.
for (auto &r : resolved) {
return r.node.cast<StructuredClass>();
@@ -42,53 +42,53 @@ static Rooted<StructuredClass> resolveDescriptor(Handle<Domain> domain,
}
/**
- * This constructs the "heading" domain given the book domain.
+ * This constructs the "heading" ontology given the book ontology.
*/
-static Rooted<Domain> constructHeadingDomain(Manager &mgr,
+static Rooted<Ontology> constructHeadingOntology(Manager &mgr,
Handle<SystemTypesystem> sys,
- Handle<Domain> bookDomain,
+ Handle<Ontology> bookOntology,
Logger &logger)
{
- // set up domain node.
- Rooted<Domain> domain{new Domain(mgr, sys, "headings")};
+ // set up ontology node.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "headings")};
// set up cardinality (every section may have at most one heading).
Cardinality card;
card.merge({0, 1});
// set up heading StructuredClass.
Rooted<StructuredClass> heading{
- new StructuredClass(mgr, "heading", domain, card, {nullptr}, true)};
+ new StructuredClass(mgr, "heading", ontology, card, {nullptr}, true)};
// as field want to reference the field of paragraph.
- Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph");
+ Rooted<StructuredClass> p = resolveDescriptor(bookOntology, "paragraph");
heading->addFieldDescriptor(p->getFieldDescriptor(), logger);
// create a new field for headings in each section type.
std::vector<std::string> secclasses{"book", "section", "subsection",
"paragraph"};
for (auto &s : secclasses) {
- Rooted<StructuredClass> desc = resolveDescriptor(bookDomain, s);
+ Rooted<StructuredClass> desc = resolveDescriptor(bookOntology, s);
Rooted<FieldDescriptor> heading_field =
desc->createFieldDescriptor(logger,
FieldDescriptor::FieldType::SUBTREE,
"heading", true).first;
heading_field->addChild(heading);
}
- return domain;
+ return ontology;
}
/**
- * This constructs the "list" domain given the book domain.
+ * This constructs the "list" ontology given the book ontology.
*/
-static Rooted<Domain> constructListDomain(Manager &mgr,
+static Rooted<Ontology> constructListOntology(Manager &mgr,
Handle<SystemTypesystem> sys,
- Handle<Domain> bookDomain,
+ Handle<Ontology> bookOntology,
Logger &logger)
{
- // set up domain node.
- Rooted<Domain> domain{new Domain(mgr, sys, "list")};
+ // set up ontology node.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "list")};
// get book.paragraph
- Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph");
+ Rooted<StructuredClass> p = resolveDescriptor(bookOntology, "paragraph");
// set up item StructuredClass;
Rooted<StructuredClass> item{new StructuredClass(
- mgr, "item", domain, Cardinality::any(), {nullptr}, false)};
+ mgr, "item", ontology, Cardinality::any(), {nullptr}, false)};
// as field we want to reference the field of paragraph.
item->addFieldDescriptor(p->getFieldDescriptor(), logger);
@@ -96,28 +96,28 @@ static Rooted<Domain> constructListDomain(Manager &mgr,
std::vector<std::string> listTypes{"ol", "ul"};
for (auto &listType : listTypes) {
Rooted<StructuredClass> list{new StructuredClass(
- mgr, listType, domain, Cardinality::any(), p, false)};
+ mgr, listType, ontology, Cardinality::any(), p, false)};
Rooted<FieldDescriptor> list_field{new FieldDescriptor(mgr, list)};
list_field->addChild(item);
}
- return domain;
+ return ontology;
}
/**
- * This constructs the "emphasis" domain.
+ * This constructs the "emphasis" ontology.
*/
-static Rooted<Domain> constructEmphasisDomain(Manager &mgr,
+static Rooted<Ontology> constructEmphasisOntology(Manager &mgr,
Handle<SystemTypesystem> sys,
Logger &logger)
{
- // set up domain node.
- Rooted<Domain> domain{new Domain(mgr, sys, "emphasis")};
+ // set up ontology node.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "emphasis")};
// create AnnotationClasses
- Rooted<AnnotationClass> em{new AnnotationClass(mgr, "emphasized", domain)};
+ Rooted<AnnotationClass> em{new AnnotationClass(mgr, "emphasized", ontology)};
- Rooted<AnnotationClass> strong{new AnnotationClass(mgr, "strong", domain)};
+ Rooted<AnnotationClass> strong{new AnnotationClass(mgr, "strong", ontology)};
- return domain;
+ return ontology;
}
static bool addText(Logger &logger, Handle<Document> doc,
@@ -173,17 +173,17 @@ static bool addAnnotation(Logger &logger, Handle<Document> doc,
/**
* This constructs a more advanced book document using not only the book
- * domain but also headings, emphasis and lists.
+ * ontology but also headings, emphasis and lists.
*/
static Rooted<Document> constructAdvancedDocument(Manager &mgr, Logger &logger,
- Handle<Domain> bookDom,
- Handle<Domain> headingDom,
- Handle<Domain> listDom,
- Handle<Domain> emphasisDom)
+ Handle<Ontology> bookDom,
+ Handle<Ontology> headingDom,
+ Handle<Ontology> listDom,
+ Handle<Ontology> emphasisDom)
{
// Start with the (empty) document.
Rooted<Document> doc{new Document(mgr, "kant_was_ist_aufklaerung.oxd")};
- doc->referenceDomains({bookDom, headingDom, listDom, emphasisDom});
+ doc->referenceOntologys({bookDom, headingDom, listDom, emphasisDom});
// Add the root.
Rooted<StructuredEntity> book =
diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp
index 7675dab..a4a8f7c 100644
--- a/test/core/model/TestDocument.hpp
+++ b/test/core/model/TestDocument.hpp
@@ -20,7 +20,7 @@
#define _MODEL_TEST_DOCUMENT_HPP_
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Typesystem.hpp>
#include "TestDocumentBuilder.hpp"
@@ -28,15 +28,15 @@
namespace ousia {
/**
- * This constructs a fairly simple test document for the "book" domain. The
+ * This constructs a fairly simple test document for the "book" ontology. The
* structure of the document can be seen in the Code below.
*/
static Rooted<Document> constructBookDocument(Manager &mgr, Logger &logger,
- Rooted<Domain> bookDomain)
+ Rooted<Ontology> bookOntology)
{
// Start with the (empty) document.
Rooted<Document> doc{new Document(mgr, "myDoc.oxd")};
- doc->referenceDomain(bookDomain);
+ doc->referenceOntology(bookOntology);
// Add the root.
Rooted<StructuredEntity> root =
diff --git a/test/core/model/TestDocumentBuilder.hpp b/test/core/model/TestDocumentBuilder.hpp
index fc76b07..745f1ab 100644
--- a/test/core/model/TestDocumentBuilder.hpp
+++ b/test/core/model/TestDocumentBuilder.hpp
@@ -23,7 +23,7 @@
#include <core/common/Logger.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Typesystem.hpp>
namespace ousia {
@@ -81,7 +81,7 @@ static Rooted<Descriptor> resolveDescriptor(Handle<Document> doc,
* @param name is the name of this StructuredEntity (empty per
* default).
* @return the newly created StructuredEntity or a nullptr if some
- * input handle was empty or the given domains did not
+ * input handle was empty or the given ontologies did not
* contain a StructuredClass with the given name.
*/
Rooted<StructuredEntity> buildRootStructuredEntity(
@@ -112,7 +112,7 @@ Rooted<StructuredEntity> buildRootStructuredEntity(
* This builds a StructuredEntity as child of the given DocumentEntity. It
* automatically appends the newly build entity to its parent.
*
- * @param document is the document this entity shall be build for. The domains
+ * @param document is the document this entity shall be build for. The ontologies
* referenced here are the basis to resolve the given path.
* @param logger is the current logger.
* @param parent is the parent DocumentEntity. The newly constructed
@@ -126,7 +126,7 @@ Rooted<StructuredEntity> buildRootStructuredEntity(
* @param name is the name of this StructuredEntity (empty per
* default).
* @return the newly created StructuredEntity or a nullptr if some
- * input handle was empty or the given domains did not
+ * input handle was empty or the given ontologies did not
* contain a StructuredClass with the given name.
*/
Rooted<StructuredEntity> buildStructuredEntity(
@@ -167,7 +167,7 @@ Rooted<StructuredEntity> buildStructuredEntity(
* This builds an AnnotationEntity as child of the given Document. It
* automatically appends the newly build entity to its parent.
*
- * @param document is the document this entity shall be build for. The domains
+ * @param document is the document this entity shall be build for. The ontologies
* referenced here are the basis to resolve the given path.
* @param logger is the current logger.
* @param path is the name of the AnnotationClass or a path specifying it
@@ -179,7 +179,7 @@ Rooted<StructuredEntity> buildStructuredEntity(
* @param name is the name of this AnnotationEntity (empty per
* default).
* @return the newly created AnnotationEntity or a nullptr if some
- * input handle was empty or the given domains did not
+ * input handle was empty or the given ontologies did not
* contain a AnnotationClass with the given name.
*/
Rooted<AnnotationEntity> buildAnnotationEntity(
diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestOntology.hpp
index 779ef03..c65d6f4 100644
--- a/test/core/model/TestDomain.hpp
+++ b/test/core/model/TestOntology.hpp
@@ -19,27 +19,27 @@
#ifndef _MODEL_TEST_DOMAIN_HPP_
#define _MODEL_TEST_DOMAIN_HPP_
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Typesystem.hpp>
namespace ousia {
/**
- * This constructs the "book" domain for test purposes. The structure of the
- * domain is fairly simple and can be seen from the construction itself.
+ * This constructs the "book" ontology for test purposes. The structure of the
+ * ontology is fairly simple and can be seen from the construction itself.
*/
-static Rooted<Domain> constructBookDomain(Manager &mgr,
+static Rooted<Ontology> constructBookOntology(Manager &mgr,
Handle<SystemTypesystem> sys,
Logger &logger)
{
- // Start with the Domain itself.
- Rooted<Domain> domain{new Domain(mgr, sys, "book")};
+ // Start with the Ontology itself.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "book")};
// Set up the cardinalities we'll need.
Cardinality single;
single.merge({1});
// Set up the "book" node.
Rooted<StructuredClass> book{new StructuredClass(
- mgr, "book", domain, single, {nullptr}, false, true)};
+ mgr, "book", ontology, single, {nullptr}, false, true)};
// The structure field of it.
Rooted<FieldDescriptor> book_field =
@@ -47,7 +47,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// From there on the "section".
Rooted<StructuredClass> section{
- new StructuredClass(mgr, "section", domain, Cardinality::any())};
+ new StructuredClass(mgr, "section", ontology, Cardinality::any())};
book_field->addChild(section);
// And the field of it.
@@ -56,7 +56,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// We also add the "paragraph", which is transparent.
Rooted<StructuredClass> paragraph{new StructuredClass(
- mgr, "paragraph", domain, Cardinality::any(), {nullptr}, true)};
+ mgr, "paragraph", ontology, Cardinality::any(), {nullptr}, true)};
section_field->addChild(paragraph);
book_field->addChild(paragraph);
@@ -66,7 +66,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// We append "subsection" to section.
Rooted<StructuredClass> subsection{
- new StructuredClass(mgr, "subsection", domain, Cardinality::any())};
+ new StructuredClass(mgr, "subsection", ontology, Cardinality::any())};
section_field->addChild(subsection);
// And the field of it.
@@ -78,7 +78,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// Finally we add the "text" node, which is transparent as well.
Rooted<StructuredClass> text{new StructuredClass(
- mgr, "text", domain, Cardinality::any(), {nullptr}, true)};
+ mgr, "text", ontology, Cardinality::any(), {nullptr}, true)};
paragraph_field->addChild(text);
// ... and has a primitive field.
@@ -86,7 +86,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
text->createPrimitiveFieldDescriptor(sys->getStringType(), logger)
.first;
- return domain;
+ return ontology;
}
}
diff --git a/test/core/resource/ResourceRequestTest.cpp b/test/core/resource/ResourceRequestTest.cpp
index dac7a28..3112cc4 100644
--- a/test/core/resource/ResourceRequestTest.cpp
+++ b/test/core/resource/ResourceRequestTest.cpp
@@ -31,7 +31,7 @@ namespace ousia {
namespace RttiTypes {
extern const Rtti Document;
-extern const Rtti Domain;
+extern const Rtti Ontology;
extern const Rtti Typesystem;
}
@@ -62,12 +62,12 @@ struct TestSetup {
TestSetup()
{
- registry.registerExtension("domain", "application/domain");
+ registry.registerExtension("ontology", "application/ontology");
registry.registerExtension("typesystem", "application/typesystem");
registry.registerExtension("document", "application/document");
registry.registerParser(
- {"application/domain", "application/typesystem"},
- {&RttiTypes::Domain, &RttiTypes::Typesystem}, &pModule);
+ {"application/ontology", "application/typesystem"},
+ {&RttiTypes::Ontology, &RttiTypes::Typesystem}, &pModule);
registry.registerParser({"application/document"},
{&RttiTypes::Document}, &pDocument);
}
@@ -78,16 +78,16 @@ TEST(ResourceRequest, deduction)
{
TestSetup t;
- ResourceRequest req("test.domain", "", "", {&RttiTypes::Domain});
+ ResourceRequest req("test.ontology", "", "", {&RttiTypes::Ontology});
ASSERT_TRUE(req.deduce(t.registry, logger));
- ASSERT_EQ("test.domain", req.getPath());
- ASSERT_EQ("application/domain", req.getMimetype());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain}), req.getSupportedTypes());
- ASSERT_EQ(ResourceType::DOMAIN_DESC, req.getResourceType());
+ ASSERT_EQ("test.ontology", req.getPath());
+ ASSERT_EQ("application/ontology", req.getMimetype());
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology}), req.getSupportedTypes());
+ ASSERT_EQ(ResourceType::ONTOLOGY, req.getResourceType());
ASSERT_EQ(&t.pModule, req.getParser());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain, &RttiTypes::Typesystem}),
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology, &RttiTypes::Typesystem}),
req.getParserTypes());
}
@@ -95,17 +95,17 @@ TEST(ResourceRequest, deductionWithMimetype)
{
TestSetup t;
- ResourceRequest req("test.domain", "application/typesystem", "",
+ ResourceRequest req("test.ontology", "application/typesystem", "",
{&RttiTypes::Typesystem});
ASSERT_TRUE(req.deduce(t.registry, logger));
- ASSERT_EQ("test.domain", req.getPath());
+ ASSERT_EQ("test.ontology", req.getPath());
ASSERT_EQ("application/typesystem", req.getMimetype());
ASSERT_EQ(RttiSet({&RttiTypes::Typesystem}), req.getSupportedTypes());
ASSERT_EQ(ResourceType::TYPESYSTEM, req.getResourceType());
ASSERT_EQ(&t.pModule, req.getParser());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain, &RttiTypes::Typesystem}),
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology, &RttiTypes::Typesystem}),
req.getParserTypes());
}
@@ -113,18 +113,18 @@ TEST(ResourceRequest, deductionWithUnknownResourceType)
{
TestSetup t;
- ResourceRequest req("test.domain", "", "",
- {&RttiTypes::Domain, &RttiTypes::Typesystem});
+ ResourceRequest req("test.ontology", "", "",
+ {&RttiTypes::Ontology, &RttiTypes::Typesystem});
ASSERT_TRUE(req.deduce(t.registry, logger));
- ASSERT_EQ("test.domain", req.getPath());
- ASSERT_EQ("application/domain", req.getMimetype());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain, &RttiTypes::Typesystem}),
+ ASSERT_EQ("test.ontology", req.getPath());
+ ASSERT_EQ("application/ontology", req.getMimetype());
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology, &RttiTypes::Typesystem}),
req.getSupportedTypes());
ASSERT_EQ(ResourceType::UNKNOWN, req.getResourceType());
ASSERT_EQ(&t.pModule, req.getParser());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain, &RttiTypes::Typesystem}),
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology, &RttiTypes::Typesystem}),
req.getParserTypes());
}
@@ -132,17 +132,17 @@ TEST(ResourceRequest, deductionWithRel)
{
TestSetup t;
- ResourceRequest req("test.domain", "", "domain",
- {&RttiTypes::Domain, &RttiTypes::Typesystem});
+ ResourceRequest req("test.ontology", "", "ontology",
+ {&RttiTypes::Ontology, &RttiTypes::Typesystem});
ASSERT_TRUE(req.deduce(t.registry, logger));
- ASSERT_EQ("test.domain", req.getPath());
- ASSERT_EQ("application/domain", req.getMimetype());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain}), req.getSupportedTypes());
- ASSERT_EQ(ResourceType::DOMAIN_DESC, req.getResourceType());
+ ASSERT_EQ("test.ontology", req.getPath());
+ ASSERT_EQ("application/ontology", req.getMimetype());
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology}), req.getSupportedTypes());
+ ASSERT_EQ(ResourceType::ONTOLOGY, req.getResourceType());
ASSERT_EQ(&t.pModule, req.getParser());
- ASSERT_EQ(RttiSet({&RttiTypes::Domain, &RttiTypes::Typesystem}),
+ ASSERT_EQ(RttiSet({&RttiTypes::Ontology, &RttiTypes::Typesystem}),
req.getParserTypes());
}
}
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 <core/common/CharReader.hpp>
#include <core/common/SourceContextReader.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Typesystem.hpp>
#include <core/model/Node.hpp>
#include <core/model/Project.hpp>
@@ -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> 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> 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 <core/common/CharReader.hpp>
#include <core/common/SourceContextReader.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/Node.hpp>
#include <core/model/Project.hpp>
#include <core/frontend/TerminalLogger.hpp>
@@ -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<StructType> expected,
}
static void checkStructuredClass(
- Handle<Node> n, const std::string &name, Handle<Domain> domain,
+ Handle<Node> n, const std::string &name, Handle<Ontology> ontology,
Variant cardinality = Cardinality::any(),
Handle<StructType> attributesDescriptor = nullptr,
Handle<StructuredClass> superclass = nullptr, bool transparent = false,
@@ -98,7 +98,7 @@ static void checkStructuredClass(
Handle<StructuredClass> sc = n.cast<StructuredClass>();
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<StructuredClass> checkStructuredClass(
- const std::string &resolve, const std::string &name, Handle<Domain> domain,
+ const std::string &resolve, const std::string &name, Handle<Ontology> ontology,
Variant cardinality = Cardinality::any(),
Handle<StructType> attributesDescriptor = nullptr,
Handle<StructuredClass> 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<StructuredClass> sc = res[0].node.cast<StructuredClass>();
- checkStructuredClass(sc, name, domain, cardinality, attributesDescriptor,
+ checkStructuredClass(sc, name, ontology, cardinality, attributesDescriptor,
superclass, transparent, root);
return sc;
}
static void checkAnnotationClass(
- Handle<Node> n, const std::string &name, Handle<Domain> domain,
+ Handle<Node> n, const std::string &name, Handle<Ontology> ontology,
Handle<StructType> attributesDescriptor = nullptr)
{
ASSERT_FALSE(n == nullptr);
Handle<AnnotationClass> ac = n.cast<AnnotationClass>();
ASSERT_FALSE(ac == nullptr);
ASSERT_EQ(name, ac->getName());
- ASSERT_EQ(domain, ac->getParent());
+ ASSERT_EQ(ontology, ac->getParent());
checkAttributes(attributesDescriptor, ac);
}
static Rooted<AnnotationClass> checkAnnotationClass(
- const std::string &resolve, const std::string &name, Handle<Domain> domain,
+ const std::string &resolve, const std::string &name, Handle<Ontology> ontology,
Handle<StructType> 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<AnnotationClass> ac = res[0].node.cast<AnnotationClass>();
- 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<Node> book_domain_node =
- env.parse("book_domain.osxml", "", "", RttiSet{&RttiTypes::Domain});
- ASSERT_FALSE(book_domain_node == nullptr);
+ Rooted<Node> 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<Domain> book_domain = book_domain_node.cast<Domain>();
- ASSERT_EQ("book", book_domain->getName());
+ // check the ontology node.
+ Rooted<Ontology> book_ontology = book_ontology_node.cast<Ontology>();
+ ASSERT_EQ("book", book_ontology->getName());
// get the book struct node.
Cardinality single;
single.merge({1});
Rooted<StructuredClass> 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<StructuredClass> chapter =
- checkStructuredClass("chapter", "chapter", book_domain);
+ checkStructuredClass("chapter", "chapter", book_ontology);
Rooted<StructuredClass> section =
- checkStructuredClass("section", "section", book_domain);
+ checkStructuredClass("section", "section", book_ontology);
Rooted<StructuredClass> subsection =
- checkStructuredClass("subsection", "subsection", book_domain);
+ checkStructuredClass("subsection", "subsection", book_ontology);
Rooted<StructuredClass> paragraph =
- checkStructuredClass("paragraph", "paragraph", book_domain,
+ checkStructuredClass("paragraph", "paragraph", book_ontology,
Cardinality::any(), nullptr, nullptr, true, false);
Rooted<StructuredClass> 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<Node> 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<Node> headings_ontology_node =
+ env.parse("headings_ontology.osxml", "", "", RttiSet{&RttiTypes::Ontology});
+ ASSERT_FALSE(headings_ontology_node == nullptr);
ASSERT_FALSE(logger.hasError());
- Rooted<Domain> headings_domain = headings_domain_node.cast<Domain>();
+ Rooted<Ontology> headings_ontology = headings_ontology_node.cast<Ontology>();
// now there should be a heading struct.
Rooted<StructuredClass> 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<Node> 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<Node> comments_ontology_node =
+ env.parse("comments_ontology.osxml", "", "", RttiSet{&RttiTypes::Ontology});
+ ASSERT_FALSE(comments_ontology_node == nullptr);
ASSERT_FALSE(logger.hasError());
- Rooted<Domain> comments_domain = comments_domain_node.cast<Domain>();
+ Rooted<Ontology> comments_ontology = comments_ontology_node.cast<Ontology>();
// now we should be able to find a comment annotation.
Rooted<AnnotationClass> comment_anno =
- checkAnnotationClass("comment", "comment", comments_domain);
+ checkAnnotationClass("comment", "comment", comments_ontology);
// as well as a comment struct
Rooted<StructuredClass> comment =
- checkStructuredClass("comment", "comment", comments_domain);
+ checkStructuredClass("comment", "comment", comments_ontology);
// and a reply struct
Rooted<StructuredClass> reply =
- checkStructuredClass("reply", "reply", comments_domain);
+ checkStructuredClass("reply", "reply", comments_ontology);
// check the fields for each of them.
{
std::vector<Rooted<Descriptor>> descs{comment_anno, comment, reply};
diff --git a/test/plugins/filesystem/FileLocatorTest.cpp b/test/plugins/filesystem/FileLocatorTest.cpp
index 22db926..e2aacb1 100644
--- a/test/plugins/filesystem/FileLocatorTest.cpp
+++ b/test/plugins/filesystem/FileLocatorTest.cpp
@@ -38,12 +38,12 @@ TEST(FileLocator, addSearchPath)
// Add one path for three types.
instance.addSearchPath(".",
- {ResourceType::DOMAIN_DESC, ResourceType::SCRIPT,
+ {ResourceType::ONTOLOGY, ResourceType::SCRIPT,
ResourceType::TYPESYSTEM});
ASSERT_EQ(3U, instance.getSearchPaths().size());
- auto it = instance.getSearchPaths().find(ResourceType::DOMAIN_DESC);
+ auto it = instance.getSearchPaths().find(ResourceType::ONTOLOGY);
ASSERT_EQ(1U, it->second.size());
ASSERT_EQ(canonicalPath, it->second[0]);
@@ -64,12 +64,12 @@ TEST(FileLocator, addSearchPath)
// Adding the path another time should not increase the number of found
// paths, except for new resource types
instance.addSearchPath(
- canonicalPath, {ResourceType::DOMAIN_DESC, ResourceType::SCRIPT,
+ canonicalPath, {ResourceType::ONTOLOGY, ResourceType::SCRIPT,
ResourceType::TYPESYSTEM, ResourceType::ATTRIBUTES});
ASSERT_EQ(4U, instance.getSearchPaths().size());
- it = instance.getSearchPaths().find(ResourceType::DOMAIN_DESC);
+ it = instance.getSearchPaths().find(ResourceType::ONTOLOGY);
ASSERT_EQ(1U, it->second.size());
ASSERT_EQ(canonicalPath, it->second[0]);
@@ -93,11 +93,11 @@ TEST(FileLocator, addSearchPath)
std::string canonicalPath2 = fs::canonical("..").generic_string();
- instance.addSearchPath("..", {ResourceType::DOMAIN_DESC});
+ instance.addSearchPath("..", {ResourceType::ONTOLOGY});
ASSERT_EQ(4U, instance.getSearchPaths().size());
- it = instance.getSearchPaths().find(ResourceType::DOMAIN_DESC);
+ it = instance.getSearchPaths().find(ResourceType::ONTOLOGY);
ASSERT_EQ(2U, it->second.size());
ASSERT_EQ(canonicalPath, it->second[0]);
@@ -106,7 +106,7 @@ TEST(FileLocator, addSearchPath)
void assert_located(const FileLocator &instance, const std::string &path,
const std::string &relativeTo,
- ResourceType type = ResourceType::DOMAIN_DESC)
+ ResourceType type = ResourceType::ONTOLOGY)
{
Resource res;
ASSERT_TRUE(instance.locate(res, path, type, relativeTo));
@@ -117,7 +117,7 @@ void assert_located(const FileLocator &instance, const std::string &path,
void assert_not_located(const FileLocator &instance, const std::string &path,
const std::string &relativeTo,
- ResourceType type = ResourceType::DOMAIN_DESC)
+ ResourceType type = ResourceType::ONTOLOGY)
{
Resource res;
ASSERT_FALSE(instance.locate(res, path, type, relativeTo));
@@ -134,7 +134,7 @@ TEST(FileLocator, locate)
assert_not_located(locator, "c.txt", "");
// Add the respective search path
- locator.addUnittestSearchPath("filesystem/b", ResourceType::DOMAIN_DESC);
+ locator.addUnittestSearchPath("filesystem/b", ResourceType::ONTOLOGY);
// Now we should be able to find both.
assert_located(locator, "a.txt", "");
@@ -217,8 +217,8 @@ TEST(FileLocator, testDefaultSearchPaths)
locator.addDefaultSearchPaths();
assert_not_located(locator, "book.osxml", "", ResourceType::UNKNOWN);
- assert_located(locator, "domain/book.osxml", "", ResourceType::UNKNOWN);
- assert_located(locator, "book.osxml", "", ResourceType::DOMAIN_DESC);
+ assert_located(locator, "ontology/book.osxml", "", ResourceType::UNKNOWN);
+ assert_located(locator, "book.osxml", "", ResourceType::ONTOLOGY);
assert_not_located(locator, "color.osxml", "", ResourceType::UNKNOWN);
assert_located(locator, "typesystem/color.osxml", "",
ResourceType::UNKNOWN);
diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp
index 2f56e40..debb667 100644
--- a/test/plugins/html/DemoOutputTest.cpp
+++ b/test/plugins/html/DemoOutputTest.cpp
@@ -26,10 +26,10 @@
#include <core/common/Rtti.hpp>
#include <core/frontend/TerminalLogger.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/TestAdvanced.hpp>
-#include <core/model/TestDomain.hpp>
+#include <core/model/TestOntology.hpp>
namespace ousia {
namespace html {
@@ -40,12 +40,12 @@ TEST(DemoHTMLTransformer, writeHTML)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domains.
- Rooted<Domain> bookDom = constructBookDomain(mgr, sys, logger);
- Rooted<Domain> headingDom =
- constructHeadingDomain(mgr, sys, bookDom, logger);
- Rooted<Domain> listDom = constructListDomain(mgr, sys, bookDom, logger);
- Rooted<Domain> emDom = constructEmphasisDomain(mgr, sys, logger);
+ // Get the ontologies.
+ Rooted<Ontology> bookDom = constructBookOntology(mgr, sys, logger);
+ Rooted<Ontology> headingDom =
+ constructHeadingOntology(mgr, sys, bookDom, logger);
+ Rooted<Ontology> listDom = constructListOntology(mgr, sys, bookDom, logger);
+ Rooted<Ontology> emDom = constructEmphasisOntology(mgr, sys, logger);
// Construct the document.
Rooted<Document> doc = constructAdvancedDocument(
mgr, logger, bookDom, headingDom, listDom, emDom);
@@ -75,13 +75,13 @@ TEST(DemoHTMLTransformer, AnnotationProcessing)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domains.
- Rooted<Domain> bookDom = constructBookDomain(mgr, sys, logger);
- Rooted<Domain> emDom = constructEmphasisDomain(mgr, sys, logger);
+ // Get the ontologies.
+ Rooted<Ontology> bookDom = constructBookOntology(mgr, sys, logger);
+ Rooted<Ontology> emDom = constructEmphasisOntology(mgr, sys, logger);
// Construct a document only containing overlapping annotations.
// it has the form: <em>bla<strong>blub</em>bla</strong>
Rooted<Document> doc{new Document(mgr, "annotations.oxd")};
- doc->referenceDomains({bookDom, emDom});
+ doc->referenceOntologys({bookDom, emDom});
Rooted<StructuredEntity> book =
buildRootStructuredEntity(doc, logger, {"book"});
ASSERT_TRUE(book != nullptr);
diff --git a/test/plugins/xml/XmlOutputTest.cpp b/test/plugins/xml/XmlOutputTest.cpp
index fcf72d2..ac80a57 100644
--- a/test/plugins/xml/XmlOutputTest.cpp
+++ b/test/plugins/xml/XmlOutputTest.cpp
@@ -26,10 +26,10 @@
#include <core/common/Rtti.hpp>
#include <core/frontend/TerminalLogger.hpp>
#include <core/model/Document.hpp>
-#include <core/model/Domain.hpp>
+#include <core/model/Ontology.hpp>
#include <core/model/TestAdvanced.hpp>
-#include <core/model/TestDomain.hpp>
+#include <core/model/TestOntology.hpp>
namespace ousia {
namespace xml {
@@ -40,12 +40,12 @@ TEST(DemoHTMLTransformer, writeHTML)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domains.
- Rooted<Domain> bookDom = constructBookDomain(mgr, sys, logger);
- Rooted<Domain> headingDom =
- constructHeadingDomain(mgr, sys, bookDom, logger);
- Rooted<Domain> listDom = constructListDomain(mgr, sys, bookDom, logger);
- Rooted<Domain> emDom = constructEmphasisDomain(mgr, sys, logger);
+ // Get the ontologies.
+ Rooted<Ontology> bookDom = constructBookOntology(mgr, sys, logger);
+ Rooted<Ontology> headingDom =
+ constructHeadingOntology(mgr, sys, bookDom, logger);
+ Rooted<Ontology> listDom = constructListOntology(mgr, sys, bookDom, logger);
+ Rooted<Ontology> emDom = constructEmphasisOntology(mgr, sys, logger);
// Construct the document.
Rooted<Document> doc = constructAdvancedDocument(
mgr, logger, bookDom, headingDom, listDom, emDom);
@@ -71,13 +71,13 @@ TEST(DemoHTMLTransformer, AnnotationProcessing)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Get the domains.
- Rooted<Domain> bookDom = constructBookDomain(mgr, sys, logger);
- Rooted<Domain> emDom = constructEmphasisDomain(mgr, sys, logger);
+ // Get the ontologies.
+ Rooted<Ontology> bookDom = constructBookOntology(mgr, sys, logger);
+ Rooted<Ontology> emDom = constructEmphasisOntology(mgr, sys, logger);
// Construct a document only containing overlapping annotations.
// it has the form: <em>bla<strong>blub</em>bla</strong>
Rooted<Document> doc{new Document(mgr, "annotations.oxd")};
- doc->referenceDomains({bookDom, emDom});
+ doc->referenceOntologys({bookDom, emDom});
Rooted<StructuredEntity> book =
buildRootStructuredEntity(doc, logger, {"book"});
ASSERT_TRUE(book != nullptr);
@@ -114,11 +114,11 @@ TEST(DemoHTMLTransformer, PrimitiveSubtreeFields)
TerminalLogger logger{std::cerr, true};
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
- // Construct a simple domain.
- Rooted<Domain> domain{new Domain(mgr, sys, "myDomain")};
+ // Construct a simple ontology.
+ Rooted<Ontology> ontology{new Ontology(mgr, sys, "myOntology")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, Cardinality::any(), nullptr, false, true)};
+ mgr, "A", ontology, Cardinality::any(), nullptr, false, true)};
Rooted<FieldDescriptor> A_a =
A->createPrimitiveFieldDescriptor(sys->getStringType(), logger,
FieldDescriptor::FieldType::SUBTREE,
@@ -129,7 +129,7 @@ TEST(DemoHTMLTransformer, PrimitiveSubtreeFields)
"b").first;
Rooted<FieldDescriptor> A_main =
A->createPrimitiveFieldDescriptor(sys->getStringType(), logger).first;
- ASSERT_TRUE(domain->validate(logger));
+ ASSERT_TRUE(ontology->validate(logger));
// Construct a document for it.
Rooted<Document> doc{new Document(mgr, "myDoc")};
Rooted<StructuredEntity> A_impl = doc->createRootStructuredEntity(A);
@@ -144,7 +144,7 @@ TEST(DemoHTMLTransformer, PrimitiveSubtreeFields)
transformer.writeXml(doc, out, logger, dummy, false);
const std::string res = out.str();
ASSERT_TRUE(
- res.find("<myDomain:A><a>test_a</a><b>test_b</b>test</myDomain:A>") !=
+ res.find("<myOntology:A><a>test_a</a><b>test_b</b>test</myOntology:A>") !=
std::string::npos);
}
}