Class HV_ArrayToRDFCollection

Description

Generate RDF of array as a collection serialised in XML.

Called as a static class. Can be used for template generation in Mozilla platform. Example of use:

 include 'HV_ArrayToRDFCollection.php';

 $data = array();

 $level1[1]['year'] = array('field_id' => 1, 'field_name' => '1st Year');
 $level1[2]['year'] = array('field_id' => 2, 'field_name' => '2nd Year');

 $level2 = array();
 $level2[11]['quarter'] = array('field_id' => 11, 'field_name' => 'Y1 First Quarter');
 $level2[12]['quarter'] = array('field_id' => 12, 'field_name' => 'Y1 Second Quarter');
 $level2[13]['quarter'] = array('field_id' => 13, 'field_name' => 'Y1 Third Quarter');
 $level2[14]['quarter'] = array('field_id' => 14, 'field_name' => 'Y1 Fourth Quarter');

 $level3 = array();
 $level3[21]['quarter'] = array('field_id' => 21, 'field_name' => 'Y2 First Quarter');
 $level3[22]['quarter'] = array('field_id' => 22, 'field_name' => 'Y2 Second Quarter');
 $level3[23]['quarter'] = array('field_id' => 23, 'field_name' => 'Y2 Third Quarter');
 $level3[24]['quarter'] = array('field_id' => 24, 'field_name' => 'Y2 Fourth Quarter');

 $level1[1]['year']['_seq'] = $level2;
 $level1[2]['year']['_seq'] = $level3;

 $data2 = array();
 $data2[101]['amount']  = array('field_name' => 'Initial', 'field_amount' => '200');
 $data2[102]['amount']  = array('field_name' => 'Final',   'field_amount' => '210');

 $data3 = array();
 $data3[201]['amount']  = array('field_name' => 'Initial', 'field_amount' => '300');
 $data3[202]['amount']  = array('field_name' => 'Final',   'field_amount' => '410');

 $level2[11]['quarter']['_seq'] = $data2;
 $level3[22]['quarter']['_seq'] = $data3;

 $level1[1]['year']['_seq'] = $level2;
 $level1[2]['year']['_seq'] = $level3;

 $data['_seq'] = $level1;

 HV_ArrayToRDFCollection::output($data);

  • version: 1.0
  • author: Herman Veluwenkamp

Located in /HV_ArrayToRDFCollection.php (line 73)


	
			
Variable Summary
Method Summary
string generateRDF (string $data)
void output (string $data)
Variables
string $attributename_parseType = 'nc:parseType' (line 109)

Attribute name for indicating RDF parseType.

Should be in RDF namespace but Mozilla implementation of RDF is outdated.

  • static:
  • access: public
  • public:
string $key_container = '_seq' (line 116)

Key used to indicate a collection in the input array.

  • static:
  • access: public
  • public:
array $metadata = array() (line 130)

Array of metadata associated with incoming data array.

  • static:
  • access: public
  • public:
string $rdf_resource = '' (line 123)

Extra RDF to append to RDF model.

  • static:
  • access: public
  • public:
string $tag_collection = 'list' (line 101)

Tag to use in RDF as collection element.

  • static:
  • access: public
  • public:
string $uri_base = 'urn:record#' (line 87)

URI to use for data in RDF output.

  • static:
  • access: public
  • public:
string $uri_model = 'urn:record:' (line 80)

URI of RDF model.

  • static:
  • access: public
  • public:
string $uri_resource = 'urn:resource:' (line 94)

URI for extra RDF content attached to data with parseType of 'Resource'.

  • static:
  • access: public
  • public:
Methods
generateRDF (line 191)

Generates the wrapper around the RDF collection and inserts the generated RDF collection.

  • return: RDF serialised as XML
  • static:
  • access: public
string generateRDF (string $data)
  • string $data: Array to be processed.
output (line 217)

Generates and outputs the RDF including the HTTP content type header.

  • static:
  • access: public
void output (string $data)
  • string $data: Array to be processed.

Documentation generated on Wed, 16 Nov 2005 14:10:35 +1300 by phpDocumentor 1.3.0RC3