|
From: <cw...@us...> - 2007-08-12 17:42:34
|
Revision: 492
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=492&view=rev
Author: cweiske
Date: 2007-08-12 10:42:33 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
remove whitespace
Modified Paths:
--------------
trunk/rdfapi-php/api/syntax/RdfParser.php
Modified: trunk/rdfapi-php/api/syntax/RdfParser.php
===================================================================
--- trunk/rdfapi-php/api/syntax/RdfParser.php 2007-08-12 17:42:05 UTC (rev 491)
+++ trunk/rdfapi-php/api/syntax/RdfParser.php 2007-08-12 17:42:33 UTC (rev 492)
@@ -6,25 +6,25 @@
/**
- * An RDF paser.
+ * An RDF paser.
* This class reads RDF data from files or URIs and generates models out of it. All valid
- * RDF XML syntaxes defined by the W3C in RDF/XML Syntax Specification (Revised)
+ * RDF XML syntaxes defined by the W3C in RDF/XML Syntax Specification (Revised)
* - W3C Working Draft 10 October 2003
* (http://www.w3.org/TR/2003/WD-rdf-syntax-grammar-20031010/) are supported.
- * The parser is based on the PHP version of repat
- * (http://phpxmlclasses.sourceforge.net/show_doc.php?class=class_rdf_parser.html)
- * by Luis Argerich (lra...@ya...).
- *
+ * The parser is based on the PHP version of repat
+ * (http://phpxmlclasses.sourceforge.net/show_doc.php?class=class_rdf_parser.html)
+ * by Luis Argerich (lra...@ya...).
+ *
* @version $Id$
- * @author Luis Argerich <lra...@ya...>,
+ * @author Luis Argerich <lra...@ya...>,
* Chris Bizer <ch...@bi...>,
* Radoslaw Oldakowski <ra...@gm...>
* Daniel Westphal <ma...@d-...>
* @package syntax
* @access public
*
- */
-
+ */
+
class RdfParser extends Object {
var $rdf_parser;
@@ -35,9 +35,9 @@
/**
* converts a string to its unicode NFC form (e.g. \uHHHH or \UHHHHHHHH).
-*
+*
* @param String $str
-* @return String
+* @return String
* @access private
*
*/
@@ -122,8 +122,8 @@
/**
- * @access private
- */
+ * @access private
+ */
function _new_element()
{
$e['parent']=Array(); // Parent is a blank Array
@@ -142,7 +142,7 @@
$e['statement_id']='';
$e['datatype']='';
$e['element_base_uri'] = '';
-
+
return $e;
}
@@ -151,8 +151,8 @@
* @param string $source
* @param string &$destination
*
- * @access private
- */
+ * @access private
+ */
function _copy_element($source, &$destination )
{
if( $source )
@@ -160,14 +160,14 @@
$destination['parent'] = $source;
$destination['state'] = $source['state'];
$destination['xml_lang'] = $source['xml_lang'];
- $destination['element_base_uri'] = $source['element_base_uri'];
+ $destination['element_base_uri'] = $source['element_base_uri'];
}
}
/**
* @param string &$e
- * @access private
- */
+ * @access private
+ */
function _clear_element(&$e)
{
$e['subject']='';
@@ -211,8 +211,8 @@
}
/**
- * @access private
- */
+ * @access private
+ */
function _push_element()
{
if(!isset($this->rdf_parser['free'])) {
@@ -239,8 +239,8 @@
}
/**
- * @access private
- */
+ * @access private
+ */
function _pop_element()
{
$e = $this->rdf_parser['top'];
@@ -251,32 +251,32 @@
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_property_attribute_resource($local_name )
{
- return ( $local_name == RDF_TYPE );
+ return ( $local_name == RDF_TYPE );
}
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_property_attribute_literal($local_name )
{
- return ( $local_name == RDF_VALUE )
+ return ( $local_name == RDF_VALUE )
|| ( $local_name == RDF_BAG )
|| ( $local_name == RDF_SEQ )
|| ( $local_name == RDF_ALT )
|| ( $local_name == RDF_STATEMENT )
|| ( $local_name == RDF_PROPERTY )
- || ( $local_name == RDF_LIST );
+ || ( $local_name == RDF_LIST );
}
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_ordinal( $local_name )
{
$ordinal = -1;
@@ -291,8 +291,8 @@
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_property_attribute( $local_name )
{
return $this->_is_rdf_property_attribute_resource( $local_name )
@@ -303,11 +303,11 @@
{
return ( $local_name == RDF_RDF )
|| ( $local_name == RDF_DESCRIPTION)
- || ( $local_name == RDF_ID)
+ || ( $local_name == RDF_ID)
|| ( $local_name == RDF_ABOUT )
|| ( $local_name == RDF_BAG_ID )
|| ( $local_name == RDF_PARSE_TYPE )
- || ( $local_name == RDF_RESOURCE )
+ || ( $local_name == RDF_RESOURCE )
|| ( $local_name == RDF_NODEID )
|| ( $local_name == RDF_LI )
|| ( $local_name == RDF_ABOUT_EACH )
@@ -317,8 +317,8 @@
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_property_element( $local_name )
{
return ( $local_name == RDF_TYPE )
@@ -327,75 +327,75 @@
|| ( $local_name == RDF_OBJECT )
|| ( $local_name == RDF_VALUE )
|| ( $local_name == RDF_LI )
- || ( $local_name == RDF_SEEALSO )
+ || ( $local_name == RDF_SEEALSO )
|| ( $local_name == RDF_BAG )
|| ( $local_name == RDF_SEQ )
|| ( $local_name == RDF_ALT )
|| ( $local_name == RDF_STATEMENT )
|| ( $local_name == RDF_PROPERTY )
|| ( $local_name == RDF_LIST )
- || ( $local_name == RDF_FIRST )
+ || ( $local_name == RDF_FIRST )
|| ( $local_name == RDF_REST )
|| ( $local_name{0} == '_' );
}
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_forbidden_rdf_property_element ($local_name)
{
return ( $local_name == RDF_RDF )
|| ( $local_name == RDF_DESCRIPTION)
- || ( $local_name == RDF_ID)
+ || ( $local_name == RDF_ID)
|| ( $local_name == RDF_ABOUT )
|| ( $local_name == RDF_BAG_ID )
|| ( $local_name == RDF_PARSE_TYPE )
- || ( $local_name == RDF_RESOURCE )
+ || ( $local_name == RDF_RESOURCE )
|| ( $local_name == RDF_NODEID )
|| ( $local_name == RDF_ABOUT_EACH )
|| ( $local_name == RDF_ABOUT_EACH_PREFIX )
|| ( $local_name == RDF_DATATYPE );
}
-
+
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_rdf_node_element( $local_name )
{
- return ( $local_name == RDF_DESCRIPTION )
+ return ( $local_name == RDF_DESCRIPTION )
|| ( $local_name == RDF_STATEMENT )
|| ( $local_name == RDF_SUBJECT )
|| ( $local_name == RDF_PREDICATE )
- || ( $local_name == RDF_OBJECT )
+ || ( $local_name == RDF_OBJECT )
|| ( $local_name == RDF_PROPERTY )
|| ( $local_name == RDF_TYPE )
|| ( $local_name == RDF_VALUE )
|| ( $local_name == RDF_BAG )
|| ( $local_name == RDF_SEQ )
- || ( $local_name == RDF_ALT )
- || ( $local_name == RDF_SEEALSO )
+ || ( $local_name == RDF_ALT )
+ || ( $local_name == RDF_SEEALSO )
|| ( $local_name == RDF_LIST )
- || ( $local_name == RDF_FIRST )
- || ( $local_name == RDF_REST )
- || ( $local_name == RDF_NIL )
+ || ( $local_name == RDF_FIRST )
+ || ( $local_name == RDF_REST )
+ || ( $local_name == RDF_NIL )
|| ( $local_name{0} == '_' );
}
/**
* @param string $local_name
- * @access private
- */
+ * @access private
+ */
function _is_forbidden_rdf_node_element ($local_name)
{
return ( $local_name == RDF_RDF )
- || ( $local_name == RDF_ID)
+ || ( $local_name == RDF_ID)
|| ( $local_name == RDF_ABOUT )
|| ( $local_name == RDF_BAG_ID )
|| ( $local_name == RDF_PARSE_TYPE )
- || ( $local_name == RDF_RESOURCE )
+ || ( $local_name == RDF_RESOURCE )
|| ( $local_name == RDF_NODEID )
|| ( $local_name == RDF_LI )
|| ( $local_name == RDF_ABOUT_EACH )
@@ -405,23 +405,23 @@
/**
* @param string $val
- * @access private
- */
+ * @access private
+ */
function _istalnum($val) {
return ereg("[A-Za-z0-9]",$val);
}
/**
* @param string $val
- * @access private
- */
+ * @access private
+ */
function _istalpha($val) {
return ereg("[A-Za-z]",$val);
}
/**
* @param string $uri
- * @access private
- */
+ * @access private
+ */
function _is_absolute_uri($uri )
{
$result = false;
@@ -464,10 +464,10 @@
* @param string &$path
* @param string &$query
* @param string &$fragment
- * @access private
-*/
+ * @access private
+*/
function _parse_uri($uri,$buffer,&$scheme,&$authority,&$path,&$query,&$fragment ) {
-
+
$parsed=parse_url($uri);
if(isset($parsed['scheme'])) {
$scheme=$parsed['scheme'];
@@ -506,13 +506,13 @@
* @param string $base_uri
* @param string $reference_uri
* @param string &$buffer
- * @access private
-*/
+ * @access private
+*/
function _resolve_uri_reference($base_uri,$reference_uri,&$buffer )
{
if ($reference_uri == '')
return ($buffer = preg_replace("/\#[^\/\\\]*$/", '', $base_uri));
-
+
$base_buffer='';
$reference_buffer='';
$path_buffer='';
@@ -526,15 +526,15 @@
$reference_path,
$reference_query,
$reference_fragment );
-
+
$this->_parse_uri($base_uri,
$base_buffer,
$base_scheme,
$base_authority,
$base_path,
$base_query,
- $base_fragment );
-
+ $base_fragment );
+
if( $reference_scheme == ''
&& $reference_authority == ''
&& $reference_path == ''
@@ -542,22 +542,22 @@
{
$buffer=$base_uri;
- if( $reference_fragment != '' )
+ if( $reference_fragment != '' )
{
if ($base_path == '' || $base_path == '/' || $base_path == "\\") {
- $buffer = $this->rdf_parser['document_base_uri'];
+ $buffer = $this->rdf_parser['document_base_uri'];
}
- else
+ else
{
$buffer = preg_replace("/\#[^\/\\\]*$/", '', $base_uri);
}
-
+
// CB: Changed for base URI
$c = substr($buffer, strlen($buffer)-1 ,1);
if (!($c=='#' || $c==':' || $c=='/' || $c=="\\"))
$buffer.= '#' ;
- $buffer.=$reference_fragment;
-
+ $buffer.=$reference_fragment;
+
}
}
else if( $reference_scheme != '' )
@@ -565,18 +565,18 @@
$buffer=$reference_uri;
}
else
- {
+ {
$result_scheme = $base_scheme;
$result_path = '';
-
+
if( $reference_authority != '' )
{
- $result_authority = $reference_authority;
+ $result_authority = $reference_authority;
}
else
{
$result_authority = $base_authority;
-
+
if ($reference_path != '')
{
if ($reference_path{0} == '/' || $reference_path{0} == "\\")
@@ -584,7 +584,7 @@
if ($reference_path{1} == '/' || $reference_path{1} == "\\")
{
$result_authority = '';
- $result_path = $reference_path;
+ $result_path = $reference_path;
}
else
$result_path = $reference_path;
@@ -592,30 +592,30 @@
elseif (substr($reference_path, 0, 3) == '../' ||
substr($reference_path, 0, 3) == '..\\')
{
- $slash = $reference_path{2};
- while($base_path != '' && ( substr($reference_path, 0, 3) == '../'
+ $slash = $reference_path{2};
+ while($base_path != '' && ( substr($reference_path, 0, 3) == '../'
|| substr($reference_path, 0, 3) == '..\\'))
- {
- $base_path = preg_replace("/((\/)|(\\\))[^\/\\\]*$/", '', $base_path);
+ {
+ $base_path = preg_replace("/((\/)|(\\\))[^\/\\\]*$/", '', $base_path);
if ($base_path != '') {
- $base_path = preg_replace("/((\/)|(\\\))[^\/\\\]*$/", '', $base_path);
+ $base_path = preg_replace("/((\/)|(\\\))[^\/\\\]*$/", '', $base_path);
$reference_path = substr($reference_path, 3);
}
}
-
+
$result_path = $base_path .$slash .$reference_path;
}
- else
- {
+ else
+ {
if ($base_path)
$result_path = preg_replace("/[^\/\\\]*$/", $reference_path, $base_path, 1);
- else
- $result_path = '/' .$reference_path;
- }
+ else
+ $result_path = '/' .$reference_path;
+ }
}
-
+
}
-
+
if( $result_scheme != '' )
{
$buffer=$result_scheme;
@@ -644,26 +644,26 @@
$buffer.='#';
$buffer.=$reference_fragment;
}
- }
+ }
}
/**
- * IDs which contain CombiningChars or Extenders
+ * IDs which contain CombiningChars or Extenders
* (see http://www.w3.org/TR/REC-xml-names/#NT-NCName) are assumed to be invalid.
- * If you want to use IDs containing these characters you can turn off
+ * If you want to use IDs containing these characters you can turn off
* the validating by setting the constant VALIDATE_IDS to FALSE (see constants.php).
*
* @param string $id
- * @access private
-*/
+ * @access private
+*/
function is_valid_id($id )
{
if (!VALIDATE_IDS)
return TRUE;
-
+
$result = FALSE;
-
+
if( $id )
{
if( $this->_istalpha($id{0}) || $id{0} == '_')
@@ -678,23 +678,23 @@
|| $id{$i} == '-'
|| $id{$i} == '_'))
{
- $result = FALSE;
+ $result = FALSE;
}
}
}
}
-
+
if (!$result)
$this->_report_error('illegal ID, nodeID or bagID attribute value');
- else
+ else
return TRUE;
}
/**
* @param string $id
* @param string &$buffer
- * @access private
-*/
+ * @access private
+*/
function _resolve_id($id,&$buffer )
{
$id_buffer='';
@@ -705,7 +705,7 @@
}
$this->_resolve_uri_reference( $this->rdf_get_base(), $id_buffer, $buffer );
-
+
}
/**
@@ -713,8 +713,8 @@
* @param string &$buffer
* @param string &$namespace_uri
* @param string &$local_name
- * @access private
-*/
+ * @access private
+*/
function _split_name($name, &$buffer, &$namespace_uri, &$local_name )
{
static $nul = 0;
@@ -745,8 +745,8 @@
}
/**
* @param string &$buf
- * @access private
-*/
+ * @access private
+*/
function _generate_anonymous_uri(&$buf )
{
$id='';
@@ -759,7 +759,7 @@
}
/**
- * @param string $subject_type
+ * @param string $subject_type
* @param string $subject
* @param string $predicate
* @param string $ordinal
@@ -769,8 +769,8 @@
* @param string $bag_id
* @param string $statements
* @param string $statement_id
- * @access private
-*/
+ * @access private
+*/
function _report_statement( $subject_type, $subject, $predicate, $ordinal, $object_type, $object, $xml_lang, $bag_id, $statements, $statement_id, $datatype )
{
$statement_id_type = RDF_SUBJECT_TYPE_URI;
@@ -778,7 +778,7 @@
$predicate_buffer='';
if (!$xml_lang && $object_type == RDF_OBJECT_TYPE_LITERAL && isset($this->rdf_parser['document_xml_lang']))
$xml_lang = $this->rdf_parser['document_xml_lang'];
-
+
// call add statement
$this->add_statement_to_model($this->rdf_parser['user_data'],$subject_type,$subject,$predicate,$ordinal,$object_type,$object,$xml_lang, $datatype );
@@ -837,20 +837,20 @@
'',
'',
$datatype );
-
+
if ($subject_type == RDF_SUBJECT_TYPE_BNODE)
$obj_type = RDF_OBJECT_TYPE_BNODE;
- else
- $obj_type = RDF_OBJECT_TYPE_RESOURCE;
-
-
+ else
+ $obj_type = RDF_OBJECT_TYPE_RESOURCE;
+
+
// rdf:subject
$this->_report_statement(
$statement_id_type,
$statement_id,
RDF_NAMESPACE_URI.RDF_SUBJECT,
- 0,
- $obj_type,
+ 0,
+ $obj_type,
$subject,
'',
'',
@@ -894,8 +894,8 @@
* @param string $xml_lang
* @param string $bag_id
* @param string $statements
- * @access private
-*/
+ * @access private
+*/
function _handle_property_attributes($subject_type, $subject, $attributes, $xml_lang, $bag_id, $statements )
{
$i=0;
@@ -978,7 +978,7 @@
&& ($attribute_local_name != RDF_BAG_ID)
&& ($attribute_local_name != RDF_RESOURCE)
&& ($attribute_local_name != RDF_PARSE_TYPE)
- && ($attribute_local_name != RDF_PARSE_TYPE_LITERAL)
+ && ($attribute_local_name != RDF_PARSE_TYPE_LITERAL)
&& ($attribute_local_name != RDF_PARSE_TYPE_RESOURCE)
&& ($attribute_local_name != RDF_LI)
&& ($attribute_local_name != RDF_SUBJECT)
@@ -990,7 +990,7 @@
&& ($attribute_local_name != RDF_NIL)
&& ($attribute_local_name != RDF_REST)
&& ($attribute_local_name != RDF_FIRST)
- )
+ )
{
$this->_report_statement(
$subject_type,
@@ -1004,14 +1004,14 @@
$statements,
'',
'' );
- }
+ }
}
else if( XML_NAMESPACE_URI == $attribute_namespace_uri )
{
if ($attribute_local_name == 'base')
{
$this->rdf_parser['top']['element_base_uri'] = $attribute_value;
- }
+ }
}
else if( $attribute_namespace_uri )
{
@@ -1037,8 +1037,8 @@
/**
* @param string $warning
- * @access private
-*/
+ * @access private
+*/
function _report_warning($warning)
{
$errmsg = RDFAPI_ERROR . '(class: parser): ' . $warning .'.';
@@ -1049,7 +1049,7 @@
function _report_error($error)
{
$errmsg = RDFAPI_ERROR . '(class: parser): ' . $error .'.';
- trigger_error($errmsg, E_USER_ERROR);
+ trigger_error($errmsg, E_USER_ERROR);
}
@@ -1058,8 +1058,8 @@
* @param string $local_name
* @param string $attributes
* @param string $parent
- * @access private
-*/
+ * @access private
+*/
function _handle_resource_element( $namespace_uri, $local_name, $attributes, $parent )
{
$subjects_found = 0;
@@ -1092,18 +1092,18 @@
$this->rdf_parser['top']['has_property_attributes'] = false;
$this->rdf_parser['top']['has_member_attributes'] = false;
-
+
if( $namespace_uri == RDF_NAMESPACE_URI )
{
if( ! $this->_is_rdf_node_element( $local_name ) )
- {
- $msg = 'unknown or out of context rdf node element: '.$local_name;
-
+ {
+ $msg = 'unknown or out of context rdf node element: '.$local_name;
+
if ($this->_is_forbidden_rdf_node_element($local_name))
$this->_report_error($msg);
- else
- $this->_report_warning($msg);
- }
+ else
+ $this->_report_warning($msg);
+ }
}
// examine each attribute for the standard RDF "keywords"
@@ -1127,14 +1127,14 @@
$id = $attribute_value;
++$subjects_found;
} else if( $attribute_local_name == RDF_ABOUT ) {
- $about = '_'.$attribute_value;
+ $about = '_'.$attribute_value;
++$subjects_found;
} else if( $attribute_local_name == RDF_NODEID) {
$node_id = $attribute_value;
++$subjects_found;
} else if( $attribute_local_name == RDF_ABOUT_EACH ) {
$error = 'aboutEach has been removed from the RDF specifications';
- $this->_report_error($error);
+ $this->_report_error($error);
} else if( $attribute_local_name == RDF_ABOUT_EACH_PREFIX ) {
$error = 'aboutEachPrefix has been removed from the RDF specifications';
$this->_report_error($error);
@@ -1149,12 +1149,12 @@
$this->rdf_parser['top']['has_member_attributes'] = true;
} else {
$this->rdf_parser['top']['has_property_attributes'] = true;
- $msg = 'unknown or out of context rdf attribute: '.$attribute_local_name;
-
+ $msg = 'unknown or out of context rdf attribute: '.$attribute_local_name;
+
if ($this->_is_forbidden_rdf_property_attribute($attribute_local_name))
$this->_report_error($msg);
- else
- $this->_report_warning($msg);
+ else
+ $this->_report_warning($msg);
}
}
else if( $attribute_namespace_uri == XML_NAMESPACE_URI )
@@ -1166,7 +1166,7 @@
elseif ($attribute_local_name == 'base')
{
$this->rdf_parser['top']['element_base_uri'] = $attribute_value;
- }
+ }
}
else if( $attribute_namespace_uri )
{
@@ -1183,7 +1183,7 @@
}
else if( $subjects_found > 1 )
{
- $this->_report_error('ID, about and nodeID are mutually exclusive');
+ $this->_report_error('ID, about and nodeID are mutually exclusive');
}
else if( $id )
{
@@ -1192,22 +1192,22 @@
$this->rdf_parser['top']['subject']=$id_buffer;
}
else if( $about )
- {
- $this->_resolve_uri_reference( $this->rdf_get_base(), substr($about,1), $id_buffer );
+ {
+ $this->_resolve_uri_reference( $this->rdf_get_base(), substr($about,1), $id_buffer );
$this->rdf_parser['top']['subject_type'] = RDF_SUBJECT_TYPE_URI;
$this->rdf_parser['top']['subject']=$id_buffer;
- }
+ }
else if( $node_id )
{
$this->is_valid_id($node_id);
$this->rdf_parser['top']['subject_type'] = RDF_SUBJECT_TYPE_BNODE;
$this->rdf_parser['top']['subject']=$node_id;
}
-
+
// if the subject is empty, assign it the document uri
if( $this->rdf_parser['top']['subject'] == '' )
{
- $this->rdf_parser['top']['subject']=$this->rdf_get_base();
+ $this->rdf_parser['top']['subject']=$this->rdf_get_base();
}
if( $bag_id )
@@ -1233,7 +1233,7 @@
'',
$this->rdf_parser['top']['bag_id'],
$this->rdf_parser['top']['statements'],
- '',
+ '',
$datatype);
}
@@ -1243,10 +1243,10 @@
if( $parent )
{
if ($this->rdf_parser['top']['subject_type'] == RDF_SUBJECT_TYPE_BNODE)
- $objtype = RDF_OBJECT_TYPE_BNODE;
+ $objtype = RDF_OBJECT_TYPE_BNODE;
else
- $objtype = RDF_OBJECT_TYPE_RESOURCE;
-
+ $objtype = RDF_OBJECT_TYPE_RESOURCE;
+
$this->_report_statement(
$parent['parent']['subject_type'],
$parent['parent']['subject'],
@@ -1257,7 +1257,7 @@
'',
$parent['parent']['bag_id'],
$parent['parent']['statements'],
- $parent['statement_id'],
+ $parent['statement_id'],
$parent['datatype']);
}
@@ -1278,8 +1278,8 @@
* @param string &$namespace_uri
* @param string &$local_name
* @param string &$attributes
- * @access private
-*/
+ * @access private
+*/
function _handle_property_element( &$namespace_uri, &$local_name, &$attributes )
{
$buffer='';
@@ -1303,7 +1303,7 @@
$bag_id = '';
$parse_type = '';
$node_id = '';
- $datatype = '';
+ $datatype = '';
$this->rdf_parser['top']['ordinal'] = 0;
@@ -1311,14 +1311,14 @@
{
if( ! $this->_is_rdf_property_element( $local_name ) )
{
- $msg = 'unknown or out of context rdf property element: '.$local_name;
-
+ $msg = 'unknown or out of context rdf property element: '.$local_name;
+
if ($this->_is_forbidden_rdf_property_element($local_name))
$this->_report_error($msg);
- else
+ else
$this->_report_warning($msg);
}
-
+
}
$buffer=$namespace_uri;
@@ -1332,7 +1332,7 @@
$this->rdf_parser['top']['ordinal']=$this->rdf_parser['top']['ordinal'];
$buffer.='_'.$this->rdf_parser['top']['ordinal'];
-
+
}
else
{
@@ -1344,7 +1344,7 @@
$this->rdf_parser['top']['has_property_attributes'] = false;
$this->rdf_parser['top']['has_member_attributes'] = false;
-
+
for( $i = 0; isset($attributes[$i]); $i += 2 )
{
$this->_split_name(
@@ -1362,19 +1362,19 @@
{
if( ( $attribute_local_name == RDF_ID ) )
{
- $statement_id = $attribute_value;
+ $statement_id = $attribute_value;
}
else if( $attribute_local_name == RDF_PARSE_TYPE )
- {
+ {
$parse_type = $attribute_value;
}
else if( $attribute_local_name == RDF_RESOURCE )
{
- $resource = $attribute_value;
+ $resource = $attribute_value;
}
else if( $attribute_local_name == RDF_NODEID )
- {
- $node_id = $attribute_value;
+ {
+ $node_id = $attribute_value;
}
else if( $attribute_local_name == RDF_BAG_ID )
{
@@ -1393,7 +1393,7 @@
{
$this->_report_warning('unknown rdf attribute: '.$attribute_local_name );
return;
- }
+ }
}
else if( $attribute_namespace_uri == XML_NAMESPACE_URI )
{
@@ -1404,29 +1404,29 @@
elseif ($attribute_local_name == 'base')
{
$this->rdf_parser['top']['element_base_uri'] = $attribute_value;
- }
+ }
}
else if( $attribute_namespace_uri )
{
$this->rdf_parser['top']['has_property_attributes'] = true;
}
- }
+ }
if( $statement_id )
{
$this->_resolve_id($statement_id, $buffer );
$this->rdf_parser['top']['statement_id']=$buffer;
}
-
+
if ($node_id)
{
$this->is_valid_id($node_id);
-
+
if ($resource)
{
$this->_report_error('nodeID and resource are mutually exclusive');
- }
- if ($statement_id)
+ }
+ if ($statement_id)
{
// reify statement
$this->_report_statement(
@@ -1434,17 +1434,17 @@
$this->rdf_parser['top']['parent']['subject'],
$this->rdf_parser['top']['predicate'],
$this->rdf_parser['top']['ordinal'],
- RDF_OBJECT_TYPE_BNODE,
- $node_id,
+ RDF_OBJECT_TYPE_BNODE,
+ $node_id,
'',
$this->rdf_parser['top']['parent']['bag_id'],
$this->rdf_parser['top']['parent']['statements'],
- $this->rdf_parser['top']['statement_id'],
- '');
- $statement_id = '';
- }
- else
- {
+ $this->rdf_parser['top']['statement_id'],
+ '');
+ $statement_id = '';
+ }
+ else
+ {
$this->_report_statement(
$this->rdf_parser['top']['parent']['subject_type'],
$this->rdf_parser['top']['parent']['subject'],
@@ -1456,12 +1456,12 @@
$this->rdf_parser['top']['parent']['bag_id'],
$this->rdf_parser['top']['parent']['statements'],
'',
- $datatype );
- }
-
- $this->rdf_parser['top']['state'] = IN_PROPERTY_EMPTY_RESOURCE;
+ $datatype );
+ }
+
+ $this->rdf_parser['top']['state'] = IN_PROPERTY_EMPTY_RESOURCE;
}
-
+
if( $parse_type )
{
if( $resource ) {
@@ -1478,7 +1478,7 @@
$this->_report_error('property elements with rdf:parseType do not allow property attributes');
return;
}
-
+
if( $attribute_value == RDF_PARSE_TYPE_RESOURCE )
{
$this->_generate_anonymous_uri( $buffer );
@@ -1503,18 +1503,18 @@
$this->rdf_parser['top']['subject']=$buffer;
$this->rdf_parser['top']['bag_id']='';
$this->rdf_parser['top']['datatype']= $datatype;
-
- }
+
+ }
elseif ( $attribute_value == RDF_PARSE_TYPE_LITERAL )
{
$this->rdf_parser['top']['state'] = IN_PROPERTY_PARSE_TYPE_LITERAL;
$this->rdf_parser['top']['datatype']= RDF_NAMESPACE_URI .RDF_XMLLITERAL;
- $this->rdf_parser['xml_literal']['buffer'] = '';
- $this->rdf_parser['xml_literal']['depth'] = 0;
+ $this->rdf_parser['xml_literal']['buffer'] = '';
+ $this->rdf_parser['xml_literal']['depth'] = 0;
}
- elseif ($attribute_value == RDF_PARSE_TYPE_COLLECTION)
+ elseif ($attribute_value == RDF_PARSE_TYPE_COLLECTION)
{
- $this->_generate_anonymous_uri( $buffer );
+ $this->_generate_anonymous_uri( $buffer );
$this->_report_statement(
$this->rdf_parser['top']['parent']['subject_type'],
$this->rdf_parser['top']['parent']['subject'],
@@ -1527,14 +1527,14...
[truncated message content] |
|
From: <cw...@us...> - 2007-08-12 17:43:12
|
Revision: 493
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=493&view=rev
Author: cweiske
Date: 2007-08-12 10:43:07 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
remove debug output
Modified Paths:
--------------
trunk/rdfapi-php/api/syntax/RdfParser.php
Modified: trunk/rdfapi-php/api/syntax/RdfParser.php
===================================================================
--- trunk/rdfapi-php/api/syntax/RdfParser.php 2007-08-12 17:42:33 UTC (rev 492)
+++ trunk/rdfapi-php/api/syntax/RdfParser.php 2007-08-12 17:43:07 UTC (rev 493)
@@ -2207,7 +2207,7 @@
// $base is URL or filename
$this->model = $model?$model:new MemModel($base);
-echo $base;
+
$input = fopen($base,'r') or die("RDF Parser: Could not open File: $base. Stopped parsing.");
$this->rdf_parser_create( NULL );
$this->rdf_set_base($base);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|