public function processInterface() { // Make sure there was no conneg error prior to this process call if ($this->ws->conneg->getStatus() == 200) { // Starts the OWLAPI process/bridge require_once $this->ws->owlapiBridgeURI; // Create the OWLAPI session object that could have been persisted on the OWLAPI instance. // Second param "false" => we re-use the pre-created session without destroying the previous one // third param "0" => it nevers timeout. if ($this->ws->OwlApiSession == null) { $this->ws->OwlApiSession = java_session("OWLAPI", false, 0); } $ontology; try { $ontology = new OWLOntology($this->ws->ontologyUri, $this->ws->OwlApiSession, TRUE); $ontology->setLanguage($this->ws->lang); if (strtolower($this->ws->owlapiReasoner) == "pellet") { $ontology->usePelletReasoner(); } elseif (strtolower($this->ws->owlapiReasoner) == "hermit") { $ontology->useHermitReasoner(); } elseif (strtolower($this->ws->owlapiReasoner) == "factpp") { $ontology->useFactppReasoner(); } } catch (Exception $e) { if (strtolower($this->ws->function) != "getserializedclasshierarchy" && strtolower($this->ws->function) != "getserializedpropertyhierarchy" && strtolower($this->ws->function) != "getironxmlschema" && strtolower($this->ws->function) != "getironjsonschema" && strtolower($this->ws->function) != "getloadedontologies") { $this->returnError(400, "Bad Request", "_300"); return; } } if (isset($ontology)) { if ($this->ws->useReasoner) { $ontology->useReasoner(); } else { $ontology->stopUsingReasoner(); } } if (isset($this->ws->parameters["direct"]) && $this->ws->parameters["direct"] != "") { $this->ws->parameters["direct"] = strtolower($this->ws->parameters["direct"]); if ($this->ws->parameters["direct"] == "false" || $this->ws->parameters["direct"] == "0" || $this->ws->parameters["direct"] == "off") { $this->ws->parameters["direct"] = false; } else { $this->ws->parameters["direct"] = true; } } switch (strtolower($this->ws->function)) { case "getserialized": $this->ws->conneg->setStatus(200); $this->ws->conneg->setStatusMsg("OK"); $this->ws->getSerialized = $ontology->getSerialization(); return; break; case "getclass": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } $class = $ontology->_getClass($this->ws->parameters["uri"]); if ($class == null) { $this->returnError(400, "Bad Request", "_205"); } else { $subject = new Subject($this->ws->parameters["uri"]); $subject->setSubject($ontology->_getClassDescription($class)); $this->ws->rset->addSubject($subject); } break; case "getclasses": $limit = -1; $offset = 0; if (isset($this->ws->parameters["limit"])) { $limit = $this->ws->parameters["limit"]; } if (isset($this->ws->parameters["offset"])) { $offset = $this->ws->parameters["offset"]; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $classes = $ontology->getClassesUri($limit, $offset); foreach ($classes as $class) { $subject = new Subject($class); $subject->setType("owl:Class"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getClassesDescription($limit, $offset))); break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getnamedindividual": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } $namedIndividual = $ontology->_getNamedIndividual($this->ws->parameters["uri"]); if ($namedIndividual == null) { $this->returnError(400, "Bad Request", "_206"); } else { $subject = new Subject($this->ws->parameters["uri"]); $subject->setSubject($ontology->_getNamedIndividualDescription($namedIndividual)); $this->ws->rset->addSubject($subject); } break; case "getnamedindividuals": $limit = -1; $offset = 0; $direct = true; if (isset($this->ws->parameters["limit"])) { $limit = $this->ws->parameters["limit"]; } if (isset($this->ws->parameters["offset"])) { $offset = $this->ws->parameters["offset"]; } if (isset($this->ws->parameters["direct"])) { switch ($this->ws->parameters["direct"]) { case "0": $direct = false; break; case "1": $direct = true; break; } } $classUri = "all"; if (!isset($this->ws->parameters["classuri"])) { $classUri = $this->ws->parameters["classuri"]; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $namedindividuals = $ontology->getNamedIndividualsUri($classUri, $direct, $limit, $offset); foreach ($namedindividuals as $ni) { $subject = new Subject($ni); $subject->setType("owl:NamedIndividual"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getNamedIndividualsDescription($classUri, $direct, $limit, $offset))); break; case "list": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getNamedIndividualsDescription($classUri, $direct, $limit, $offset, TRUE))); break; default: $this->returnError(400, "Bad Request", "_201", "Mode provided: " . $this->ws->parameters["mode"]); return; break; } break; case "getsubclasses": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $classes = $ontology->getSubClassesUri($this->ws->parameters["uri"], $this->ws->parameters["direct"]); foreach ($classes as $class) { $subject = new Subject($class); $subject->setType("owl:Class"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSubClassesDescription($this->ws->parameters["uri"], $this->ws->parameters["direct"]))); break; case "hierarchy": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSubClassesDescription($this->ws->parameters["uri"], TRUE, TRUE))); break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getsuperclasses": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $classes = $ontology->getSuperClassesUri($this->ws->parameters["uri"], $this->ws->parameters["direct"]); foreach ($classes as $class) { $subject = new Subject($class); $subject->setType("owl:Class"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSuperClassesDescription($this->ws->parameters["uri"], $this->ws->parameters["direct"]))); break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getequivalentclasses": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $classes = $ontology->getEquivalentClassesUri($this->ws->parameters["uri"]); foreach ($classes as $class) { $subject = new Subject($class); $subject->setType("owl:Class"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getEquivalentClassesDescription($this->ws->parameters["uri"]))); break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getdisjointclasses": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": $classes = $ontology->getDisjointClassesUri($this->ws->parameters["uri"]); foreach ($classes as $class) { $subject = new Subject($class); $subject->setType("owl:Class"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getDisjointClassesDescription($this->ws->parameters["uri"]))); break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getontologies": switch (strtolower($this->ws->parameters["mode"])) { case "uris": $ontologies = $ontology->getOntologiesUri(); foreach ($ontologies as $ontology) { $subject = new Subject($ontology); $subject->setType("owl:Ontology"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getloadedontologies": switch (strtolower($this->ws->parameters["mode"])) { case "uris": $ontologies = OWLOntology::getLoadedOntologiesUri($this->ws->OwlApiSession); foreach ($ontologies as $ontology) { $subject = new Subject($ontology); $subject->setType("owl:Ontology"); $this->ws->rset->addSubject($subject); } break; case "descriptions": $this->ws->rset->setResultset(array($this->ws->ontologyUri => OWLOntology::getLoadedOntologiesDescription($this->ws->OwlApiSession))); break; default: $this->ws->conneg->setStatus(400); $this->ws->conneg->setStatusMsg("Bad Request"); $this->ws->conneg->setStatusMsgExt($this->ws->errorMessenger->_201->name); $this->ws->conneg->setError($this->ws->errorMessenger->_201->id, $this->ws->errorMessenger->ws, $this->ws->errorMessenger->_201->name, $this->ws->errorMessenger->_201->description, "", $this->ws->errorMessenger->_201->level); return; break; } break; case "getserializedclasshierarchy": $sch = $this->generationSerializedClassHierarchy($this->ws->OwlApiSession); $subject = new Subject($this->ws->ontologyUri); $subject->setType("owl:Ontology"); $subject->setDataAttribute(Namespaces::$wsf . "serializedClassHierarchy", $sch); $this->ws->rset->addSubject($subject); break; case "getserializedpropertyhierarchy": $sch = $this->generationSerializedPropertyHierarchy($this->ws->OwlApiSession); $subject = new Subject($this->ws->ontologyUri); $subject->setType("owl:Ontology"); $subject->setDataAttribute(Namespaces::$wsf . "serializedPropertyHierarchy", $sch); $this->ws->rset->addSubject($subject); break; case "getironxmlschema": $subjectTriples = $ontology->getClassesDescription($limit, $offset); $schema = '<schema><version>0.1</version><typeList>'; $prefixes = array(); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= "<" . $this->ironPrefixize($uri, $prefixes) . ">"; $schema .= "<description>" . $this->ws->xmlEncode($this->getDescription($subject)) . "</description>"; $schema .= "<prefLabel>" . $this->ws->xmlEncode($this->getLabel($uri, $subject)) . "</prefLabel>"; foreach ($subject as $predicate => $values) { foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "subClassOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<subTypeOf>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</subTypeOf>"; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= "<displayControl>" . $this->ws->xmlEncode($displayControl) . "</displayControl>"; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= "<ignoredBy>" . $this->ws->xmlEncode($ignoredBy) . "</ignoredBy>"; break; case Namespaces::$sco . "shortLabel": $schema .= "<shortLabel>" . $this->ws->xmlEncode($value["value"]) . "</shortLabel>"; break; case Namespaces::$sco . "mapMarkerImageUrl": $schema .= "<mapMarkerImageUrl>" . $this->ws->xmlEncode($value["value"]) . "</mapMarkerImageUrl>"; break; case Namespaces::$sco . "relationBrowserNodeType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<relationBrowserNodeType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</relationBrowserNodeType>"; break; } } } $schema .= "</" . $this->ironPrefixize($uri, $prefixes) . ">"; } $schema .= "</typeList>"; $schema .= "<attributeList>"; $subjectTriples = $ontology->getPropertiesDescription(TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= "<" . $this->ironPrefixize($uri, $prefixes) . ">"; $schema .= "<description>" . $this->ws->xmlEncode($this->getDescription($subject)) . "</description>"; $schema .= "<prefLabel>" . $this->ws->xmlEncode($this->getLabel($uri, $subject)) . "</prefLabel>"; $schema .= "<type>" . Namespaces::$owl . "DatatypeProperty</type>"; foreach ($subject as $predicate => $values) { foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</allowedType>"; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedValue><type>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</type></allowedValue>"; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= "<displayControl>" . $this->ws->xmlEncode($displayControl) . "</displayControl>"; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= "<ignoredBy>" . $this->ws->xmlEncode($ignoredBy) . "</ignoredBy>"; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<comparableWith>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</comparableWith>"; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<unitType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</unitType>"; break; case Namespaces::$sco . "shortLabel": $schema .= "<shortLabel>" . $this->ws->xmlEncode($value["value"]) . "</shortLabel>"; break; case Namespaces::$sco . "minCardinality": $schema .= "<minCardinality>" . $this->ws->xmlEncode($value["value"]) . "</minCardinality>"; break; case Namespaces::$sco . "maxCardinality": $schema .= "<maxCardinality>" . $this->ws->xmlEncode($value["value"]) . "</maxCardinality>"; break; case Namespaces::$sco . "cardinality": $schema .= "<cardinality>" . $this->ws->xmlEncode($value["value"]) . "</cardinality>"; break; case Namespaces::$sco . "orderingValue": $schema .= "<orderingValue>" . $this->ws->xmlEncode($value["value"]) . "</orderingValue>"; break; case Namespaces::$rdfs . "subPropertyOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<subPropertyOf>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</subPropertyOf>"; break; case Namespaces::$iron . "allowedValue": $schema .= "<allowedValue><primitive>" . $this->ws->xmlEncode($value["value"]) . "</primitive></allowedValue>"; break; } } } $schema .= "</" . $this->ironPrefixize($uri, $prefixes) . ">"; } $subjectTriples = $ontology->getPropertiesDescription(FALSE, FALSE, TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= "<" . $this->ironPrefixize($uri, $prefixes) . ">"; $schema .= "<description>" . $this->ws->xmlEncode($this->getDescription($subject)) . "</description>"; $schema .= "<prefLabel>" . $this->ws->xmlEncode($this->getLabel($uri, $subject)) . "</prefLabel>"; $schema .= "<type>" . Namespaces::$owl . "AnnotationProperty</type>"; foreach ($subject as $predicate => $values) { foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</allowedType>"; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedValue><type>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</type></allowedValue>"; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= "<displayControl>" . $this->ws->xmlEncode($displayControl) . "</displayControl>"; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= "<ignoredBy>" . $this->ws->xmlEncode($ignoredBy) . "</ignoredBy>"; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<comparableWith>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</comparableWith>"; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<unitType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</unitType>"; break; case Namespaces::$sco . "shortLabel": $schema .= "<shortLabel>" . $this->ws->xmlEncode($value["value"]) . "</shortLabel>"; break; case Namespaces::$sco . "minCardinality": $schema .= "<minCardinality>" . $this->ws->xmlEncode($value["value"]) . "</minCardinality>"; break; case Namespaces::$sco . "maxCardinality": $schema .= "<maxCardinality>" . $this->ws->xmlEncode($value["value"]) . "</maxCardinality>"; break; case Namespaces::$sco . "cardinality": $schema .= "<cardinality>" . $this->ws->xmlEncode($value["value"]) . "</cardinality>"; break; case Namespaces::$sco . "orderingValue": $schema .= "<orderingValue>" . $this->ws->xmlEncode($value["value"]) . "</orderingValue>"; break; case Namespaces::$rdfs . "subPropertyOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<subPropertyOf>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</subPropertyOf>"; break; case Namespaces::$iron . "allowedValue": $schema .= "<allowedValue><primitive>" . $this->ws->xmlEncode($value["value"]) . "</primitive></allowedValue>"; break; } } } $schema .= "</" . $this->ironPrefixize($uri, $prefixes) . ">"; } $subjectTriples = $ontology->getPropertiesDescription(FALSE, TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= "<" . $this->ironPrefixize($uri, $prefixes) . ">"; $schema .= "<description>" . $this->ws->xmlEncode($this->getDescription($subject)) . "</description>"; $schema .= "<prefLabel>" . $this->ws->xmlEncode($this->getLabel($uri, $subject)) . "</prefLabel>"; $schema .= "<type>" . Namespaces::$owl . "ObjectProperty</type>"; foreach ($subject as $predicate => $values) { foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</allowedType>"; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<allowedValue><type>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</type></allowedValue>"; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= "<displayControl>" . $this->ws->xmlEncode($displayControl) . "</displayControl>"; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= "<ignoredBy>" . $this->ws->xmlEncode($ignoredBy) . "</ignoredBy>"; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<comparableWith>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</comparableWith>"; break; case Namespaces::$sco . "shortLabel": $schema .= "<shortLabel>" . $this->ws->xmlEncode($value["value"]) . "</shortLabel>"; break; case Namespaces::$sco . "minCardinality": $schema .= "<minCardinality>" . $this->ws->xmlEncode($value["value"]) . "</minCardinality>"; break; case Namespaces::$sco . "maxCardinality": $schema .= "<maxCardinality>" . $this->ws->xmlEncode($value["value"]) . "</maxCardinality>"; break; case Namespaces::$sco . "cardinality": $schema .= "<cardinality>" . $this->ws->xmlEncode($value["value"]) . "</cardinality>"; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= "<unitType>" . $this->ws->xmlEncode($this->ironPrefixize($value["uri"], $prefixes)) . "</unitType>"; break; case Namespaces::$sco . "orderingValue": $schema .= "<orderingValue>" . $this->ws->xmlEncode($value["value"]) . "</orderingValue>"; break; case Namespaces::$iron . "allowedValue": $schema .= "<allowedValue><primitive>" . $this->ws->xmlEncode($value["value"]) . "</primitive></allowedValue>"; break; } } } $schema .= "</" . $this->ironPrefixize($uri, $prefixes) . ">"; } $schema .= "</attributeList>"; $schema .= "<prefixList>"; foreach ($prefixes as $prefix => $ns) { $schema .= " <{$prefix}>{$ns}</{$prefix}>"; } $schema .= "</prefixList>"; $schema .= "</schema>"; $subjectTriples = ""; $subject = new Subject($this->ws->ontologyUri); $subject->setType("owl:Ontology"); $subject->setDataAttribute(Namespaces::$wsf . "serializedIronXMLSchema", str_replace('&', '&amp;', str_replace(array("\\", "&", "<", ">"), array("%5C", "&", "<", ">"), $schema))); $this->ws->rset->addSubject($subject); /* <schema> <version>0.1</version> <prefLabel>PEG schema</prefLabel> <prefixList> <sco>http://purl.org/ontology/sco#</sco> </prefixList> <typeList> <peg_Neighborhood> <subTypeOf>pegf_Organization</subTypeOf> <description>Neighborhood community organization</description> <prefLabel>neighborhood</prefLabel> <displayControl>sRelationBrowser</displayControl> </peg_Neighborhood> </typeList> <attributeList> <peg_neighborhoodNumber> <prefLabel>neighborhood number</prefLabel> <description>Neighborhood identification number</description> <allowedType>Neighborhood</allowedType> <allowedType>City</allowedType> <allowedType>Province</allowedType> <allowedType>Country</allowedType> <allowedValue> <primitive>String</primitive> </allowedValue> <maxValues>1</maxValues> </peg_neighborhoodNumber> </attributeList> </schema> */ break; case "getironjsonschema": $subjectTriples = $ontology->getClassesDescription($limit, $offset); $schema = '{ "schema": { "version": "0.1", "typeList": {'; $prefixes = array(); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= '"' . $this->ironPrefixize($uri, $prefixes) . '": {'; $schema .= '"description": "' . $this->ws->jsonEncode($this->getDescription($subject)) . '",'; $schema .= '"prefLabel": "' . $this->ws->jsonEncode($this->getLabel($uri, $subject)) . '",'; foreach ($subject as $predicate => $values) { switch ($predicate) { case Namespaces::$rdfs . "subClassOf": $schema .= '"subTypeOf": ['; break; case Namespaces::$sco . "displayControl": $schema .= '"displayControl": ['; break; case Namespaces::$sco . "ignoredBy": $schema .= '"ignoredBy": ['; break; case Namespaces::$sco . "shortLabel": $schema .= '"shortLabel": ['; break; case Namespaces::$sco . "color": $schema .= '"color": ['; break; case Namespaces::$sco . "mapMarkerImageUrl": $schema .= '"mapMarkerImageUrl": ['; break; case Namespaces::$sco . "relationBrowserNodeType": $schema .= '"relationBrowserNodeType": ['; break; } foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "subClassOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($displayControl) . '",'; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($ignoredBy) . '",'; break; case Namespaces::$sco . "shortLabel": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "color": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "mapMarkerImageUrl": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "relationBrowserNodeType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; } } switch ($predicate) { case Namespaces::$rdfs . "subClassOf": case Namespaces::$sco . "displayControl": case Namespaces::$sco . "ignoredBy": case Namespaces::$sco . "shortLabel": case Namespaces::$sco . "color": case Namespaces::$sco . "mapMarkerImageUrl": case Namespaces::$sco . "relationBrowserNodeType": $schema = rtrim($schema, ","); $schema .= '],'; break; } } $schema = rtrim($schema, ","); $schema .= "},"; } $schema = rtrim($schema, ","); $schema .= "},"; $schema .= '"attributeList": {'; $subjectTriples = $ontology->getPropertiesDescription(TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= '"' . $this->ironPrefixize($uri, $prefixes) . '": {'; $schema .= '"description": "' . $this->ws->jsonEncode($this->getDescription($subject)) . '",'; $schema .= '"prefLabel": "' . $this->ws->jsonEncode($this->getLabel($uri, $subject)) . '",'; $schema .= '"type": "' . Namespaces::$owl . 'DatatypeProperty",'; foreach ($subject as $predicate => $values) { switch ($predicate) { case Namespaces::$iron . "allowedValue": $schema .= '"allowedValue": {"primitive": "' . $this->ws->jsonEncode($value["value"]) . '"},'; break; case Namespaces::$rdfs . "subPropertyOf": $schema .= '"subPropertyOf": ['; break; case Namespaces::$rdfs . "domain": $schema .= '"allowedType": ['; break; case Namespaces::$rdfs . "range": $schema .= '"allowedValue": ['; break; case Namespaces::$sco . "displayControl": $schema .= '"displayControl": ['; break; case Namespaces::$sco . "ignoredBy": $schema .= '"ignoredBy": ['; break; case Namespaces::$sco . "comparableWith": $schema .= '"comparableWith": ['; break; case Namespaces::$sco . "unitType": $schema .= '"unitType": ['; break; case Namespaces::$sco . "shortLabel": $schema .= '"shortLabel": ['; break; case Namespaces::$sco . "orderingValue": $schema .= '"orderingValue": ['; break; case Namespaces::$rdfs . "subPropertyOf": $schema .= '"subPropertyOf": ['; break; } foreach ($values as $value) { switch ($predicate) { case Namespaces::$sco . "minCardinality": $schema .= '"minCardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "maxCardinality": $schema .= '"maxCardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "cardinality": $schema .= '"cardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '{ "type": "' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '"},'; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($displayControl) . '",'; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($ignoredBy) . '",'; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "shortLabel": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "orderingValue": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$rdfs . "subPropertyOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; } } switch ($predicate) { case Namespaces::$rdfs . "domain": case Namespaces::$rdfs . "range": case Namespaces::$sco . "displayControl": case Namespaces::$sco . "ignoredBy": case Namespaces::$sco . "comparableWith": case Namespaces::$sco . "unitType": case Namespaces::$sco . "shortLabel": case Namespaces::$sco . "orderingValue": case Namespaces::$rdfs . "subPropertyOf": $schema = rtrim($schema, ","); $schema .= '],'; break; } } $schema = rtrim($schema, ","); $schema .= "},"; } $subjectTriples = $ontology->getPropertiesDescription(FALSE, FALSE, TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= '"' . $this->ironPrefixize($uri, $prefixes) . '": {'; $schema .= '"description": "' . $this->ws->jsonEncode($this->getDescription($subject)) . '",'; $schema .= '"prefLabel": "' . $this->ws->jsonEncode($this->getLabel($uri, $subject)) . '",'; $schema .= '"type": "' . Namespaces::$owl . 'AnnotationProperty",'; foreach ($subject as $predicate => $values) { switch ($predicate) { case Namespaces::$rdfs . "domain": $schema .= '"allowedType": ['; break; case Namespaces::$rdfs . "range": $schema .= '"allowedValue": ['; break; case Namespaces::$iron . "allowedValue": $schema .= '"allowedValue": {"primitive": "' . $this->ws->jsonEncode($value["value"]) . '"},'; break; case Namespaces::$rdfs . "subPropertyOf": $schema .= '"subPropertyOf": ['; break; case Namespaces::$sco . "displayControl": $schema .= '"displayControl": ['; break; case Namespaces::$sco . "ignoredBy": $schema .= '"ignoredBy": ['; break; case Namespaces::$sco . "comparableWith": $schema .= '"comparableWith": ['; break; case Namespaces::$sco . "unitType": $schema .= '"unitType": ['; break; case Namespaces::$sco . "shortLabel": $schema .= '"shortLabel": ['; break; case Namespaces::$sco . "orderingValue": $schema .= '"orderingValue": ['; break; case Namespaces::$rdfs . "subPropertyOf": $schema .= '"subPropertyOf": ['; break; } foreach ($values as $value) { switch ($predicate) { case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '{ "type": "' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '"},'; break; case Namespaces::$sco . "minCardinality": $schema .= '"minCardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "maxCardinality": $schema .= '"maxCardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "cardinality": $schema .= '"cardinality": "' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($displayControl) . '",'; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($ignoredBy) . '",'; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "shortLabel": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "orderingValue": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$rdfs . "subPropertyOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; } } switch ($predicate) { case Namespaces::$rdfs . "domain": case Namespaces::$rdfs . "range": case Namespaces::$sco . "displayControl": case Namespaces::$sco . "ignoredBy": case Namespaces::$sco . "comparableWith": case Namespaces::$sco . "unitType": case Namespaces::$sco . "shortLabel": case Namespaces::$sco . "orderingValue": case Namespaces::$rdfs . "subPropertyOf": $schema = rtrim($schema, ","); $schema .= '],'; break; } } $schema = rtrim($schema, ","); $schema .= "},"; } $subjectTriples = $ontology->getPropertiesDescription(FALSE, TRUE); foreach ($subjectTriples as $uri => $subject) { $this->manageIronPrefixes($uri, $prefixes); $schema .= '"' . $this->ironPrefixize($uri, $prefixes) . '": {'; $schema .= '"description": "' . $this->ws->jsonEncode($this->getDescription($subject)) . '",'; $schema .= '"prefLabel": "' . $this->ws->jsonEncode($this->getLabel($uri, $subject)) . '",'; $schema .= '"type": "' . Namespaces::$owl . 'ObjectProperty",'; foreach ($subject as $predicate => $values) { switch ($predicate) { case Namespaces::$rdfs . "domain": $schema .= '"allowedType": ['; break; case Namespaces::$rdfs . "range": $schema .= '"allowedValue": ['; break; case Namespaces::$sco . "displayControl": $schema .= '"displayControl": ['; break; case Namespaces::$sco . "ignoredBy": $schema .= '"ignoredBy": ['; break; case Namespaces::$sco . "comparableWith": $schema .= '"comparableWith": ['; break; case Namespaces::$sco . "unitType": $schema .= '"unitType": ['; break; case Namespaces::$sco . "shortLabel": $schema .= '"shortLabel": ['; break; case Namespaces::$sco . "orderingValue": $schema .= '"orderingValue": ['; break; case Namespaces::$rdfs . "subPropertyOf": $schema .= '"subPropertyOf": ['; break; } foreach ($values as $value) { switch ($predicate) { case Namespaces::$iron . "allowedValue": $schema .= '{"primitive": "' . $this->ws->jsonEncode($value["value"]) . '"},'; break; case Namespaces::$rdfs . "domain": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$rdfs . "range": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '{ "type": "' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '"},'; break; case Namespaces::$sco . "displayControl": if (isset($value["uri"])) { $displayControl = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $displayControl = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($displayControl) . '",'; break; case Namespaces::$sco . "ignoredBy": if (isset($value["uri"])) { $ignoredBy = substr($value["uri"], strripos($value["uri"], "#") + 1); } else { $ignoredBy = $value["value"]; } $schema .= '"' . $this->ws->jsonEncode($ignoredBy) . '",'; break; case Namespaces::$sco . "comparableWith": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "shortLabel": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$sco . "unitType": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; case Namespaces::$sco . "orderingValue": $schema .= '"' . $this->ws->jsonEncode($value["value"]) . '",'; break; case Namespaces::$rdfs . "subPropertyOf": $this->manageIronPrefixes($value["uri"], $prefixes); $schema .= '"' . $this->ws->jsonEncode($this->ironPrefixize($value["uri"], $prefixes)) . '",'; break; } } switch ($predicate) { case Namespaces::$rdfs . "domain": case Namespaces::$rdfs . "range": case Namespaces::$sco . "displayControl": case Namespaces::$sco . "ignoredBy": case Namespaces::$sco . "comparableWith": case Namespaces::$sco . "unitType": case Namespaces::$sco . "shortLabel": case Namespaces::$sco . "orderingValue": case Namespaces::$rdfs . "subPropertyOf": $schema = rtrim($schema, ","); $schema .= '],'; break; } } $schema = rtrim($schema, ","); $schema .= "},"; } $schema = rtrim($schema, ","); $schema .= "},"; $schema .= '"prefixList": {'; foreach ($prefixes as $prefix => $ns) { $schema .= " \"{$prefix}\": \"{$ns}\","; } $schema = rtrim($schema, ","); $schema .= "}"; $schema .= "}"; $schema .= "}"; $subjectTriples = ""; $subject = new Subject($this->ws->ontologyUri); $subject->setType("owl:Ontology"); $subject->setDataAttribute(Namespaces::$wsf . "serializedIronJSONSchema", $schema); $this->ws->rset->addSubject($subject); /* { "schema": { "version": "0.1", "typeList": { "bibo_ThesisDegree": { "description": "The academic degree of a Thesis", "prefLabel": "Thesis degree", "subTypeOf": [ "owl_Thing" ] }, "0_1_Agent": { "description": "No description available", "prefLabel": "Agent", "subTypeOf": [ "owl_Thing" ] }, "bibo_Event": { "description": "No description available", "prefLabel": "Event", "subTypeOf": [ "owl_Thing" ] } }, "attributeList": { "bibo_sici": { "description": "No description available", "prefLabel": "sici", "allowedValue": { "primitive": "String" }, "subPropertyOf": [ "bibo_identifier" ] }, "terms_rights": { "description": "No description available", "prefLabel": "rights", "subPropertyOf": [ "owl_topObjectProperty" ] }, "0_1_based_near": { "description": "No description available", "prefLabel": "based_near", "subPropertyOf": [ "owl_topObjectProperty" ] } }, "prefixList": { "bibo": "http://purl.org/ontology/bibo/", "owl": "http://www.w3.org/2002/07/owl#", "0_1": "http://xmlns.com/foaf/0.1/", "event_owl": "http://purl.org/NET/c4dm/event.owl#", "rdf_schema": "http://www.w3.org/2000/01/rdf-schema#", "22_rdf_syntax_ns": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "terms": "http://purl.org/dc/terms/", "basic": "http://prismstandard.org/namespaces/1.2/basic/", "schema": "http://schemas.talis.com/2005/address/schema#" } } } */ break; case "getproperty": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } $property = $ontology->_getProperty($this->ws->parameters["uri"]); if ($property == NULL) { $this->returnError(400, "Bad Request", "_204"); } else { $subject = new Subject($this->ws->parameters["uri"]); $subject->setSubject($ontology->_getPropertyDescription($property)); $this->ws->rset->addSubject($subject); } break; case "getproperties": $limit = -1; $offset = 0; if (isset($this->ws->parameters["limit"])) { $limit = $this->ws->parameters["limit"]; } if (isset($this->ws->parameters["offset"])) { $offset = $this->ws->parameters["offset"]; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $properties = $ontology->getPropertiesUri(TRUE, FALSE, FALSE, $limit, $offset); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:DatatypeProperty"); $this->ws->rset->addSubject($subject); } break; case "objectproperty": $properties = $ontology->getPropertiesUri(FALSE, TRUE, FALSE, $limit, $offset); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:ObjectProperty"); $this->ws->rset->addSubject($subject); } break; case "annotationproperty": $properties = $ontology->getPropertiesUri(FALSE, FALSE, TRUE, $limit, $offset); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:AnnotationProperty"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; case "descriptions": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getPropertiesDescription(TRUE, FALSE, FALSE, $limit, $offset))); break; case "objectproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getPropertiesDescription(FALSE, TRUE, FALSE, $limit, $offset))); break; case "annotationproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getPropertiesDescription(FALSE, FALSE, TRUE, $limit, $offset))); break; case "all": // @TODO: property handle possible punned properties (properties that have the same URI but that are of different property types) $subjectTriples = array(); $subjectTriples = array_merge($subjectTriples, $ontology->getPropertiesDescription(TRUE, FALSE, FALSE, $limit, $offset)); $subjectTriples = array_merge($subjectTriples, $ontology->getPropertiesDescription(FALSE, TRUE, FALSE, $limit, $offset)); // Check if the annotatio properties got punned. If they did, then ignore returning the annotation property. $annotationProperties = $ontology->getPropertiesDescription(FALSE, FALSE, TRUE, $limit, $offset); foreach ($annotationProperties as $uri => $property) { if (!isset($subjectTriples[$uri])) { $subjectTriples[$uri] = $property; } } $this->ws->rset->setResultset(array($this->ws->ontologyUri => $subjectTriples)); break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getsubproperties": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $properties = $ontology->getSubPropertiesUri((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], TRUE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:DatatypeProperty"); $this->ws->rset->addSubject($subject); } break; case "objectproperty": $properties = $ontology->getSubPropertiesUri((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], FALSE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:ObjectProperty"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; case "descriptions": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSubPropertiesDescription((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], TRUE))); break; case "objectproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSubPropertiesDescription((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], FALSE))); break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getsuperproperties": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $properties = $ontology->getSuperPropertiesUri((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], TRUE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:DatatypeProperty"); $this->ws->rset->addSubject($subject); } break; case "objectproperty": $properties = $ontology->getSuperPropertiesUri((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], FALSE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:ObjectProperty"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; case "descriptions": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSuperPropertiesDescription((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], TRUE))); break; case "objectproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getSuperPropertiesDescription((string) $this->ws->parameters["uri"], $this->ws->parameters["direct"], FALSE))); break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getequivalentproperties": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $properties = $ontology->getEquivalentPropertiesUri((string) $this->ws->parameters["uri"], TRUE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:DatatypeProperty"); $this->ws->rset->addSubject($subject); } break; case "objectproperty": $properties = $ontology->getEquivalentPropertiesUri((string) $this->ws->parameters["uri"], FALSE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:ObjectProperty"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; case "descriptions": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getEquivalentPropertiesDescription((string) $this->ws->parameters["uri"], TRUE))); break; case "objectproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getEquivalentPropertiesDescription((string) $this->ws->parameters["uri"], FALSE))); break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; case "getdisjointproperties": if (!isset($this->ws->parameters["uri"]) || $this->ws->parameters["uri"] == "") { $this->returnError(400, "Bad Request", "_202"); return; } switch (strtolower($this->ws->parameters["mode"])) { case "uris": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $properties = $ontology->getDisjointPropertiesUri((string) $this->ws->parameters["uri"], TRUE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:DatatypeProperty"); $this->ws->rset->addSubject($subject); } break; case "objectproperty": $properties = $ontology->getDisjointPropertiesUri((string) $this->ws->parameters["uri"], FALSE); foreach ($properties as $property) { $subject = new Subject($property); $subject->setType("owl:ObjectProperty"); $this->ws->rset->addSubject($subject); } break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; case "descriptions": switch (strtolower($this->ws->parameters["type"])) { case "dataproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getDisjointPropertiesDescription((string) $this->ws->parameters["uri"], TRUE))); break; case "objectproperty": $this->ws->rset->setResultset(array($this->ws->ontologyUri => $ontology->getDisjointPropertiesDescription((string) $this->ws->parameters["uri"], FALSE))); break; default: $this->returnError(400, "Bad Request", "_203"); return; break; } break; default: $this->returnError(400, "Bad Request", "_201"); return; break; } break; default: $this->ws->conneg->setStatus(400); $this->ws->conneg->setStatusMsg("Bad Request"); $this->ws->conneg->setStatusMsgExt($this->ws->errorMessenger->_200->name); $this->ws->conneg->setError($this->ws->errorMessenger->_200->id, $this->ws->errorMessenger->ws, $this->ws->errorMessenger->_200->name, $this->ws->errorMessenger->_200->description, "This function is not defined\n for this endpoint:" . $this->ws->function, $this->ws->errorMessenger->_200->level); return; break; } } }
/** * Get a list of all the loaded ontologies in the instance. This list includes all the ontologies files * that have been loaded seperately. This list includes the description of the loaded ontologies * * The array is defined as: * * $classDescription = array( * "http://...." => array( * "predicate-uri" => array( * array( * "value" => "the value of the predicate", * "type" => "the type of the value", * "lang" => "language reference of the value (if literal)" * ), * array(...) * ), * "..." => array(...) * ) * ) * * @return An array of ontology URI loaded in the instance. * * @see getLoadedOntologiesUri() * * @author Frederick Giasson, Structured Dynamics LLC. */ public static function getLoadedOntologiesDescription($owlApiSession = NULL) { if (@$this === NULL && $owlApiSession == NULL) { return array(); } if (@$this !== NULL && $owlApiSession == NULL) { $owlApiSession = $this->owlApiSession; } $ontologies = array(); $ontologiesURI = OWLOntology::getLoadedOntologiesUri($owlApiSession); foreach ($ontologiesURI as $uri) { $ont = new OWLOntology($uri, $owlApiSession); $description = $ont->getOntologyDescription(); $ontologies[$uri] = $description; } return $ontologies; }
/** Update all ontological structures used by the WSF @author Frederick Giasson, Structured Dynamics LLC. */ public function createOntology() { // Make sure there was no conneg error prior to this process call if ($this->ws->conneg->getStatus() == 200) { $this->ws->validateQuery(); // If the query is still valid if ($this->ws->conneg->getStatus() == 200) { // Starts the OWLAPI process/bridge require_once $this->ws->owlapiBridgeURI; // Create the OWLAPI session object that could have been persisted on the OWLAPI instance. // Second param "false" => we re-use the pre-created session without destroying the previous one // third param "0" => it nevers timeout. $OwlApiSession = java_session("OWLAPI", false, 0); $register = java_values($OwlApiSession->get("ontologiesRegister")); // Check if the ontology is already existing if (!is_null(java_values($OwlApiSession->get($this->getOntologySessionID($this->ws->ontologyUri)))) || $register != NULL && array_search($this->getOntologySessionID($this->ws->ontologyUri), $register) !== FALSE) { $this->ws->returnError(400, "Bad Request", "_302", ""); return; } try { $ontology = new OWLOntology($this->ws->ontologyUri, $OwlApiSession, FALSE); if (strtolower($this->ws->owlapiReasoner) == "pellet") { $ontology->usePelletReasoner(); } elseif (strtolower($this->ws->owlapiReasoner) == "hermit") { $ontology->useHermitReasoner(); } elseif (strtolower($this->ws->owlapiReasoner) == "factpp") { $ontology->useFactppReasoner(); } } catch (Exception $e) { $this->ws->returnError(400, "Bad Request", "_300", (string) java_values($e)); return; } // Get the description of the ontology $ontologyDescription = $ontology->getOntologyDescription(); $ontologyName = $this->getLabel($this->ws->ontologyUri, $ontologyDescription); $ontologyDescription = $this->getDescription($ontologyDescription); // Get the list of webservices that will be accessible for this ontology dataset. $authLister = new AuthLister("ws", $this->ws->ontologyUri, $this->ws->requester_ip, $this->ws->wsf_local_ip); $authLister->pipeline_conneg($this->ws->conneg->getAccept(), $this->ws->conneg->getAcceptCharset(), $this->ws->conneg->getAcceptEncoding(), $this->ws->conneg->getAcceptLanguage()); $authLister->process(); if ($authLister->pipeline_getResponseHeaderStatus() != 200) { $this->ws->conneg->setStatus($authLister->pipeline_getResponseHeaderStatus()); $this->ws->conneg->setStatusMsg($authLister->pipeline_getResponseHeaderStatusMsg()); $this->ws->conneg->setStatusMsgExt($authLister->pipeline_getResponseHeaderStatusMsgExt()); $this->ws->conneg->setError($authLister->pipeline_getError()->id, $authLister->pipeline_getError()->webservice, $authLister->pipeline_getError()->name, $authLister->pipeline_getError()->description, $authLister->pipeline_getError()->debugInfo, $authLister->pipeline_getError()->level); return; } /* Get all web services */ $webservices = ""; $xml = new ProcessorXML(); $xml->loadXML($authLister->pipeline_getResultset()); $webServiceElements = $xml->getXPath('//predicate/object[attribute::type="wsf:WebService"]'); foreach ($webServiceElements as $element) { if (stristr($xml->getURI($element), "/wsf/ws/search/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/browse/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/sparql/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/crud/create/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/crud/update/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/crud/delete/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/crud/read/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/ontology/create/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/ontology/read/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/ontology/update/") !== FALSE || stristr($xml->getURI($element), "/wsf/ws/ontology/delete/") !== FALSE) { $webservices .= $xml->getURI($element) . ";"; } } $webservices = rtrim($webservices, ";"); unset($xml); unset($authLister); // Create a new dataset for this ontology $globalPermissions = ""; if ($this->ws->globalPermissionCreate === FALSE) { $globalPermissions .= "False;"; } else { $globalPermissions .= "True;"; } if ($this->ws->globalPermissionRead === FALSE) { $globalPermissions .= "False;"; } else { $globalPermissions .= "True;"; } if ($this->ws->globalPermissionUpdate === FALSE) { $globalPermissions .= "False;"; } else { $globalPermissions .= "True;"; } if ($this->ws->globalPermissionDelete === FALSE) { $globalPermissions .= "False"; } else { $globalPermissions .= "True"; } $datasetCreate = new DatasetCreate($this->ws->ontologyUri, $ontologyName, $ontologyDescription, "", $this->ws->registered_ip, $this->ws->requester_ip, $webservices, $globalPermissions); $datasetCreate->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); $datasetCreate->process(); if ($datasetCreate->pipeline_getResponseHeaderStatus() != 200) { if ($datasetCreate->pipeline_getError()->id != "WS-DATASET-CREATE-202") { $this->ws->conneg->setStatus($datasetCreate->pipeline_getResponseHeaderStatus()); $this->ws->conneg->setStatusMsg($datasetCreate->pipeline_getResponseHeaderStatusMsg()); $this->ws->conneg->setStatusMsgExt($datasetCreate->pipeline_getResponseHeaderStatusMsgExt()); $this->ws->conneg->setError($datasetCreate->pipeline_getError()->id, $datasetCreate->pipeline_getError()->webservice, $datasetCreate->pipeline_getError()->name, $datasetCreate->pipeline_getError()->description, $datasetCreate->pipeline_getError()->debugInfo, $datasetCreate->pipeline_getError()->level); } // If the dataset already exists, then we simply stop the processing of the advancedIndexation // mode. This means that the tomcat instance has been rebooted, and that the datasets // have been leaved there, and that a procedure, normally using the advancedIndexation mode // is currently being re-processed. return; } unset($datasetCreate); // Tag the new dataset as being a dataset that host an ontology description $query = "insert into <" . $this->ws->wsf_graph . "datasets/>\n {\n <" . $this->ws->ontologyUri . "> <http://purl.org/ontology/wsf#holdOntology> \"true\" .\n }"; @$this->ws->db->query($this->ws->db->build_sparql_query(str_replace(array("\n", "\r", "\t"), " ", $query), array(), FALSE)); if (odbc_error()) { $this->ws->conneg->setStatus(500); $this->ws->conneg->setStatusMsg("Internal Error"); $this->ws->conneg->setStatusMsgExt($this->ws->errorMessenger->_301->name); $this->ws->conneg->setError($this->ws->errorMessenger->_301->id, $this->ws->errorMessenger->ws, $this->ws->errorMessenger->_301->name, $this->ws->errorMessenger->_301->description, odbc_errormsg(), $this->ws->errorMessenger->_301->level); return; } // Check if we want to enable the advanced indexation: so, if we want to import all the ontologies // description into the other structWSF data stores to enable search and filtering using the other // endpoints such as search, sparql, read, etc. if ($this->ws->advancedIndexation) { // Once we start the ontology creation process, we have to make sure that even if the server // loose the connection with the user the process will still finish. ignore_user_abort(true); // However, maybe there is an issue with the server handling that file tht lead to some kind of infinite // or near infinite loop; so we have to limit the execution time of this procedure to 45 mins. set_time_limit(86400); // Get the description of the classes, properties and named individuals of this ontology. // Check the size of the Ontology file to import. If the size is bigger than 8MB, then we will // use another method that incurs some Virtuoso indexing. If it is the case, you have to make sure // that Virtuoso is properly configured so that it can access (DirsAllowed Virtuoso config option) // the folder where the ontology file has been saved. if (filesize($this->ws->ontologyUri) > 8000000) { $sliceSize = 100; // Import the big file into Virtuoso $sqlQuery = "DB.DBA.RDF_LOAD_RDFXML_MT(file_to_string_output('" . str_replace("file://localhost", "", $this->ws->ontologyUri) . "'),'" . $this->ws->ontologyUri . "/import','" . $this->ws->ontologyUri . "/import')"; $resultset = $this->ws->db->query($sqlQuery); if (odbc_error()) { // If there is an error, try to load it using the Turtle parser $sqlQuery = "DB.DBA.TTLP_MT(file_to_string_output('" . str_replace("file://localhost", "", $this->ws->ontologyUri) . "'),'" . $this->ws->ontologyUri . "/import','" . $this->ws->ontologyUri . "/import')"; $resultset = $this->ws->db->query($sqlQuery); if (odbc_error()) { // echo "Error: can't import the file: $file, into the triple store.\n"; // return; } } unset($resultset); // count the number of records $sparqlQuery = "\n \n select count(distinct ?s) as ?nb from <" . $this->ws->ontologyUri . "/import>\n where\n {\n ?s a ?o .\n }\n \n "; $resultset = $this->ws->db->query($this->ws->db->build_sparql_query($sparqlQuery, array('nb'), FALSE)); $nb = odbc_result($resultset, 1); unset($resultset); $nbRecordsDone = 0; while ($nbRecordsDone < $nb && $nb > 0) { // Create slices of 100 records. $sparqlQuery = "\n \n select ?s ?p ?o (DATATYPE(?o)) as ?otype (LANG(?o)) as ?olang\n where \n {\n {\n select distinct ?s from <" . $this->ws->ontologyUri . "/import> \n where \n {\n ?s a ?type.\n } \n limit " . $sliceSize . " \n offset " . $nbRecordsDone . "\n } \n \n ?s ?p ?o\n }\n \n "; $resultset = $this->ws->db->query($this->ws->db->build_sparql_query($sparqlQuery, array('s', 'p', 'o', 'otype', 'olang'), FALSE)); if (odbc_error()) { // echo "Error: can't get records slices.\n"; // return; } $crudCreates = ""; $crudUpdates = ""; $crudDeletes = array(); $rdfDocumentN3 = ""; $currentSubject = ""; $subjectDescription = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"; while (odbc_fetch_row($resultset)) { $s = odbc_result($resultset, 1); $p = odbc_result($resultset, 2); $o = $this->ws->db->odbc_getPossibleLongResult($resultset, 3); $otype = odbc_result($resultset, 4); $olang = odbc_result($resultset, 5); if ($otype != "" || $olang != "") { $subjectDescription .= "<{$s}> <{$p}> \"\"\"" . $this->n3Encode($o) . "\"\"\" .\n"; } else { $subjectDescription .= "<{$s}> <{$p}> <{$o}> .\n"; } } unset($resultset); $wsq = new WebServiceQuerier(rtrim($this->ws->wsf_base_url, "/") . "/ws/crud/create/", "post", "application/rdf+xml", "document=" . urlencode($subjectDescription) . "&dataset=" . urlencode($this->ws->ontologyUri) . "&mime=" . urlencode("application/rdf+n3") . "&mode=full" . "®istered_ip=" . urlencode($this->ws->registered_ip)); if ($wsq->getStatus() != 200) { $this->ws->conneg->setStatus($wsq->getStatus()); $this->ws->conneg->setStatusMsg($wsq->getStatusMessage()); $this->ws->conneg->setStatusMsgExt($wsq->getStatusMessageDescription()); /* $this->ws->conneg->setError($wsq->pipeline_getError()->id, $crudCreate->pipeline_getError()->webservice, $crudCreate->pipeline_getError()->name, $crudCreate->pipeline_getError()->description, $crudCreate->pipeline_getError()->debugInfo, $crudCreate->pipeline_getError()->level); */ // In case of error, we delete the dataset we previously created. $ontologyDelete = new OntologyDelete($this->ws->ontologyUri, $this->ws->registered_ip, $this->ws->requester_ip); $ontologyDelete->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); $ontologyDelete->deleteOntology(); if ($ontologyDelete->pipeline_getResponseHeaderStatus() != 200) { $this->ws->conneg->setStatus($ontologyDelete->pipeline_getResponseHeaderStatus()); $this->ws->conneg->setStatusMsg($ontologyDelete->pipeline_getResponseHeaderStatusMsg()); $this->ws->conneg->setStatusMsgExt($ontologyDelete->pipeline_getResponseHeaderStatusMsgExt()); $this->ws->conneg->setError($ontologyDelete->pipeline_getError()->id, $ontologyDelete->pipeline_getError()->webservice, $ontologyDelete->pipeline_getError()->name, $ontologyDelete->pipeline_getError()->description, $ontologyDelete->pipeline_getError()->debugInfo, $ontologyDelete->pipeline_getError()->level); //return; } //return; } $nbRecordsDone += $sliceSize; } // Now delete the graph we used to import the file $sqlQuery = "sparql clear graph <" . $this->ws->ontologyUri . "/import>"; $resultset = $this->ws->db->query($sqlQuery); if (odbc_error()) { // echo "Error: can't delete the graph sued for importing the file\n"; // return; } unset($resultset); } else { $nbClasses = $ontology->getNbClasses(); $sliceSize = 200; // Note: in OntologyCreate, we have to merge all the classes, properties and named individuals // together. This is needed to properly handle possible punning used in imported ontologies. // If we don't do this, and that a resource is both a class and an individual, then only // the individual will be in the Solr index because it would overwrite the Class // record document with the same URI. include_once "../../framework/arc2/ARC2.php"; $rdfxmlParser = ARC2::getRDFParser(); $rdfxmlSerializer = ARC2::getRDFXMLSerializer(); $resourcesIndex = $rdfxmlParser->getSimpleIndex(0); for ($i = 0; $i < $nbClasses; $i += $sliceSize) { $ontologyRead = new OntologyRead($this->ws->ontologyUri, "getClasses", "mode=descriptions;limit={$sliceSize};offset={$i}", $this->ws->registered_ip, $this->ws->requester_ip); // Since we are in pipeline mode, we have to set the owlapisession using the current one. // otherwise the java bridge will return an error $ontologyRead->setOwlApiSession($OwlApiSession); $ontologyRead->ws_conneg("application/rdf+xml", $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); if ($this->ws->reasoner) { $ontologyRead->useReasoner(); } else { $ontologyRead->stopUsingReasoner(); } $ontologyRead->process(); $classesRDF = $ontologyRead->ws_serialize(); $rdfxmlParser->parse($this->ws->ontologyUri, $classesRDF); $resourceIndex = $rdfxmlParser->getSimpleIndex(0); $resourcesIndex = ARC2::getMergedIndex($resourcesIndex, $resourceIndex); unset($ontologyRead); } $nbProperties = 0; $nbProperties += $ontology->getNbObjectProperties(); $nbProperties += $ontology->getNbDataProperties(); $nbProperties += $ontology->getNbAnnotationProperties(); $sliceSize = 200; for ($i = 0; $i < $nbProperties; $i += $sliceSize) { $ontologyRead = new OntologyRead($this->ws->ontologyUri, "getProperties", "mode=descriptions;limit={$sliceSize};offset={$i};type=all", $this->ws->registered_ip, $this->ws->requester_ip); // Since we are in pipeline mode, we have to set the owlapisession using the current one. // otherwise the java bridge will return an error $ontologyRead->setOwlApiSession($OwlApiSession); $ontologyRead->ws_conneg("application/rdf+xml", $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); if ($this->ws->reasoner) { $ontologyRead->useReasoner(); } else { $ontologyRead->stopUsingReasoner(); } $ontologyRead->process(); $propertiesRDF = $ontologyRead->ws_serialize(); $rdfxmlParser->parse($this->ws->ontologyUri, $propertiesRDF); $resourceIndex = $rdfxmlParser->getSimpleIndex(0); $resourcesIndex = ARC2::getMergedIndex($resourcesIndex, $resourceIndex); unset($ontologyRead); } $nbNamedIndividuals = $ontology->getNbNamedIndividuals(); $sliceSize = 200; for ($i = 0; $i < $nbNamedIndividuals; $i += $sliceSize) { $ontologyRead = new OntologyRead($this->ws->ontologyUri, "getNamedIndividuals", "classuri=all;mode=descriptions;limit={$sliceSize};offset={$i}", $this->ws->registered_ip, $this->ws->requester_ip); // Since we are in pipeline mode, we have to set the owlapisession using the current one. // otherwise the java bridge will return an error $ontologyRead->setOwlApiSession($OwlApiSession); $ontologyRead->ws_conneg("application/rdf+xml", $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); if ($this->ws->reasoner) { $ontologyRead->useReasoner(); } else { $ontologyRead->stopUsingReasoner(); } $ontologyRead->process(); $namedIndividualsRDF = $ontologyRead->ws_serialize(); $rdfxmlParser->parse($this->ws->ontologyUri, $namedIndividualsRDF); $resourceIndex = $rdfxmlParser->getSimpleIndex(0); $resourcesIndex = ARC2::getMergedIndex($resourcesIndex, $resourceIndex); unset($ontologyRead); } // Now, let's index the resources of this ontology within structWSF (for the usage of browse, search // and sparql) // Split the aggregated resources in multiple slices $nbResources = count($resourcesIndex); $sliceSize = 200; for ($i = 0; $i < $nbResources; $i += $sliceSize) { $slicedResourcesIndex = array_slice($resourcesIndex, $i, $sliceSize); $resourcesRDF = $rdfxmlSerializer->getSerializedIndex($slicedResourcesIndex); $crudCreate = new CrudCreate($resourcesRDF, "application/rdf+xml", "full", $this->ws->ontologyUri, $this->ws->registered_ip, $this->ws->requester_ip); $crudCreate->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); $crudCreate->process(); if ($crudCreate->pipeline_getResponseHeaderStatus() != 200) { $this->ws->conneg->setStatus($crudCreate->pipeline_getResponseHeaderStatus()); $this->ws->conneg->setStatusMsg($crudCreate->pipeline_getResponseHeaderStatusMsg()); $this->ws->conneg->setStatusMsgExt($crudCreate->pipeline_getResponseHeaderStatusMsgExt()); $this->ws->conneg->setError($crudCreate->pipeline_getError()->id, $crudCreate->pipeline_getError()->webservice, $crudCreate->pipeline_getError()->name, $crudCreate->pipeline_getError()->description, $crudCreate->pipeline_getError()->debugInfo, $crudCreate->pipeline_getError()->level); // In case of error, we delete the dataset we previously created. $ontologyDelete = new OntologyDelete($this->ws->ontologyUri, $this->ws->registered_ip, $this->ws->requester_ip); $ontologyDelete->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']); $ontologyDelete->deleteOntology(); if ($ontologyDelete->pipeline_getResponseHeaderStatus() != 200) { $this->ws->conneg->setStatus($ontologyDelete->pipeline_getResponseHeaderStatus()); $this->ws->conneg->setStatusMsg($ontologyDelete->pipeline_getResponseHeaderStatusMsg()); $this->ws->conneg->setStatusMsgExt($ontologyDelete->pipeline_getResponseHeaderStatusMsgExt()); $this->ws->conneg->setError($ontologyDelete->pipeline_getError()->id, $ontologyDelete->pipeline_getError()->webservice, $ontologyDelete->pipeline_getError()->name, $ontologyDelete->pipeline_getError()->description, $ontologyDelete->pipeline_getError()->debugInfo, $ontologyDelete->pipeline_getError()->level); return; } return; } unset($crudCreate); } } } } } }