You are here

function taxonomy_xml_rdf_get_statements_about in Taxonomy import/export via XML 6.2

Filter a big list of triples down to only the ones about one subject;

1 call to taxonomy_xml_rdf_get_statements_about()
taxonomy_xml_rdf_parse in ./rdf_format.inc
Read in RDF taxonomies and vocabularies. Create vocabs and terms as needed.

File

./rdf_format.inc, line 429
Include routines for RDF parsing and taxonomy/term creation. @author dman http://coders.co.nz

Code

function taxonomy_xml_rdf_get_statements_about($guid, $triples) {
  $filtered_statements = array();
  foreach ($triples as $triplenum => $statement) {
    @($subject_uri = $statement['s']['uri']);
    switch ($statement['s']['type']) {
      case 'uri':
        $subject_uri = $statement['s']['uri'];
        break;
      case 'bnode':
        $subject_uri = trim($statement['s']['bnode_id']);
        break;
      default:
        $subject_uri = trim($statement['s']['val']);
    }
    if ($subject_uri == $guid) {
      $filtered_statements[$triplenum] = $statement;
    }

    // else ignore
  }
  return $filtered_statements;
}