Documentation

RdfXmlParser
in package
implements Parser, QuadIterator Uses TmpStreamParserTrait

Streaming RDF-XML parser. Fast and with low memory footprint.

Known deviations from the RDF-XML specification:

  • Doesn't resolve "/.." in relative IRIs.
  • Doesn't support rdf:Seq shorthand syntax
  • Doesn't support rdf:Collection shorthand syntax
Tags
author

zozlak

Interfaces, Classes, Traits and Enums

Parser
QuadIterator

Table of Contents

CHUNK_SIZE  = 1000000
PARSETYPE_COLLECTION  = 'Collection'
PARSETYPE_LITERAL  = 'Literal'
PARSETYPE_RESOURCE  = 'Resource'
RDF_ABOUT  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#about'
RDF_ABOUTEACH  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEach'
RDF_ABOUTEACHPREFIX  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEachPrefix'
RDF_COLLELPREFIX  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_'
RDF_DATATYPE  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype'
RDF_DESCRIPTION  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Description'
RDF_ID  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#ID'
RDF_LI  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#li'
RDF_NODEID  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID'
RDF_PARSETYPE  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#parseType'
RDF_RESOURCE  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#resource'
RDF_ROOT  = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF'
XML_BASE  = 'http://www.w3.org/XML/1998/namespacebase'
XML_LANG  = 'http://www.w3.org/XML/1998/namespacelang'
$baseUri  : string
$baseUriDefault  : string
$baseUriEmpty  : string
$dataFactory  : DataFactory
$elementIds  : array<string|int, mixed>
$input  : StreamInterface
$key  : int|null
$literalAttributes  : array<string|int, mixed>
$nmsp  : array<string|int, mixed>
$parser  : XmlParser
$skipAttributes  : array<string|int, mixed>
$stack  : array<string|int, mixed>
$state  : RdfXmlParserState
$tmpStream  : resource|null
$triples  : array<string|int, mixed>
__construct()  : mixed
__destruct()  : mixed
current()  : Quad
key()  : int|null
next()  : void
parse()  : QuadIterator
parseStream()  : QuadIterator
rewind()  : void
setBaseUri()  : void
valid()  : bool
addTriple()  : void
closeTmpStream()  : void
handleElementId()  : NamedNode
onCData()  : void
onElementEnd()  : void
onElementStart()  : void
onNamespaceEnd()  : void
onNamespaceStart()  : void
onNode()  : void
onPredicate()  : void
onRoot()  : void
onXmlLiteralElement()  : void
parseBaseUri()  : void
reportError()  : void
resolveIri()  : string
https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-ID-xml-base
shorten()  : string

Constants

PARSETYPE_COLLECTION

public mixed PARSETYPE_COLLECTION = 'Collection'

PARSETYPE_LITERAL

public mixed PARSETYPE_LITERAL = 'Literal'

PARSETYPE_RESOURCE

public mixed PARSETYPE_RESOURCE = 'Resource'

RDF_ABOUT

public mixed RDF_ABOUT = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#about'

RDF_ABOUTEACH

public mixed RDF_ABOUTEACH = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEach'

RDF_ABOUTEACHPREFIX

public mixed RDF_ABOUTEACHPREFIX = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEachPrefix'

RDF_COLLELPREFIX

public mixed RDF_COLLELPREFIX = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_'

RDF_DATATYPE

public mixed RDF_DATATYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype'

RDF_DESCRIPTION

public mixed RDF_DESCRIPTION = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Description'

RDF_ID

public mixed RDF_ID = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#ID'

RDF_LI

public mixed RDF_LI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#li'

RDF_NODEID

public mixed RDF_NODEID = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID'

RDF_PARSETYPE

public mixed RDF_PARSETYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#parseType'

RDF_RESOURCE

public mixed RDF_RESOURCE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#resource'

RDF_ROOT

public mixed RDF_ROOT = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF'

XML_BASE

public mixed XML_BASE = 'http://www.w3.org/XML/1998/namespacebase'

XML_LANG

public mixed XML_LANG = 'http://www.w3.org/XML/1998/namespacelang'

Properties

$elementIds

private array<string|int, mixed> $elementIds

$literalAttributes

private static array<string|int, mixed> $literalAttributes = [self::RDF_ID, self::RDF_DATATYPE, self::XML_LANG]

$skipAttributes

private static array<string|int, mixed> $skipAttributes = [self::RDF_ABOUT, self::RDF_ID, self::RDF_NODEID, self::RDF_RESOURCE, self::RDF_DATATYPE, self::RDF_PARSETYPE, self::XML_LANG]

Methods

__construct()

public __construct(DataFactory $dataFactory[, string $baseUri = '' ]) : mixed
Parameters
$dataFactory : DataFactory

factory to be used to generate RDF terms.

$baseUri : string = ''
Return values
mixed

__destruct()

public __destruct() : mixed
Return values
mixed

key()

public key() : int|null
Return values
int|null

setBaseUri()

public setBaseUri(string $baseUri) : void
Parameters
$baseUri : string
Return values
void

onCData()

private onCData(string $data) : void
Parameters
$data : string
Return values
void

onElementEnd()

private onElementEnd(string $name) : void
Parameters
$name : string
Return values
void

onElementStart()

private onElementStart(string $name, array<string, string> &$attribs) : void
Parameters
$name : string
$attribs : array<string, string>
Tags
throws
RdfIoException
Return values
void

onNamespaceEnd()

private onNamespaceEnd(XmlParser $parser, string $prefix) : void
Parameters
$parser : XmlParser
$prefix : string
Return values
void

onNamespaceStart()

private onNamespaceStart(XmlParser $parser, string $prefix, string $uri) : void
Parameters
$parser : XmlParser
$prefix : string
$uri : string
Return values
void

onNode()

private onNode(string $tag, array<string, string> &$attributes) : void
Parameters
$tag : string
$attributes : array<string, string>
Return values
void

onPredicate()

private onPredicate(string $tag, array<string, string> &$attributes) : void
Parameters
$tag : string
$attributes : array<string, string>
Return values
void

onRoot()

private onRoot(array<string, string> &$attributes) : void
Parameters
$attributes : array<string, string>
Return values
void

onXmlLiteralElement()

private onXmlLiteralElement(string $name, array<string, string> &$attributes) : void
Parameters
$name : string
$attributes : array<string, string>
Return values
void

parseBaseUri()

private parseBaseUri(string $baseUri) : void
Parameters
$baseUri : string
Return values
void

reportError()

private reportError() : void
Return values
void

resolveIri()

https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-ID-xml-base

private resolveIri(string $iri) : string
Parameters
$iri : string
Return values
string

shorten()

private shorten(string $uri) : string
Parameters
$uri : string
Return values
string

Search results