Class N3Parser

Description

PHP Notation3 Parser

This parser can parse a subset of n3, reporting triples to a callback function or constructing a RAP Model ( http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi )

Supported N3 features:

  • Standard things, repeated triples ( ; and , ), blank nodes using [ ], self-reference ('<>')
  • @prefix mappings
  • = maps to owl#sameAs
  • a maps to rdf-syntax-ns#type
  • Literal datytype- and xmlLanguageTag support
Un-supported N3 Features include:
  • Reification using { }
  • . and ^ operators for tree traversal
  • Any log operators, like log:forAll etc.

This parser is based on n3.py from Epp released 2nd March, 2002. by Sean B. Palmer ( http://infomesh.net/2002/eep/20020302-013802/n3.py )

This parser is released under the GNU GPL license. ( http://www.gnu.org/licenses/gpl.txt )

  • author: Sean B. Palmer <sean@mysterylights.com>, Gunnar AA. Grimnes <ggrimnes@csd.abdn.ac.uk>, Daniel Westphal <mail@d-westphal.de>
  • version: $Id: N3Parser.html 443 2007-06-01 16:25:38Z cax $
  • access: public

Located in /syntax/N3Parser.php (line 48)

Object
   |
   --N3Parser
Variable Summary
mixed $bNode
mixed $DAML_NS
mixed $debug
mixed $OWL_NS
mixed $parseError
mixed $RDF_NS
mixed $Tokens
Method Summary
N3Parser N3Parser ()
object MemModel &generateModel ($path $path, [ $dummy = false], [ $model = false])
array getPovs (array $list)
void parse (string $s)
object Model parse2model (string $s, [ $model = false])
void setFixBnodes (boolean $set)
void uparse (string $s, string $func)
Variables
mixed $bNode (line 54)
mixed $DAML_NS (line 55)
mixed $debug (line 56)
mixed $OWL_NS (line 55)
mixed $parsedNamespaces = array() (line 58)
mixed $parseError (line 57)
mixed $RDF_NS (line 55)
mixed $Tokens (line 53)
Methods
Constructor N3Parser (line 66)

Constructor

  • access: public
N3Parser N3Parser ()
generateModel (line 209)

Generate a new MemModel from an URI or file.

  • throws: PhpError
  • access: public
object MemModel &generateModel ($path $path, [ $dummy = false], [ $model = false])
  • $path $path
  • $dummy
  • $model
getPovs (line 646)

Gets a list of triples with same subject e.g. :Gunnar :firstname "Gunnar" ; :lastname "Grimnes.

array getPovs (array $list)
  • array $list
parse (line 119)

This parses a N3 string and prints out the triples

  • access: public
void parse (string $s)
  • string $s
parse2model (line 176)

This parses a N3 string and returns a memmodel

  • access: public
object Model parse2model (string $s, [ $model = false])
  • string $s
  • $model
setFixBnodes (line 108)

Sets, if BlankNode labels should be replaced by the generic label from the constants.php file

default is "false" -> the used label in n3 is parsed to the model

  • access: public
void setFixBnodes (boolean $set)
  • boolean $set
uparse (line 147)

This parses a N3 string and calls func($subject, $predicate, $object) with each trioke

  • access: public
void uparse (string $s, string $func)
  • string $s
  • string $func

Inherited Methods

Inherited From Object

Object::toString()

Documentation generated on Fri, 1 Jun 2007 16:49:59 +0200 by phpDocumentor 1.3.2