syntax
[ class tree: syntax ] [ index: syntax ] [ all elements ]

Class: RDF_N3_Parser

Source Location: /RDF_N3-0.2.0/RDF/N3/Parser.php

Class Overview

RDF_Object
   |
   --RDF_N3_Parser

PHP Notation3 Parser


Author(s):

  • Sean B. Palmer <sean at mysterylights.com>, Gunnar AA. Grimnes <ggrimnes at csd.abdn.ac.uk>, Daniel Westphal <mail at d-westphal.de>

Version:

  • V0.7

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 39]
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: V0.7
  • Access: public


[ Top ]


Class Variables

$bNode =

[line 44]


Type:   mixed


[ Top ]

$DAML_NS =

[line 45]


Type:   mixed


[ Top ]

$debug =

[line 46]


Type:   mixed


[ Top ]

$OWL_NS =

[line 45]


Type:   mixed


[ Top ]

$RDF_NS =

[line 45]


Type:   mixed


[ Top ]

$Tokens =

[line 43]


Type:   mixed


[ Top ]



Method Detail

RDF_N3_Parser (Constructor)   [line 54]

RDF_N3_Parser RDF_N3_Parser( )

  • Access: public

[ Top ]

applyStuff   [line 471]

$list applyStuff( array $prefixes, array $list)

Applies stuff :) Expands namespace prefixes etc.
  • Access: protected

Parameters:

array   $prefixes   — 
array   $list   — 

[ Top ]

array_concat   [line 314]

array array_concat( array $a, array $b)

Concatenates two arrays
  • Access: protected

Parameters:

array   $a   — 
array   $b   — 

[ Top ]

bnodeID   [line 787]

string bnodeID( )

Generates a new node id.
  • Access: protected

[ Top ]

doLists   [line 726]

array doLists( array $list, string $schar, string $echar)

Makes lists of elements in list into a seperate array element.

e.g. doLists(["a","b","[","c","]","d"], "[","]")=> ["a","b", ["c"], "d"]

  • Access: protected

Parameters:

array   $list   — 
string   $schar   — 
string   $echar   — 

[ Top ]

expandLists   [line 823]

array expandLists( array $list)

This makes [ ] lists into bnodes.
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

filterWs   [line 278]

void filterWs( array $list)

Removes all whitespace tokens from list
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

fixAnon   [line 800]

array fixAnon( array $list)

This makes bNodes out of variables like _:a etc.
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

generateModel   [line 212]

object Model_Memory &generateModel( $path $path)

Generate a new Model_Memory from an URI or file.
  • Throws: PhpError
  • Access: public

Parameters:

$path   $path   — 

[ Top ]

getObjs   [line 603]

array getObjs( array $list)

* Gets a list of triples with same predicate e.g. :Gunnar :likes "Cheese", "Wine".
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

getPovs   [line 579]

array getPovs( array $list)

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

Parameters:

array   $list   — 

[ Top ]

getPrefixes   [line 401]

array getPrefixes( array $list)

Returns an array with prefixes=>namespace mappings
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

getSpan   [line 295]

array getSpan( array $list, integer $start, integer $end)

Gets a slice of an array.

Returns the wanted slice, as well as the remainder of the array. e.g. getSpan(['p', 'q', 'r'], 1, 2) gives (['q'], ['p', 'r'])

  • Access: protected

Parameters:

array   $list   — 
integer   $start   — 
integer   $end   — 

[ Top ]

getStatements   [line 549]

array getStatements( array $list)

Returns an array of triples extracted from the list of n3 tokens
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

isWS   [line 235]

void isWS( string $s)

Returns FALSE if argument is a whitespace character
  • Access: protected

Parameters:

string   $s   — 

[ Top ]

listify   [line 379]

array listify( array $list, integer $start, integer $end)

Returns a list with the elements between start and end as one quoted string e.g. listify(["a","b","c","d"],1,2) => ["a","b c", "d"]
  • Access: protected

Parameters:

array   $list   — 
integer   $start   — 
integer   $end   — 

[ Top ]

listStuff   [line 772]

array listStuff( array $list)

Apply doLists for all different types of list.
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

n3tolist   [line 849]

array n3tolist( string $s)

Main work-horse function. This converts a N3 string to a list of statements
  • Access: protected

Parameters:

string   $s   — 

[ Top ]

notComment   [line 262]

boolean notComment( string $s)

Returns true if the string is not a comment
  • Access: protected

Parameters:

string   $s   — 

[ Top ]

parse   [line 113]

void parse( string $s)

This parses a N3 string and prints out the triples
  • Access: public

Parameters:

string   $s   — 

[ Top ]

parse2model   [line 180]

object Model parse2model( string $s)

This parses a N3 string and prints out the triples
  • Access: public

Parameters:

string   $s   — 

[ Top ]

posns   [line 328]

array posns( array $list, string $item)

Returns an array with all indexes where item appears in list
  • Access: protected

Parameters:

array   $list   — 
string   $item   — 

[ Top ]

replace_a_type   [line 429]

void replace_a_type( &$l, $p, string $l)

Callback function for replacing "a" elements with the right RDF uri.
  • Access: protected

Parameters:

string   $l   — 
   &$l   — 
   $p   — 

[ Top ]

replace_equal   [line 442]

void replace_equal( &$l, $p, string $l)

Callback function for replacing "=" elements with the right DAML+OIL uri.
  • Access: protected

Parameters:

string   $l   — 
   &$l   — 
   $p   — 

[ Top ]

replace_this   [line 455]

void replace_this( string $l, $p)

Callback function for replacing "this" elements with the right RDF uri.
  • Access: protected

Parameters:

string   $l   — 
   $p   — 

[ Top ]

setFixBnodes   [line 100]

void setFixBnodes( boolean $set)

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

Parameters:

boolean   $set   — 

[ Top ]

statementize   [line 651]

array statementize( array $list)

Does the real work, returns a list of subject, predicate, object triples.
  • Access: protected

Parameters:

array   $list   — 

[ Top ]

toke   [line 351]

array toke( string $s)

Returns a list of tokens
  • Access: protected

Parameters:

string   $s   — 

[ Top ]

toRDFNode   [line 912]

object RDFNode toRDFNode( string $s, $state)

Constructs a RAP RDFNode from URI/Literal/Bnode
  • Access: protected

Parameters:

string   $s   — 
   $state   — 

[ Top ]

trimLine   [line 250]

void trimLine( string &$l, $i)

Callback function for trimming whitespace from lines
  • Access: protected

Parameters:

string   &$l   — 
   $i   — 

[ Top ]

uparse   [line 146]

void uparse( string $s, string $func)

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

Parameters:

string   $s   — 
string   $func   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:51 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.