Protected
Readonly
graphThe underlying data graph to enable the methods of this Term
Protected
Readonly
IRIThe compact IRI of this Term
Returns the description (rdfs:comment
) of this Term. It is possible to pass a language tag as parameter to get the description in that language, as long as the vocabulary provides that language. The english ("en"
) language is understood as default.
the wished language for the description (default = "en"
)
The description of this Term
Returns all descriptions (rdfs:comment
) of this Term as an Object. Each description (value) has a language tag (key) associated with it. Language tags are unique for each term (e.g. there is at most one description for any given language)
The descriptions of this Term
const tigerClass = mySdoAdapter.getClass("ex:Tiger");
tigerClass.getDescriptions();
// returns the descriptions of this class in all available languages:
{
"en": "The tiger (Panthera tigris) is the largest species among the Felidae and classified in the genus Panthera.",
"zh": "虎(学名:Panthera tigris),俗称老虎、大虫,被人称为百獸之王,是現存体型最大的两种猫科动物之一(另一种是狮)"
}
Retrieves the Enumeration Members of this Enumeration
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit enumeration members inherited recursively from sub-enumerations
The Enumeration Members of this Enumeration
Retrieves the IRI of this Term in compact (e.g. schema:Friday
) or in absolute form (e.g. https://schema.org/Friday
). By default, the absolute form is returned
states the format of the returned IRI, either "Compact" for the compact form, e.g. schema:Friday
, or "Absolute" for the absolute form, e.g. https://schema.org/Friday
The IRI of this Term
Returns the name (rdfs:label
) of this Term. It is possible to pass a language tag as parameter to get the name in that language, as long as the vocabulary provides that language. The english ("en"
) language is understood as default.
the wished language for the name (default = "en"
)
The name of this Term
Returns all names (rdfs:label
) of this Term as an Object. Each name (value) has a language tag (key) associated with it. Language tags are unique for each term (e.g. there is at most one name for any given language).
The names (with language tag) of this Term
Retrieves the properties of this Class
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit properties inherited from superclasses
The properties of this Class
personClass.getProperties();
// returns all properties of the class "schema:Person" (including inherited properties from its superclasses)
[
"schema:name",
"schema:description",
"schema:knows",
"schema:worksFor",
...
]
personClass.getProperties({ implicit: false });
// returns only the explicit properties of the class "schema:Person"
[
"schema:address",
"schema:weight",
"schema:worksFor",
...
]
This method was introduced mainly to return of source(s) for a term, as defined in the vocabulary itself with dcterms:source
or schema:source
. The later has been used to link to related github issues for the schema.org vocabulary.
The source IRI given by dcterms:source
or schema:source
of this Term
Retrieves the subclasses of this Class
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit subclasses inherited recursively from subclasses
The subclasses of this Class
Retrieves the superclasses of this Class
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit superclasses inherited recursively from superclasses
The superclasses of this Class
Retrieves the compact IRI for the type of this Term:
Class ->
"rdfs:Class"
Property ->"rdf:Property"
Enumeration ->"schema:Enumeration"
EnumerationMember ->"soa:EnumerationMember"
DataType ->"schema:DataType"
The term-type-IRI of this Term
Retrieves the label (string) for the type of this Term:
Class ->
"Class"
Property ->"Property"
Enumeration ->"Enumeration"
EnumerationMember ->"EnumerationMember"
DataType ->"DataType"
The term-type-label of this Term
This method was introduced mainly to return the vocabulary extension URL of schema.org to which the term belongs. The extension URL is defined in the vocabulary through the schema:isPartOf
property. If no such property is given, then the namespace URL for this term is returned.
The vocabulary URL of this term (extension or namespace)
const personClass = mySdoAdapter.getClass("schema:Person");
personClass.getVocabulary();
// returns the vocabulary url for the person class, which is the core vocabulary of schema.org
"https://schema.org"
const patientClass = mySdoAdapter.getClass("schema:Patient");
patientClass.getVocabulary();
// returns the vocabulary url for the patient class, which is the health extension of schema.org
"https://health-lifesci.schema.org"
Returns the URL of all vocabularies in which this term has been defined. Works only if the corresponding vocabulary was added through a URL, and not as a JSON-LD object.
The original vocabulary source urls of this Term
// the parameter `schemaVersion: "12.0"` tells the SDO-Adapter instance to initialize with the schema.org vocabulary version 12.0
const mySdoAdapter = await SOA.create({schemaVersion: "12.0"});
const personClass = mySdoAdapter.getClass("schema:Person");
personClass.getVocabURLs();
// returns the source vocabulary url for this class - notice that this url points to version 12.0 of schema.org
["https://raw.githubusercontent.com/semantifyit/schemaorg/main/data/releases/12.0/schemaorg-all-https.jsonld"]
Retrieves the properties that have this Class as a range
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit properties (where a superclass of this class is a range)
The properties that have this Class as a range
Returns the IRI of the Term superseding this Term (defined with schema:supersededBy
), if any. By default, the IRI is returned in compact form
states the format of the returned IRI, either "Compact" for the compact form, e.g. schema:softwareRequirements
, or "Absolute" for the absolute form, e.g. https://schema.org/softwareRequirements
The Term superseding this Term, if any
const requirementsProperty = mySdoAdapter.getProperty("schema:requirements");
requirementsProperty.isSupersededBy();
// returns IRI for the term that supersedes the property schema:requirements in compact form
"schema:softwareRequirements"
requirementsProperty.isSupersededBy("Absolute");
// returns IRI for the term that supersedes the property schema:requirements in absolute form
"https://schema.org/softwareRequirements"
Returns true, if the given Enumeration Member is a valid instance of this Enumeration. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the Enumeration Members of sub-enumerations are also taken into account)
The identification string of the Enumeration Member in question, can be an IRI (absolute or compact) or a label
If true, includes also Enumeration Members of sub-enumerations
if the given Enumeration Member is a valid instance of this Enumeration
statusEnumeration.isValidDomainEnumerationOf("schema:EventPostponed"); // true
statusEnumeration.isValidDomainEnumerationOf("schema:EventPostponed", true); // true
statusEnumeration.isValidDomainEnumerationOf("schema:EventPostponed", false); // false, (is a member of a sub-enumeration)
eventStatusTypeEnumeration.isValidDomainEnumerationOf("schema:EventPostponed", false); // true
Returns true, if the given property can use this class as a valid domain. The implicit parameter (default: true) allows to include properties inherited from superclasses
The identification string of the property in question, can be an IRI (absolute or compact) or a label
If true, include properties inherited from superclasses
if this class is a valid domain for the given property
Returns true, if the given property can use this class as a valid range. The implicit parameter (default: true) allows to cover recursive relationships (e.g. subclasses of valid ranges are also taken into account)
The identification string of the property in question, can be an IRI (absolute or compact) or a label
If true, includes also subclasses of ranges
if this class is a valid range for the given property
Returns true, if the given class is a valid superclass of this class. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the superclass of a superclass is also taken into account)
The identification string of the superclass in question, can be an IRI (absolute or compact) or a label
If true, includes also superclasses of superclasses
if the other class is a valid superclass of this class
Returns true, if the given class is a valid subclass of this class. The implicit parameter (default: true) allows to cover recursive relationships (e.g. the subclass of a subclass is also taken into account)
The identification string of the subclass in question, can be an IRI (absolute or compact) or a label
If true, includes also subclasses of subclasses
if the other class is a valid subclass of this class
Generates a JSON representation of this Enumeration (as JavaScript Object)
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit data (e.g. enumeration members, properties, etc.)
The JSON representation of this Enumeration as JavaScript Object
dayEnum.toJSON();
// returns a JSON representing the Enumeration "schema:DayOfWeek"
{
id: 'schema:DayOfWeek',
IRI: 'https://schema.org/DayOfWeek',
typeLabel: 'Enumeration',
typeIRI: 'schema:Enumeration',
vocabURLs: ["https://raw.githubusercontent.com/semantifyit/schemaorg/main/data/releases/12.0/schemaorg-all-https.jsonld"],
vocabulary: 'https://schema.org',
source: 'http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_GoodRelationsClass',
supersededBy: null,
name: 'DayOfWeek',
description: 'The day of the week, e.g. used to specify to which day the opening hours of an OpeningHoursSpecification refer.\n\nOriginally, URLs from [GoodRelations](http://purl.org/goodrelations/v1) were used (for [[Monday]], [[Tuesday]], [[Wednesday]], [[Thursday]], [[Friday]], [[Saturday]], [[Sunday]] plus a special entry for [[PublicHolidays]]); these have now been integrated directly into schema.org.\n',
superClasses: [ 'schema:Enumeration', 'schema:Intangible', 'schema:Thing' ],
subClasses: [],
properties: [
'schema:supersededBy',
'schema:sameAs',
'schema:description',
...
],
rangeOf: [
'schema:dayOfWeek',
'schema:byDay',
'schema:supersededBy',
...
],
enumerationMembers: [
'schema:PublicHolidays',
'schema:Sunday',
'schema:Monday',
'schema:Thursday',
...
]
}
Generates a JSON representation of this Enumeration (as string)
Check .toJSON() for an example output
Optional
paramObj: ParamObjIRIListInferencean optional parameter object that filters and formats the result, and defines the inference behaviour: The "implicit"-parameter defaults to true and returns also implicit data (e.g. enumeration members, properties, etc.)
The JSON representation of this Enumeration as string
An Enumeration represents an enumeration term, which is a special kind of Class. For SDO-Adapter, a Class is understood as Enumeration when it is a subclass of the schema.org Enumeration Class. Usually, Enumerations (e.g. schema:DayOfWeek) have predefined instances (e.g. schema:Monday) that are also part of the Vocabulary. Instead of creating new instances for this Class/Enumeration, it is usual to just link to a predefined instance (In SDO-Adapter these predefined instances are called Enumeration Members). But, since an Enumeration is also a Class, every enumeration can also be understood as a Class for which a new instance can be created, therefore the API also provides all Class methods for Enumerations. An Enumeration is created with SDOAdapter.getEnumeration() and offers the methods described below.