/** Non implemented method (only defined)
 
       @author Frederick Giasson, Structured Dynamics LLC.
   */
 public function pipeline_serialize_reification()
 {
     $rdf_reification = "";
     switch ($this->conneg->getMime()) {
         case "application/rdf+n3":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             $bnodeCounter = 0;
             foreach ($subjects as $subject) {
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $predicateType = $xml->getType($predicate, FALSE);
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $reifies = $xml->getReificationStatements($object);
                         $first = 0;
                         foreach ($reifies as $reify) {
                             if ($first == 0) {
                                 //                  $rdf_reification .= "_:bnode".$bnodeCounter." a rdf:Statement ;\n";
                                 $rdf_reification .= "_:" . md5($xml->getURI($subject) . $predicateType . $xml->getURI($object)) . " a rdf:Statement ;\n";
                                 $bnodeCounter++;
                                 $rdf_reification .= "    rdf:subject <" . $xml->getURI($subject) . "> ;\n";
                                 $rdf_reification .= "    rdf:predicate <" . $predicateType . "> ;\n";
                                 $rdf_reification .= "    rdf:object <" . $xml->getURI($object) . "> ;\n";
                             }
                             $first++;
                             $reifyingProperty = $xml->getType($reify, FALSE);
                             $rdf_reification .= "    <{$reifyingProperty}> \"" . $xml->getValue($reify) . "\" ;\n";
                         }
                         if ($first > 0) {
                             $bnodeCounter++;
                             $rdf_reification = substr($rdf_reification, 0, strlen($rdf_reification) - 2) . ".\n\n";
                         }
                     }
                 }
             }
             return $rdf_reification;
             break;
         case "application/rdf+xml":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             foreach ($subjects as $subject) {
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $predicateType = $xml->getType($predicate, FALSE);
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $reifies = $xml->getReificationStatements($object);
                         $first = 0;
                         foreach ($reifies as $reify) {
                             if ($first == 0) {
                                 //                  $rdf_reification .= "    <rdf:Statement>\n";
                                 $rdf_reification .= "    <rdf:Statement rdf:about=\"" . $this->xmlEncode(md5($xml->getURI($subject) . $predicateType . $xml->getURI($object))) . "\">\n";
                                 $rdf_reification .= "        <rdf:subject rdf:resource=\"" . $this->xmlEncode($xml->getURI($subject)) . "\" />\n";
                                 $rdf_reification .= "        <rdf:predicate rdf:resource=\"" . $this->xmlEncode($predicateType) . "\" />\n";
                                 $rdf_reification .= "        <rdf:object rdf:resource=\"" . $this->xmlEncode($xml->getURI($object)) . "\" />\n";
                             }
                             $first++;
                             $nsId = count($this->namespaces);
                             $reifyingProperty = $xml->getType($reify, FALSE);
                             $ns = $this->getNamespace($reifyingProperty);
                             $ptNs = $ns[0];
                             $ptExtension = $ns[1];
                             if (!isset($this->namespaces[$ptNs])) {
                                 // Make sure the ID is not already existing. Increase the counter if it is the case.
                                 while (array_search("ns" . $nsId, $this->namespaces) !== FALSE) {
                                     $nsId++;
                                 }
                                 $this->namespaces[$ptNs] = "ns" . $nsId;
                             }
                             $rdf_reification .= "        <" . $this->namespaces[$ptNs] . ":" . $ptExtension . ">" . $xml->getValue($reify) . "</" . $this->namespaces[$ptNs] . ":" . $ptExtension . ">\n";
                         }
                         if ($first > 0) {
                             $rdf_reification .= "    </rdf:Statement>  \n\n";
                         }
                     }
                 }
             }
             return $rdf_reification;
             break;
     }
 }
 /** Serialize the converted UCB Memorial Data content into different serialization formats
 
       @return returns the serialized content
     
       @author Frederick Giasson, Structured Dynamics LLC.
   */
 public function pipeline_serialize()
 {
     $rdf_part = "";
     switch ($this->conneg->getMime()) {
         case "application/x-bibtex":
             $bibtex = "";
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             $nbConvertedItems = 0;
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 // Check if the type of this subject is mappable to BibTeX
                 $subjectType = $this->get_uri_label($subjectType);
                 if (($bibType = array_search($subjectType, $this->bibTypes)) !== FALSE) {
                     $bibtex .= "@" . $bibType . "{" . $subjectURI . " \n";
                 } else {
                     // If the type is unknow as a bibtex type, then we continue and doesnt convert that subject.
                     continue;
                 }
                 // Check if the properties of this subject are mappable to BibTeX
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     $predicateType = $this->get_uri_label($xml->getType($predicate));
                     $bibPropertyType;
                     if (($bibPropertyType = array_search($predicateType, $this->bibProperties)) === FALSE) {
                         // If the predicate is unmappable, we skip it
                         continue;
                     }
                     $nbConvertedItems++;
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $bibtex .= " {$bibPropertyType} = \"{$objectValue}\",\n";
                         } else {
                             $objectLabel = $xml->getLabel($object);
                             if ($objectLabel == "") {
                                 $objectURI = $xml->getURI($object);
                                 $bibtex .= " {$bibPropertyType} = \"{$objectURI}\",\n";
                             } else {
                                 $bibtex .= " {$bibPropertyType} = \"{$objectLabel}\",\n";
                             }
                         }
                     }
                 }
                 $bibtex .= "}\n";
             }
             if ($nbConvertedItems == 0) {
                 $this->conneg->setStatus(400);
                 $this->conneg->setStatusMsg("Bad Request");
                 $this->conneg->setStatusMsgExt("No BibTex data converted");
                 return;
             }
             return $bibtex;
             break;
         case "application/rdf+n3":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 $rdf_part .= "\n    <{$subjectURI}> a {$subjectType} ;\n";
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         $predicateType = $xml->getType($predicate);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $rdf_part .= "        {$predicateType} \"\"\"" . str_replace(array("\\"), "\\\\", $objectValue) . "\"\"\" ;\n";
                         } else {
                             $objectURI = $xml->getURI($object);
                             $rdf_part .= "        {$predicateType} <{$objectURI}> ;\n";
                         }
                     }
                 }
                 if (strlen($rdf_part) > 0) {
                     $rdf_part = substr($rdf_part, 0, strlen($rdf_part) - 2) . ".\n";
                 }
             }
             return $rdf_part;
             break;
         case "application/rdf+xml":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 $rdf_part .= "\n    <{$subjectType} rdf:about=\"" . $this->xmlEncode($subjectURI) . "\">\n";
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         $predicateType = $xml->getType($predicate);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $rdf_part .= "        <{$predicateType}>" . $this->xmlEncode($objectValue) . "</{$predicateType}>\n";
                         } else {
                             $objectURI = $xml->getURI($object);
                             $rdf_part .= "        <{$predicateType} rdf:resource=\"" . $this->xmlEncode($objectURI) . "\" />\n";
                         }
                     }
                 }
                 $rdf_part .= "    </{$subjectType}>\n";
             }
             return $rdf_part;
             break;
     }
 }
 /** Serialize the converted UCB Memorial Data content into different serialization formats
 
       @return returns the serialized content
     
       @author Frederick Giasson, Structured Dynamics LLC.
   */
 public function pipeline_serialize()
 {
     $rdf_part = "";
     switch ($this->conneg->getMime()) {
         case "text/xml":
             return $this->pipeline_getResultset();
             break;
         case "application/rdf+n3":
             $dataset = $this->parser->getDataset();
             $datasetID = "";
             if (isset($dataset["&id"][0]["value"])) {
                 $datasetID = $dataset["&id"][0]["value"];
             }
             return $this->parser->getRdfN3($datasetID, $datasetID);
             break;
         case "application/iron+csv":
             $commON = "";
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             $commON .= "&&recordList\n";
             $prefixes = array();
             // Get the complete list of all the attributes used in this resultset.
             $attributes = array();
             foreach ($subjects as $subject) {
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $attributeURI = $xml->getType($predicate, FALSE);
                     if (!isset($attributes[$attributeURI])) {
                         $prefix = "";
                         $baseUri = "";
                         if (($pos = strripos($attributeURI, "#")) !== FALSE) {
                             $baseUri = substr($attributeURI, 0, $pos + 1);
                             if (isset($prefixes[$baseUri])) {
                                 $prefix = $prefixes[$baseUri];
                             } else {
                                 $prefix = "ns" . count($prefixes);
                             }
                         } elseif (($pos = strripos($attributeURI, "/")) !== FALSE) {
                             $baseUri = substr($attributeURI, 0, $pos + 1);
                             if (isset($prefixes[$baseUri])) {
                                 $prefix = $prefixes[$baseUri];
                             } else {
                                 $prefix = "ns" . count($prefixes);
                             }
                         }
                         if ($prefix != "" && $baseUri != "") {
                             $prefixes[$baseUri] = $prefix;
                             $attributes[$attributeURI] = str_replace($baseUri, $prefix . "_", $attributeURI);
                         } else {
                             $attributes[$attributeURI] = $attributeUri;
                         }
                     }
                 }
             }
             // Get the complete list of all the types used in this resultset.
             $types = array();
             foreach ($subjects as $subject) {
                 $typeURI = $xml->getType($subject, FALSE);
                 if ($typeURI == "http://rdfs.org/ns/void#Dataset") {
                     continue;
                 }
                 if (!isset($types[$typeURI])) {
                     $prefix = "";
                     $baseUri = "";
                     if (($pos = strripos($typeURI, "#")) !== FALSE) {
                         $baseUri = substr($typeURI, 0, $pos + 1);
                         if (isset($prefixes[$baseUri])) {
                             $prefix = $prefixes[$baseUri];
                         } else {
                             $prefix = "ns" . count($prefixes);
                         }
                     } elseif (($pos = strripos($typeURI, "/")) !== FALSE) {
                         $baseUri = substr($typeURI, 0, $pos + 1);
                         if (isset($prefixes[$baseUri])) {
                             $prefix = $prefixes[$baseUri];
                         } else {
                             $prefix = "ns" . count($prefixes);
                         }
                     }
                     if ($prefix != "" && $baseUri != "") {
                         $prefixes[$baseUri] = $prefix;
                         $types[$typeURI] = str_replace($baseUri, $prefix . "_", $typeURI);
                     } else {
                         $types[$typeURI] = $typeURI;
                     }
                 }
             }
             // Now create the complete list of attributes of this resultset
             $commON .= "&id,&type,";
             foreach ($attributes as $attributeURI => $attributePrefixed) {
                 $commON .= "&" . str_replace(':', '_', $attributePrefixed) . ",";
             }
             $commON = trim($commON, ",") . "\n";
             // Now populate the commON file with all the records
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectTypeURI = $xml->getType($subject, FALSE);
                 if ($subjectTypeURI == "http://rdfs.org/ns/void#Dataset") {
                     continue;
                 }
                 $commON .= $subjectURI . ",";
                 if (($pos = strripos($subjectTypeURI, "#")) !== FALSE) {
                     $baseUri = substr($subjectTypeURI, 0, $pos + 1);
                 } elseif (($pos = strripos($subjectTypeURI, "/")) !== FALSE) {
                     $baseUri = substr($subjectTypeURI, 0, $pos + 1);
                 }
                 $commON .= str_replace(":", "_", str_replace($baseUri, $prefixes[$baseUri] . ":", $subjectTypeURI)) . ",";
                 foreach ($attributes as $attributeURI => $attributePrefix) {
                     $values = $xml->getPredicatesByType($subject, $attributeURI);
                     if ($values->length > 0) {
                         $commON .= '"';
                         foreach ($values as $element) {
                             $objects = $xml->getObjects($element);
                             foreach ($objects as $object) {
                                 if ($xml->getURI($object) == "") {
                                     $objectValue = $xml->getContent($object);
                                     $commON .= $this->escapeCSV($objectValue) . '||';
                                 } else {
                                     $objectURI = $xml->getURI($object);
                                     $prefix = "";
                                     $baseUri = "";
                                     if (($pos = strripos($objectURI, "#")) !== FALSE) {
                                         $baseUri = substr($objectURI, 0, $pos + 1);
                                         if (isset($prefixes[$baseUri])) {
                                             $prefix = $prefixes[$baseUri];
                                         } else {
                                             $prefix = "ns" . count($prefixes);
                                         }
                                     } elseif (($pos = strripos($objectURI, "/")) !== FALSE) {
                                         $baseUri = substr($objectURI, 0, $pos + 1);
                                         if (isset($prefixes[$baseUri])) {
                                             $prefix = $prefixes[$baseUri];
                                         } else {
                                             $prefix = "ns" . count($prefixes);
                                         }
                                     }
                                     if ($prefix != "" && $baseUri != "") {
                                         $prefixes[$baseUri] = $prefix;
                                         $commON .= $this->escapeCSV("@@" . str_replace($baseUri, $prefix . ":", $objectURI)) . '||';
                                     } else {
                                         $commON .= $this->escapeCSV("@@" . $objectURI) . '||';
                                     }
                                 }
                             }
                         }
                         $commON = substr($commON, 0, strlen($commON) - 2);
                         $commON .= '",';
                     } else {
                         $commON .= ",";
                     }
                 }
                 $commON = trim($commON, ",") . "\n";
             }
             $commON .= "\n";
             $commON .= "&&linkage\n";
             $commON .= "&version,&linkageType\n";
             $commON .= "1,application/rdf+xml\n";
             $commON .= "\n";
             $commON .= "&prefixList,&mapTo\n";
             foreach ($prefixes as $baseUri => $prefix) {
                 $commON .= $prefix . "," . $baseUri . "\n";
             }
             $commON .= "\n";
             $commON .= "&attributeList,&mapTo\n";
             foreach ($attributes as $uri => $attr) {
                 $commON .= $attr . "," . $uri . "\n";
             }
             $commON .= "\n";
             $commON .= "&typeList,&mapTo\n";
             foreach ($types as $uri => $type) {
                 $commON .= $type . "," . $uri . "\n";
             }
             return $commON;
     }
 }
Пример #4
0
 /** Serialize the converted UCB Memorial Data content into different serialization formats
 
       @return returns the serialized content
     
       @author Frederick Giasson, Structured Dynamics LLC.
   */
 public function pipeline_serialize()
 {
     $rdf_part = "";
     switch ($this->conneg->getMime()) {
         case "text/tsv":
         case "text/csv":
             $tsv = "";
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 $tsv .= str_replace($this->delimiter, urlencode($this->delimiter), $subjectURI) . $this->delimiter . "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" . $this->delimiter . str_replace($this->delimiter, urlencode($this->delimiter), $subjectType) . "\n";
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         $predicateType = $xml->getType($predicate);
                         $objectContent = $xml->getContent($object);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $tsv .= str_replace($this->delimiter, urlencode($this->delimiter), $subjectURI) . $this->delimiter . str_replace($this->delimiter, urlencode($this->delimiter), $predicateType) . $this->delimiter . str_replace($this->delimiter, urlencode($this->delimiter), $objectValue) . "\n";
                         } else {
                             $objectURI = $xml->getURI($object);
                             $tsv .= str_replace($this->delimiter, urlencode($this->delimiter), $subjectURI) . $this->delimiter . str_replace($this->delimiter, urlencode($this->delimiter), $predicateType) . $this->delimiter . str_replace($this->delimiter, urlencode($this->delimiter), $objectURI) . "\n";
                         }
                     }
                 }
             }
             return $tsv;
             break;
         case "application/rdf+n3":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 $rdf_part .= "\n    <{$subjectURI}> a <{$subjectType}> ;\n";
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         $predicateType = $xml->getType($predicate);
                         $objectContent = $xml->getContent($object);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $rdf_part .= "        <{$predicateType}> \"\"\"" . str_replace(array("\\"), "\\\\", $objectValue) . "\"\"\" ;\n";
                         } else {
                             $objectURI = $xml->getURI($object);
                             $rdf_part .= "        <{$predicateType}> <{$objectURI}> ;\n";
                         }
                     }
                 }
                 if (strlen($rdf_part) > 0) {
                     $rdf_part = substr($rdf_part, 0, strlen($rdf_part) - 2) . ".\n";
                 }
             }
             return $rdf_part;
             break;
         case "application/rdf+xml":
             $xml = new ProcessorXML();
             $xml->loadXML($this->pipeline_getResultset());
             $subjects = $xml->getSubjects();
             $namespaces = array();
             $nsId = 0;
             foreach ($subjects as $subject) {
                 $subjectURI = $xml->getURI($subject);
                 $subjectType = $xml->getType($subject);
                 $ns = $this->getNamespace($subjectType);
                 $stNs = $ns[0];
                 $stExtension = $ns[1];
                 if (!isset($namespaces[$stNs])) {
                     // Make sure the ID is not already existing. Increase the counter if it is the case.
                     while (array_search("ns" . $nsId, $this->namespaces) !== FALSE) {
                         $nsId++;
                     }
                     $namespaces[$stNs] = "ns" . $nsId;
                     $nsId++;
                 }
                 $rdf_part .= "\n    <" . $namespaces[$stNs] . ":" . $stExtension . " rdf:about=\"" . $this->xmlEncode($subjectURI) . "\">\n";
                 $predicates = $xml->getPredicates($subject);
                 foreach ($predicates as $predicate) {
                     $objects = $xml->getObjects($predicate);
                     foreach ($objects as $object) {
                         $objectType = $xml->getType($object);
                         $predicateType = $xml->getType($predicate);
                         if ($objectType == "rdfs:Literal") {
                             $objectValue = $xml->getContent($object);
                             $ns = $this->getNamespace($predicateType);
                             $ptNs = $ns[0];
                             $ptExtension = $ns[1];
                             if (!isset($namespaces[$ptNs])) {
                                 // Make sure the ID is not already existing. Increase the counter if it is the case.
                                 while (array_search("ns" . $nsId, $this->namespaces) !== FALSE) {
                                     $nsId++;
                                 }
                                 $namespaces[$ptNs] = "ns" . $nsId;
                                 $nsId++;
                             }
                             $rdf_part .= "        <" . $namespaces[$ptNs] . ":" . $ptExtension . ">" . $this->xmlEncode($objectValue) . "</" . $namespaces[$ptNs] . ":" . $ptExtension . ">\n";
                         } else {
                             $objectURI = $xml->getURI($object);
                             $ns = $this->getNamespace($predicateType);
                             $ptNs = $ns[0];
                             $ptExtension = $ns[1];
                             if (!isset($namespaces[$ptNs])) {
                                 // Make sure the ID is not already existing. Increase the counter if it is the case.
                                 while (array_search("ns" . $nsId, $this->namespaces) !== FALSE) {
                                     $nsId++;
                                 }
                                 $namespaces[$ptNs] = "ns" . $nsId;
                                 $nsId++;
                             }
                             $rdf_part .= "        <" . $namespaces[$ptNs] . ":" . $ptExtension . " rdf:resource=\"" . $this->xmlEncode($objectURI) . "\" />\n";
                         }
                     }
                 }
                 $rdf_part .= "    </" . $namespaces[$stNs] . ":" . $stExtension . ">\n";
             }
             $rdf_header = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:wsf=\"http://purl.org/ontology/wsf#\"";
             foreach ($namespaces as $ns => $prefix) {
                 $rdf_header .= " xmlns:{$prefix}=\"{$ns}\"";
             }
             $rdf_header .= ">\n\n";
             $rdf_part = $rdf_header . $rdf_part;
             return $rdf_part;
             break;
     }
 }
Пример #5
0
 /** Create a Solr element to add to the index from a web service XML element (the XML representation of a RDF resource of the web services)
 
     @param $wsElement Web service element to convert
     
     @return returns an array of Solr document to index
   
     @todo "object_property" and "object_label" have to be added once everything is indexed.
   
     @author Frederick Giasson, Structured Dynamics LLC.
 */
 public function createSolrAddElementFromWSElement($wsElement)
 {
     $xml = new ProcessorXML();
     $xml->loadXML($wsElement);
     $subjects = $xml->getSubjects();
     $adds = array();
     include_once "ontologies/classHierarchySerialized.php";
     foreach ($subjects as $subject) {
         $types = array();
         $subjectURI = $xml->getURI($subject);
         $subjectType = @$xml->getType($subject);
         array_push($types, get_label_uri($subjectType));
         $add = "<add><doc><field name=\"uri\">" . get_label_uri($subjectURI) . "</field>";
         if ($subjectType != "") {
             $add .= "<field name=\"type\">" . get_label_uri($subjectType) . "</field>";
         }
         $predicates = $xml->getPredicates($subject);
         foreach ($predicates as $predicate) {
             $objects = $xml->getObjects($predicate);
             foreach ($objects as $object) {
                 @($objectType = $xml->getType($object));
                 $predicateType = $xml->getType($predicate);
                 if ($objectType == "rdfs:Literal") {
                     $objectValue = $xml->getContent($object);
                     $add .= "<field name=\"property\">" . get_label_uri($predicateType) . "</field>";
                     $add .= "<field name=\"text\">" . $this->xmlEncode($objectValue) . "</field>";
                 }
             }
         }
         // Get all types by inference
         foreach ($types as $type) {
             $superClasses = $classHierarchy->getSuperClasses($type);
             foreach ($superClasses as $sc) {
                 $add .= "<field name=\"inferred_type\">" . $this->xmlEncode($sc->name) . "</field>";
             }
         }
         $add .= "</doc></add>";
         array_push($adds, $add);
     }
     return $adds;
 }