TaxonomyBase

final class TaxonomyBase

Very limited notion of a taxonomy, as a collection of taxonomy documents. It contains a map from URIs (with fragments) to taxonomy documents, for quick element lookups based on URIs with fragments. It also contains a map from ENames (names with target namespace) of global element declarations and named type definitions.

Very limited notion of a taxonomy, as a collection of taxonomy documents. It contains a map from URIs (with fragments) to taxonomy documents, for quick element lookups based on URIs with fragments. It also contains a map from ENames (names with target namespace) of global element declarations and named type definitions.

It '''does not understand (resolved) relationships''', and it has no taxonomy query API, but it supports creation of such a taxonomy that does know about relationships and does have a taxonomy query API. In that sense, the reason for this class to exist is mainly its role in creating rich taxonomy objects.

Not only does this class not understand (resolved) relationships, it also '''does not know about substitution groups''' and therefore it does not know about concept declarations (unless all substitution groups are in the taxonomy base and we are prepared to follow them all).

This object is rather expensive to create (through the build method), building the maps that support fast querying based on URI (with fragment) or "target EName".

TaxonomyBase creation should never fail, if correct URIs are passed. Even the instance methods are very lenient and should never fail. Typically, a taxonomy instantiated as an object of this class has not yet been validated.

For the taxonomyDocUriMap and elemUriMap, we have that data is silently lost in those maps if there are any duplicate IDs (per document). In a valid taxonomy (as XML document set) this duplication is not allowed.

For the globalElementDeclarationMap, namedTypeDefinitionMap, etc., we also have that data is silently lost if there is more than 1 global element declaration (or named type definition) with the same "target EName". In a valid taxonomy (as XML schema) this duplication is not allowed.

Authors

Chris de Vreeze

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def filteringDocumentUris(docUris: Set[URI]): TaxonomyBase

Creates a "sub-taxonomy" in which only the given document URIs occur. It can be used for a specific entry point DTS, or to make query methods (not taking an EName) cheaper.

Creates a "sub-taxonomy" in which only the given document URIs occur. It can be used for a specific entry point DTS, or to make query methods (not taking an EName) cheaper.

Returns all duplicate global element declaration "target ENames" over all DOM trees combined. If the result is non-empty, the taxonomy is incorrect, and the map from ENames to global element declarations loses data.

Returns all duplicate global element declaration "target ENames" over all DOM trees combined. If the result is non-empty, the taxonomy is incorrect, and the map from ENames to global element declarations loses data.

def findAllDuplicateIds(rootElem: TaxonomyElem): Set[String]

Returns all duplicate ID attributes in the DOM tree with the given root element. If the result is non-empty, the taxonomy is incorrect, and the map from URIs to elements loses data.

Returns all duplicate ID attributes in the DOM tree with the given root element. If the result is non-empty, the taxonomy is incorrect, and the map from URIs to elements loses data.

The type of the ID attributes is not taken into account, although strictly speaking that is incorrect.

Returns all duplicate named type definition "target ENames" over all DOM trees combined. If the result is non-empty, the taxonomy is incorrect, and the map from ENames to named type definitions loses data.

Returns all duplicate named type definition "target ENames" over all DOM trees combined. If the result is non-empty, the taxonomy is incorrect, and the map from ENames to named type definitions loses data.

def findBaseTypeOrSelfUntil(typeEName: EName, p: EName => Boolean): Option[EName]

If the given type obeys the type predicate, returns it, wrapped in an Option. Otherwise, returns the optional base type if that type obeys the type predicate, and so on, until either the predicate holds or no further base type can be found in the taxonomy.

If the given type obeys the type predicate, returns it, wrapped in an Option. Otherwise, returns the optional base type if that type obeys the type predicate, and so on, until either the predicate holds or no further base type can be found in the taxonomy.

def findElemByUri(elemUri: URI): Option[TaxonomyElem]

Finds the (first) optional element with the given URI. The fragment, if any, must be an XPointer or sequence thereof. Only shorthand pointers or non-empty sequences of element scheme XPointers are accepted. If there is no fragment, the first root element with the given document URI is searched for.

Finds the (first) optional element with the given URI. The fragment, if any, must be an XPointer or sequence thereof. Only shorthand pointers or non-empty sequences of element scheme XPointers are accepted. If there is no fragment, the first root element with the given document URI is searched for.

This is a quick operation for shorthand pointers, which are the most commonly used XPointers in URI fragments anyway.

The schema type of the ID attributes is not taken into account, although strictly speaking that is incorrect.

Finds the (first) optional global attribute declaration with the given target EName (name with target namespace).

Finds the (first) optional global attribute declaration with the given target EName (name with target namespace).

This is a quick operation.

Finds the (first) optional global element declaration with the given target EName (name with target namespace).

Finds the (first) optional global element declaration with the given target EName (name with target namespace).

This is a quick operation.

def findNamedTypeDefinitionByEName(targetEName: EName): Option[NamedTypeDefinition]

Finds the (first) optional named type definition with the given target EName (name with target namespace).

Finds the (first) optional named type definition with the given target EName (name with target namespace).

This is a quick operation.

def findRootElemByDocUri(docUri: URI): Option[TaxonomyElem]

Returns the optional document element of the document with the given URI.

Returns the optional document element of the document with the given URI.

Returns the equivalent of findRootElemByDocUri(docUri).get.

Returns the equivalent of findRootElemByDocUri(docUri).get.

def guessedScope: Scope

Returns the "guessed Scope" from the documents in the taxonomy. This can be handy for finding prefixes for namespace names, or for generating ENames from QNames.

Returns the "guessed Scope" from the documents in the taxonomy. This can be handy for finding prefixes for namespace names, or for generating ENames from QNames.

The resulting Scope is taken from the Scopes of the root elements, ignoring the default namespace, if any. If different root element Scopes are conflicting, it is undetermined which one wins.

def rootElems: IndexedSeq[TaxonomyElem]

Deprecated methods

@deprecated(message = "Deprecated due to performance issues. Consider using \'taxonomyDocUriMap\' or \'findRootElemByDocUri\' instead", since = "0.12.0")
Deprecated
[Since version 0.12.0] Deprecated due to performance issues. Consider using \'taxonomyDocUriMap\' or \'findRootElemByDocUri\' instead