Ejemplo n.º 1
0
 /**
  *
  * @param object Resource $resource
  * @access private
  */
 function collectNamespace($resource)
 {
     $namespace = RDF_Util::getNamespace($resource);
     if (!in_array($namespace, $this->m_namespaces)) {
         $prefix = array_search($namespace, $this->m_defaultNamespaces);
         if ($prefix === false) {
             $prefix = $this->getNextNamespacePrefix();
         }
         $this->m_namespaces[$prefix] = $namespace;
     }
 }
Ejemplo n.º 2
0
 /**
  * Write the RDF serialization of the Model_MDB as HTML table.
  *
  * @access public
  */
 function writeAsHtmlTable()
 {
     $Model_Memory =& $this->getMemModel();
     RDF_Util::writeHTMLTable($Model_Memory);
 }
Ejemplo n.º 3
0
 /**
  * Get Node Type.
  * Used by RDF_Util::writeHTMLTable()
  *
  * @param object Node   $node
  * @return object Resource
  * @access private
  */
 function getNodeTypeName($node)
 {
     if (is_a($node, 'RDF_BlankNode')) {
         return 'Blank Node: ';
     } elseif (is_a($node, 'RDF_Literal')) {
         return 'Literal: ';
     } else {
         if (RDF_Util::getNamespace($node) == RDF_NAMESPACE_URI || RDF_Util::getNamespace($node) == RDF_SCHEMA_URI) {
             return 'RDF Node: ';
         }
     }
     return 'Resource: ';
 }
Ejemplo n.º 4
0
 /**
  * Returns all tripels of a certain vocabulary.
  * $vocabulary is the namespace of the vocabulary inluding a # : / char at the end.
  * e.g. http://www.w3.org/2000/01/rdf-schema#
  * Returns an empty Model_Memory if nothing is found.
  *
  * @param string $vocabulary
  * @return object Model_Memory
  * @access public
  */
 function findVocabulary($vocabulary)
 {
     if ($this->size() == 0) {
         return $res;
     }
     if ($vocabulary == null || $vocabulary == "") {
         return $this;
     }
     $res =& new RDF_Model_Memory($this->getBaseURI());
     foreach ($this->triples as $value) {
         if (RDF_Util::getNamespace($value->getPredicate()) == $vocabulary) {
             $res->add($value);
         }
     }
     return $res;
 }