Example #1
0
 /** Work out the class to instantiate a resource as
  *  @ignore
  */
 protected function classForResource($uri)
 {
     $rdfType = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';
     if (isset($this->index[$uri][$rdfType])) {
         foreach ($this->index[$uri][$rdfType] as $type) {
             if ($type['type'] == 'uri' or $type['type'] == 'bnode') {
                 $class = TypeMapper::get($type['value']);
                 if ($class != null) {
                     return $class;
                 }
             }
         }
     }
     // Parsers don't typically add a rdf:type to rdf:List, so we have to
     // do a bit of 'inference' here using properties.
     if ($uri == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' or isset($this->index[$uri]['http://www.w3.org/1999/02/22-rdf-syntax-ns#first']) or isset($this->index[$uri]['http://www.w3.org/1999/02/22-rdf-syntax-ns#rest'])) {
         return 'EasyRdf\\Collection';
     }
     return TypeMapper::getDefaultResourceClass();
 }