Work in progress...
import context from 'schema.org/context';
data
is an optional array of flattened JSON-LD document containing
RDFS definition of schema.org
extension.
import SchemaOrg from 'schema.org';
var schemaOrg = new SchemaOrg();
returns the RDFS node corresponding to the term;
schemaOrg.get(MedicalScholarlyArticle)
{ '@id': 'schema:MedicalScholarlyArticle',
'@type': 'rdfs:Class',
comment: 'A scholarly article in the medical domain.',
label: 'MedicalScholarlyArticle',
subClassOf: [ 'schema:ScholarlyArticle' ] }
returns a set containing the sub classes of the type
. if recursive
is false
(default value is true
) only the direct descendant are
returned.
schemaOrg.getSubClasses('Article', false)
Set {
'NewsArticle',
'Report',
'ScholarlyArticle',
'SocialMediaPosting',
'TechArticle' }
returns a set representing the trail of parent classes.
schemaOrg.getParents('MedicalScholarlyArticle')
Set { 'ScholarlyArticle', 'Article', 'CreativeWork', 'Thing' }
returns true
if value
(or list of thereof) is a type
schemaOrg.is('MedicalScholarlyArticle', 'Article') === true
Infer the type of the object obj
and returns undefined
when no
type can be safely inferred (multiple options). If minType
is
specified the returning type must be at least as specific or more
specific than minType
.
schemaOrg.getType({
"name": "a name",
"videoQuality": "video quality",
"transcript": "a transcript"
}) === 'VideoObject'
import * as utils from 'schema.org/utils';
npm test
Apache 2.0