Options
All
  • Public
  • Public/Protected
  • All
Menu

rdflib

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

Comparable

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

ContentType

ContentType: "application/rdf+xml" | "text/html" | "application/ld+json" | "text/n3" | "application/n3" | "application/nquads" | "application/n-quads" | "application/sparql-update" | "text/turtle" | "application/x-turtle" | "application/xhtml+xml"

A valid mime type header

DefaultFactoryTypes

DefaultFactoryTypes: NamedNode | BlankNode | Literal | Variable | Statement

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

Indexable

Indexable: number | string

Namespace

Namespace: function

Type declaration

    • (term: string): TFNamedNode
    • Parameters

      • term: string

      Returns TFNamedNode

ObjectType

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

An RDF/JS Object

PredicateType

PredicateType: RDFlibNamedNode | RDFlibVariable

An RDF/JS Predicate

Quad_Graph

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

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: "NamedNode" | "BlankNode" | "Literal" | "Variable" | "DefaultGraph" | "Collection" | "Empty" | "Graph"

ValueType

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

A type for values that serves as inputs

Variables

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 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

Const appliedFactoryMethods

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

Const defaultGraphNode

defaultGraphNode: NamedNode = new NamedNode(defaultGraphURI)

Const defaultGraphURI

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

Functions

AJAR_handleNewTerm

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

    Parameters

    • kb: object
    • p: any
    • requestedBy: any

    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

  • Gets a namespace for the specified namespace's URI

    Parameters

    Returns function

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

  • Parameters

    • Default value localFactory: DataFactory<BlankNode | Literal | Variable | NamedNode | Statement, string | number> = CanonicalDataFactory

    Returns XSD

defaultGraph

  • defaultGraph(): NamedNode

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
  • Parameters

    • node: any
    • options: any

    Returns 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

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

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
  • Parameters

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

    Returns 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>

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

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
  • Parameters

    • relation: any

    Returns NamedNode

mediaTypeClass

  • mediaTypeClass(mediaType: any): NamedNode
  • Parameters

    • mediaType: any

    Returns NamedNode

output

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

    method

    output

    Parameters

    • o: string

    Returns void

parse

  • parse(str: string, kb: Formula, base: string, contentType: string | ContentType, callback?: CallbackFunc): void
  • 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

    • contentType: string | ContentType

      The MIME content type string for the input

    • Optional callback: CallbackFunc

      The callback to call when the data has been loaded

    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

sparqlUpdateParser

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

stackString

  • stackString(e: any): 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