The type of the mapping class whose instance is created.
The underlying term being wrapped.
The dataset containing the wrapped term.
The data factory used for creating new terms.
An instance of the mapping class created when invoking the constructor.
Mapping classes do not need to define a constructor that matches this signature, because the base class has a publicly accessible, matching constructor.
Given the mapping
class Person extends TermWrapper {
get name(): string {
return RequiredFrom.subjectPredicate(this, "name", LiteralAs.string)
}
}
class People extends DatasetWrapper {
[Symbol.iterator](): Iterator<Quad> {
return this.instancesOf("Person", Person) // 2nd param is an ITermWrapperConstructor
}
}
and the RDF
[ a <Person> ; <name> "Alice" ; ] .
[ a <Person> ; <name> "Bob" ; ] .
this code
for(const person of new People(dataset, factory)) {
console.log(person.name)
}
will print (not necessarily in this order)
Alice
Bob
Given the mapping
class Book extends TermWrapper {
get author(): Person {
return RequiredFrom.subjectPredicate(this, "author", TermAs.instance(Person)) // Person is an ITermWrapperConstructor
}
}
class Person extends TermWrapper {
get name(): string {
return RequiredFrom.subjectPredicate(this, "name", LiteralAs.string)
}
}
and the RDF
<book> <author> [ <name> "Alice" ; ] .
this code
const dataset =
const book = new Book("book", dataset, factory)
console.log(book.author.name)
will print
Alice
Represents the constructor signature of term mapping classes that extend TermWrapper.
Used by this library where constructors of mappers are accepted for implementing navigation properties that represent graph patterns on dataset and term wrappers.