Options
All
  • Public
  • Public/Protected
  • All
Menu

rdflib

Index

Namespaces

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

CallBackFunction

CallBackFunction: (uri: string, ok: boolean, message: string, response: Error | Response) => {} | void

Type declaration

    • (uri: string, ok: boolean, message: string, response: Error | Response): {} | void
    • Parameters

      • uri: string
      • ok: boolean
      • message: string
      • response: Error | Response

      Returns {} | void

CallbackFunc

CallbackFunc: (error: any, kb: Formula | null) => void

Type declaration

    • (error: any, kb: Formula | null): void
    • Parameters

      Returns void

Comparable

Comparable: Term | TFNamedNode | TFBlankNode | TFLiteral | Quad | undefined | null

ContentType

A valid mime type header

DefaultFactoryTypes

DefaultFactoryTypes: NamedNode | BlankNode | Literal | Variable | Statement

FeaturesType

FeaturesType: Array<"sameAs" | "InverseFunctionalProperty" | "FunctionalProperty"> | undefined

Fetch

Fetch: (input: RequestInfo, init?: RequestInit) => Promise<ExtendedResponse>

Differs from normal Fetch, has an extended Response type

Type declaration

    • Parameters

      • input: RequestInfo
      • Optional init: RequestInit

      Returns Promise<ExtendedResponse>

FromValueReturns

FromValueReturns<C>: Term | undefined | null | Collection<C>

All the types that a .fromValue() method might return

Type parameters

GraphType

GraphType: RDFlibDefaultGraph | RDFlibNamedNode | RDFlibVariable

An RDF/JS Graph

HTTPMethods

HTTPMethods: "GET" | "PUT" | "POST" | "PATCH" | "HEAD" | "DELETE" | "CONNECT" | "TRACE" | "OPTIONS"

Indexable

Indexable: number | string

Namespace

Namespace: (term: string) => TFNamedNode

Type declaration

    • (term: string): TFNamedNode
    • Parameters

      • term: string

      Returns TFNamedNode

ObjectType

ObjectType: RDFlibNamedNode | RDFlibLiteral | Collection | RDFlibBlankNode | RDFlibVariable | Empty

An RDF/JS Object

Options

Options: Partial<AutoInitOptions>

All valid inputs for initFetchOptions

PredicateType

PredicateType: RDFlibNamedNode | RDFlibVariable

An RDF/JS Predicate

Quad_Graph

Quad_Graph: NamedNode | DefaultGraph | BlankNode | Variable

A RDF/JS spec Graph

Quad_Object

Quad_Object: NamedNode | BlankNode | Literal | Variable | Term

A RDF/JS spec Object

Quad_Predicate

Quad_Predicate: NamedNode | Variable

A RDF/JS spec Predicate

Quad_Subject

Quad_Subject: NamedNode | BlankNode | Variable

A RDF/JS spec Subject

Result

Result: Response

StatusValues

StatusValues: undefined | true | "done" | 401 | 403 | 404 | "redirected" | "failed" | "parse_error" | "unsupported_protocol" | "timeout" | number

SubjectType

SubjectType: RDFlibBlankNode | RDFlibNamedNode | RDFlibVariable

An RDF/JS Subject

SupportTable

SupportTable: Record<Feature, boolean>

A set of features that may be supported by a Data Factory

TFIDFactoryTypes

TFIDFactoryTypes: TFNamedNode | TFBlankNode | TFLiteral | Quad | TFVariable | Term

TermType

TermType: typeof NamedNodeTermType | typeof BlankNodeTermType | typeof LiteralTermType | typeof VariableTermType | typeof DefaultGraphTermType | typeof CollectionTermType | typeof EmptyTermType | typeof GraphTermType

UserCallback

UserCallback: (ok: boolean, message: string, response?: any) => void

Type declaration

    • (ok: boolean, message: string, response?: any): void
    • Parameters

      • ok: boolean
      • message: string
      • Optional response: any

      Returns void

ValueType

ValueType: Term | Node | Date | string | number | boolean | undefined | null | Collection

A type for values that serves as inputs

Variables

$SolidTestEnvironment

$SolidTestEnvironment: { localSiteMap?: any }

Type declaration

  • Optional localSiteMap?: any

Const BlankNodeTermType

BlankNodeTermType: "BlankNode" = "BlankNode" as const

Const CollectionTermType

CollectionTermType: "Collection" = "Collection" as const

Const DefaultGraphTermType

DefaultGraphTermType: "DefaultGraph" = "DefaultGraph" as const

Const EmptyTermType

EmptyTermType: "Empty" = "Empty" as const

Const GraphTermType

GraphTermType: "Graph" = "Graph" as const

Const HTMLContentType

HTMLContentType: "text/html" = "text/html" as const

Const JSONLDContentType

JSONLDContentType: "application/ld+json" = "application/ld+json" as const

Const LiteralTermType

LiteralTermType: "Literal" = "Literal" as const

Const N3ContentType

N3ContentType: "text/n3" = "text/n3" as const

Const N3LegacyContentType

N3LegacyContentType: "application/n3" = "application/n3" as const

Const NQuadsAltContentType

NQuadsAltContentType: "application/nquads" = "application/nquads" as const

Const NQuadsContentType

NQuadsContentType: "application/n-quads" = "application/n-quads" as const

Const NTriplesContentType

NTriplesContentType: "application/n-triples" = "application/n-triples" as const

Const NamedNodeTermType

NamedNodeTermType: "NamedNode" = "NamedNode" as const

Const NextId

NextId: number = BlankNode.nextId

Const RDFXMLContentType

RDFXMLContentType: "application/rdf+xml" = "application/rdf+xml" as const

Const SPARQLUpdateContentType

SPARQLUpdateContentType: "application/sparql-update" = "application/sparql-update" as const

Const TurtleContentType

TurtleContentType: "text/turtle" = "text/turtle" as const

Const TurtleLegacyContentType

TurtleLegacyContentType: "application/x-turtle" = "application/x-turtle" as const

Const VariableTermType

VariableTermType: "Variable" = "Variable" as const

Const XHTMLContentType

XHTMLContentType: "application/xhtml+xml" = "application/xhtml+xml" as const

alert

alert: any = alert || console.log

Const appliedFactoryMethods

appliedFactoryMethods: string[] = ['blankNode','defaultGraph','literal','namedNode','quad','variable','supports',]

blankNode

blankNode: blankNode

Const boundDataFactory

boundDataFactory: IRDFlibDataFactory = {} as IRDFlibDataFactory

Const defaultGraph

defaultGraph: defaultGraph = new DefaultGraph()

Gets the default graph

Const defaultGraphNode

defaultGraphNode: NamedNode = new NamedNode(defaultGraphURI)

Const defaultGraphURI

defaultGraphURI: "chrome:theSession" = "chrome:theSession"

Const defaultXSD

defaultXSD: XSD = createXSD(CanonicalDataFactory)

Const fetch

fetch: any = typeof window === 'undefined' ? solidAuthCli : solidAuthClient

fetcher

fetcher: (store: IndexedFormula, options: any) => Fetcher

Type declaration

Const formula

formula: Formula = new Formula()

graph

graph: (features?: any, opts?: any) => IndexedFormula

Type declaration

lit

lit: (val: string, lang?: undefined | string, dt?: NamedNode) => RDFlibLiteral

Type declaration

    • (val: string, lang?: undefined | string, dt?: NamedNode): RDFlibLiteral
    • Parameters

      • val: string
      • Optional lang: undefined | string
      • Optional dt: NamedNode

      Returns RDFlibLiteral

literal

literal: literal

namedNode

namedNode: namedNode

Const owlNamespaceURI

owlNamespaceURI: "http://www.w3.org/2002/07/owl#" = "http://www.w3.org/2002/07/owl#"

Const parseRDFaDOM

parseRDFaDOM: parseRDFaDOM = RDFaProcessor.parseRDFaDOM

quad

quad: quad

st

st: (subject: Quad_Subject, predicate: Quad_Predicate, object: Quad_Object, graph?: Quad_Graph) => Statement

Type declaration

Const term

term: <T>(value: ValueType) => T = Node.fromValue

Type declaration

triple

triple: (subject: Term, predicate: Term, object: Term, graph?: Term) => Quad<any, any, any, any>

Type declaration

variable

variable: variable

Functions

AJAR_handleNewTerm

  • AJAR_handleNewTerm(kb: { fetcher: Fetcher }, p: any, requestedBy: any): any
  • Loads ontologies of the data we load (this is the callback from the kb to the fetcher).

    Parameters

    Returns any

ArrayIndexOf

  • ArrayIndexOf(arr: any, item: any, i?: number): number
  • Parameters

    • arr: any
    • item: any
    • Default value i: number = 0

    Returns number

DOMParserFactory

  • DOMParserFactory(): any
  • Returns a DOM parser based on current runtime environment.

    Returns any

Namespace

RDFArrayRemove

  • RDFArrayRemove(a: any, x: any): void
  • Removes all statements equal to x from a

    Parameters

    • a: any
    • x: any

    Returns void

RDFParser

  • RDFParser(store: any): void

SPARQLToQuery

  • SPARQLToQuery(SPARQL: any, testMode: any, kb: any): false | Query
  • sparql:

    SPARQL text that is converted to a query object which is returned.

    testmode:

    testing flag. Prevents loading of sources.

    Parameters

    • SPARQL: any
    • testMode: any
    • kb: any

    Returns false | Query

arrayToStatements

  • Expands an array of Terms to a set of statements representing the rdf:list.

    Parameters

    Returns Quad[]

    The {data} as a set of statements.

callbackify

  • callbackify(obj: any, callbacks: string[]): void
  • Adds callback functionality to an object. Callback functions are indexed by a 'hook' string. They return true if they want to be called again.

    method

    callbackify

    Parameters

    • obj: any
    • callbacks: string[]

    Returns void

convertToJson

  • convertToJson(n3String: any, jsonCallback: any): void
  • Parameters

    • n3String: any
    • jsonCallback: any

    Returns void

convertToNQuads

  • convertToNQuads(n3String: any, nquadCallback: any): void
  • Parameters

    • n3String: any
    • nquadCallback: any

    Returns void

createXSD

docpart

  • docpart(uri: string): string
  • Gets the document part of an URI

    Parameters

    • uri: string

      The URI

    Returns string

document

  • document(x: string): RDFlibNamedNode
  • Gets the document part of an URI as a named node

    Parameters

    • x: string

      The URI

    Returns RDFlibNamedNode

domToString

  • domToString(node: any, options: any): string

dtstamp

  • dtstamp(): string

dumpNode

  • dumpNode(node: any, options: any, selfClosing: any, skipAttributes: any): string
  • Parameters

    • node: any
    • options: any
    • selfClosing: any
    • skipAttributes: any

    Returns string

Const fromNT

  • fromNT(str: any): any

fromValue

  • Creates an RDF Node from a native javascript value. RDF Nodes are returned unchanged, undefined returned as itself. Arrays return Collections. Strings, numbers and booleans return Literals.

    Type parameters

    Parameters

    Returns T

Const getNS

handleFP

handleIFP

handleRDFType

heavyCompare

  • heavyCompare(x: any, y: any, g: any, uriMap: any): any
  • Compares statements (heavy comparison for repeatable canonical ordering)

    Parameters

    • x: any
    • y: any
    • g: any
    • uriMap: any

    Returns any

heavyCompareSPO

  • heavyCompareSPO(x: any, y: any, g: any, uriMap: any): any

hostpart

  • hostpart(u: string): string
  • Gets the hostname in an URI

    Parameters

    • u: string

      The URI

    Returns string

indexedFormulaQuery

  • indexedFormulaQuery(myQuery: any, callback: any, fetcher: any, onDone: any): void
  • This function will match a pattern to the current kb

    The callback function is called whenever a match is found When fetcher is supplied this will be called to satisfy any resource requests currently not in the kb. The fetcher function needs to be defined manualy and should call $rdf.Util.AJAR_handleNewTerm to process the requested resource.

    Parameters

    • myQuery: any

      a knowledgebase containing a pattern to use as query

    • callback: any

      whenever the pattern in myQuery is met this is called with the new bindings as parameter

    • fetcher: any

      IGNORED OBSOLETE f.fetecher is used as a Fetcher instance to do this.

    • onDone: any

      callback when query finished

    Returns void

isBlankNode

  • isBlankNode(obj: any): obj is BlankNode
  • TypeGuard for RDF/JS spec BlankNodes

    Parameters

    • obj: any

    Returns obj is BlankNode

isCollection

  • isCollection(obj: any): obj is Collection<any>
  • TypeGuard for RDFLib Collections

    Parameters

    • obj: any

    Returns obj is Collection<any>

isDefaultGraph

  • isDefaultGraph(object: any): object is DefaultGraph

isGraph

  • isGraph(obj: any): obj is Quad_Graph
  • TypeGuard for valid RDF/JS Graph types

    Parameters

    • obj: any

    Returns obj is Quad_Graph

isLiteral

  • isLiteral(value: any): value is Literal
  • TypeGuard for RDF/JS spec Literals

    Parameters

    • value: any

    Returns value is Literal

isNamedNode

  • isNamedNode(obj: any): obj is NamedNode
  • TypeGuard for RDF/JS spec NamedNodes

    Parameters

    • obj: any

    Returns obj is NamedNode

isPredicate

  • isPredicate(obj: any): obj is Quad_Predicate
  • TypeGuard for valid RDF/JS spec Predicate types

    Parameters

    • obj: any

    Returns obj is Quad_Predicate

isQuad

  • isQuad(obj: any): obj is Quad<any, any, any, any>
  • TypeGuard for RDF/JS spec Quads

    Parameters

    • obj: any

    Returns obj is Quad<any, any, any, any>

isRDFObject

  • isRDFObject(obj: any): obj is Quad_Object
  • TypeGuard for valid RDF/JS spec Object types

    Parameters

    • obj: any

    Returns obj is Quad_Object

isRDFlibObject

  • isRDFlibObject(obj: any): obj is ObjectType
  • TypeGuard for valid RDFlib Object types, also allows Collections

    Parameters

    • obj: any

    Returns obj is ObjectType

isStatement

  • isStatement(obj: any): obj is Statement
  • TypeGuard for RDFLib Statements

    Parameters

    • obj: any

    Returns obj is Statement

isStore

  • isStore(obj: any): obj is IndexedFormula
  • TypeGuard for RDFlib Stores

    Parameters

    • obj: any

    Returns obj is IndexedFormula

isSubject

  • isSubject(obj: any): obj is Quad_Subject
  • TypeGuard for valid RDF/JS spec Subject types

    Parameters

    • obj: any

    Returns obj is Quad_Subject

isTerm

  • isTerm(obj: any): obj is Term
  • TypeGuard for RDF/JS spec Terms

    Parameters

    • obj: any

    Returns obj is Term

isVariable

  • isVariable(obj: any): obj is Variable
  • TypeGuard for RDFLib Variables

    Parameters

    • obj: any

    Returns obj is Variable

isXHTML

  • isXHTML(responseText: any): boolean

isXML

  • isXML(responseText: string): boolean

isXMLNS

  • isXMLNS(responseText: string): boolean

join

  • join(given: string, base: string): string
  • Joins an URI with a base

    Parameters

    • given: string

      The relative part

    • base: string

      The base URI

    Returns string

jsonldObjectToTerm

  • jsonldObjectToTerm(kb: any, obj: any): any
  • Parses json-ld formatted JS objects to a rdf Term.

    Parameters

    • kb: any

      The DataFactory to use.

    • obj: any

      The json-ld object to process.

    Returns any

jsonldParser

  • jsonldParser(str: any, kb: any, base: any, callback: any): Promise<any>
  • Takes a json-ld formatted string {str} and adds its statements to {kb}.

    Ensure that {kb.rdfFactory} is a DataFactory.

    Parameters

    • str: any
    • kb: any
    • base: any
    • callback: any

    Returns Promise<any>

linkRelationProperty

  • linkRelationProperty(relation: any): NamedNode

listToCollection

  • listToCollection(kb: any, obj: any): any

listToStatements

  • listToStatements(kb: any, obj: any): any
  • Adds the statements in a json-ld list object to {kb}.

    Parameters

    • kb: any
    • obj: any

    Returns any

mediaTypeClass

  • mediaTypeClass(mediaType: any): NamedNode

output

  • output(o: string): void
  • Defines a simple debugging function

    method

    output

    Parameters

    • o: string

    Returns void

parse

  • Parse a string and put the result into the graph kb. Normal method is sync. Unfortunately jsdonld is currently written to need to be called async. Hence the mess below with executeCallback.

    Parameters

    • str: string

      The input string to parse

    • kb: Formula

      The store to use

    • base: string

      The base URI to use

    • Default value contentType: string | ContentType = "text/turtle"

      The MIME content type string for the input - defaults to text/turtle

    • Optional callback: CallbackFunc

    Returns void

parseXML

  • parseXML(str: any, options: any): any
  • Returns a DOM from parsex XML.

    Parameters

    • str: any
    • options: any

    Returns any

protocol

  • protocol(uri: string): string | null
  • Gets the protocol part of an URI

    Parameters

    • uri: string

      The URI

    Returns string | null

queryToSPARQL

  • queryToSPARQL(query: any): string

refTo

  • refTo(base: string, uri: string): string
  • Gets a relative uri

    Parameters

    • base: string

      The base URI

    • uri: string

      The absolute URI

    Returns string

serialize

  • serialize(target: Formula | NamedNode | BlankNode, kb?: IndexedFormula, base?: unknown, contentType?: string | ContentType, callback?: undefined | ((err: Error | undefined | null, result?: string | null) => any), options?: undefined | { flags: string }): string | undefined
  • Serialize to the appropriate format

    Parameters

    • target: Formula | NamedNode | BlankNode
    • Optional kb: IndexedFormula
    • Optional base: unknown
    • Optional contentType: string | ContentType
    • Optional callback: undefined | ((err: Error | undefined | null, result?: string | null) => any)
    • Optional options: undefined | { flags: string }

    Returns string | undefined

sparqlUpdateParser

  • sparqlUpdateParser(str: any, kb: any, base: any): clauses

stackString

  • stackString(e: any): string

stringTemplate

  • stringTemplate(base: any, subs: any): string
  • C++, python style %s -> subs

    Parameters

    • base: any
    • subs: any

    Returns string

string_startswith

  • string_startswith(str: any, pref: any): boolean

termValue

  • termValue(node: Term | string): string
  • Retrieve the value of a term, or self if already a string.

    Parameters

    • node: Term | string

    Returns string

Object literals

Const CONTENT_TYPE_BY_EXT

CONTENT_TYPE_BY_EXT: object

acl

acl: string = "text/n3"

html

html: string = "text/html"

n3

n3: string = "text/n3"

nt

nt: string = "text/n3"

owl

owl: "application/rdf+xml" = RDFXMLContentType

rdf

rdf: "application/rdf+xml" = RDFXMLContentType

ttl

ttl: string = "text/turtle"

xml

xml: string = "text/xml"

Const CanonicalDataFactory

CanonicalDataFactory: object

A basic internal RDFlib datafactory, which does not support Collections

blankNode

  • blankNode(value?: undefined | string): BlankNode

defaultGraph

equals

id

  • Generates a uniquely identifiably idempotent string for the given {term}.

    Equivalent to [[Term.hashString]]

    example

    Use this to associate data with a term in an object { obj[id(term)] = "myData" }

    Parameters

    Returns string

isQuad

  • isQuad(obj: any): obj is Statement

literal

  • literal(value: string | number | boolean | Date, languageOrDatatype?: string | TFNamedNode): Literal
  • Creates a new literal node. Does some JS literal parsing for ease of use.

    Parameters

    • value: string | number | boolean | Date

      The lexical value

    • Optional languageOrDatatype: string | TFNamedNode

      Either the language or the datatype

    Returns Literal

namedNode

  • namedNode(value: string): NamedNode

quad

quadToNQ

termToNQ

  • termToNQ(term: Term): string

toNQ

triple

variable

  • variable(name?: undefined | string): Variable

supports

supports: object

__computed

__computed: true = true

Const ClassOrder

ClassOrder: object

Class orders

BlankNode

BlankNode: number = 6

Collection

Collection: number = 3

Graph

Graph: number = 4

Literal

Literal: number = 1

NamedNode

NamedNode: number = 5

Variable

Variable: number = 7

Const ExtendedTermFactory

ExtendedTermFactory: object

Data factory which also supports Collections

Necessary for preventing circular dependencies.

collection

id

termToNQ

  • termToNQ(term: Term): string

supports

supports: object

__computed

__computed: true = true

Const Parsable

Parsable: object

application/ld+json

application/ld+json: boolean = true

application/rdf+xml

application/rdf+xml: boolean = true

application/xhtml+xml

application/xhtml+xml: boolean = true

text/html

text/html: boolean = true

text/n3

text/n3: boolean = true

text/turtle

text/turtle: boolean = true

Const RDFlibDataFactory

RDFlibDataFactory: object

Full RDFLib.js Data Factory

fetcher

graph

lit

st

Const defaultHandlers

defaultHandlers: object

HTMLHandler

HTMLHandler: HTMLHandler

N3Handler

N3Handler: N3Handler

RDFXMLHandler

RDFXMLHandler: RDFXMLHandler

TextHandler

TextHandler: TextHandler

XHTMLHandler

XHTMLHandler: XHTMLHandler

XMLHandler

XMLHandler: XMLHandler

Const log

log: object

A Dummy log

module

log

debug

  • debug(x: any): void

error

  • error(x: any): void

info

  • info(x: any): void

msg

  • msg(x: any): void

success

  • success(x: any): void

warn

  • warn(x: any): void

Const ns

ns: object = getNS()

xsd

xsd: (ln: string) => NamedNode = Namespace('http://www.w3.org/2001/XMLSchema#')

Type declaration

Const rdf

rdf: object

first

first: string = "http://www.w3.org/1999/02/22-rdf-syntax-ns#first"

nil

nil: string = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"

rest

rest: string = "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"

Const string

string: object

template

template: stringTemplate = stringTemplate