/**
  * 
  *  
  * @param mixed $uri
  *  
  * @author Frederick Giasson, Structured Dynamics LLC.
  */
 public function deleteProperty($uri)
 {
     if ($this->isValid()) {
         if ($uri == "") {
             $this->ws->returnError(400, "Bad Request", "_202");
             return;
         }
         $this->initiateOwlBridgeSession();
         $this->getOntologyReference();
         // Delete the OWLAPI property entity
         $this->ws->ontology->removeProperty($uri);
         // Check to delete potential datasets that have been created within structWSF
         $crudDelete = new CrudDelete($uri, $this->ws->ontologyUri, $this->ws->registered_ip, $this->ws->requester_ip);
         $crudDelete->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         $crudDelete->process();
         if ($crudDelete->pipeline_getResponseHeaderStatus() != 200) {
             $this->ws->conneg->setStatus($crudDelete->pipeline_getResponseHeaderStatus());
             $this->ws->conneg->setStatusMsg($crudDelete->pipeline_getResponseHeaderStatusMsg());
             $this->ws->conneg->setStatusMsgExt($crudDelete->pipeline_getResponseHeaderStatusMsgExt());
             $this->ws->conneg->setError($crudDelete->pipeline_getError()->id, $crudDelete->pipeline_getError()->webservice, $crudDelete->pipeline_getError()->name, $crudDelete->pipeline_getError()->description, $crudDelete->pipeline_getError()->debugInfo, $crudDelete->pipeline_getError()->level);
             return;
         }
         // Update the name of the file of the ontology to mark it as "changed"
         $this->ws->ontology->addOntologyAnnotation("http://purl.org/ontology/wsf#ontologyModified", "true");
     }
 }
Пример #2
0
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$start_datetime = date("Y-m-d h:i:s");
$requester_ip = "0.0.0.0";
if (isset($_SERVER['REMOTE_ADDR'])) {
    $requester_ip = $_SERVER['REMOTE_ADDR'];
}
$parameters = "";
if (isset($_SERVER['REQUEST_URI'])) {
    $parameters = $_SERVER['REQUEST_URI'];
    $pos = strpos($parameters, "?");
    if ($pos !== FALSE) {
        $parameters = substr($parameters, $pos, strlen($parameters) - $pos);
    }
} elseif (isset($_SERVER['PHP_SELF'])) {
    $parameters = $_SERVER['PHP_SELF'];
}
$ws_cruddelete = new CrudDelete($uri, $dataset, $registered_ip, $requester_ip, $interface, $version);
$ws_cruddelete->ws_conneg(isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : "", isset($_SERVER['HTTP_ACCEPT_CHARSET']) ? $_SERVER['HTTP_ACCEPT_CHARSET'] : "", isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : "", isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : "");
$ws_cruddelete->process();
$ws_cruddelete->ws_respond($ws_cruddelete->ws_serialize());
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = $endtime - $starttime;
if ($ws_cruddelete->isLoggingEnabled()) {
    $logger = new Logger("crud_delete", $requester_ip, "?uri=" . $uri . "&dataset=" . $dataset . "&registered_ip=" . $registered_ip . "&requester_ip={$requester_ip}", isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : "", $start_datetime, $totaltime, $ws_cruddelete->pipeline_getResponseHeaderStatus(), isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "");
}
//@}
 /**
  * Update the URI of an entity
  * 
  * @param mixed $oldUri
  * @param mixed $newUri
  * @param mixed $advancedIndexation
  *  
  * @author Frederick Giasson, Structured Dynamics LLC.
  */
 public function updateEntityUri($oldUri, $newUri, $advancedIndexation)
 {
     $this->initiateOwlBridgeSession();
     $this->getOntologyReference();
     if ($this->isValid()) {
         if ($oldUri == "") {
             $this->ws->returnError(400, "Bad Request", "_202");
             return;
         }
         if ($newUri == "") {
             $this->ws->returnError(400, "Bad Request", "_203");
             return;
         }
         $this->ws->ontology->updateEntityUri($oldUri, $newUri);
         if ($advancedIndexation === TRUE) {
             // Find the type of entity manipulated here
             $entity = $this->ws->ontology->_getEntity($newUri);
             $function = "";
             $params = "";
             if ((bool) java_values($entity->isOWLClass())) {
                 $function = "getClass";
                 $params = "uri=" . $newUri;
             } elseif ((bool) java_values($entity->isOWLDataProperty()) || (bool) java_values($entity->isOWLObjectProperty()) || (bool) java_values($entity->isOWLAnnotationProperty())) {
                 $function = "getProperty";
                 $params = "uri=" . $newUri;
             } elseif ((bool) java_values($entity->isNamedIndividual())) {
                 $function = "getNamedIndividual";
                 $params = "uri=" . $newUri;
             } else {
                 return;
             }
             // Get the description of the newly updated entity.
             $ontologyRead = new OntologyRead($this->ws->ontologyUri, $function, $params, $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($this->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();
             if ($ontologyRead->pipeline_getResponseHeaderStatus() != 200) {
                 $this->ws->conneg->setStatus($ontologyRead->pipeline_getResponseHeaderStatus());
                 $this->ws->conneg->setStatusMsg($ontologyRead->pipeline_getResponseHeaderStatusMsg());
                 $this->ws->conneg->setStatusMsgExt($ontologyRead->pipeline_getResponseHeaderStatusMsgExt());
                 $this->ws->conneg->setError($ontologyRead->pipeline_getError()->id, $ontologyRead->pipeline_getError()->webservice, $ontologyRead->pipeline_getError()->name, $ontologyRead->pipeline_getError()->description, $ontologyRead->pipeline_getError()->debugInfo, $ontologyRead->pipeline_getError()->level);
                 return;
             }
             $entitySerialized = $ontologyRead->pipeline_serialize();
             unset($ontologyRead);
             // Delete the old entity in Solr
             // Update the classes and properties into the Solr index
             $crudDelete = new CrudDelete($oldUri, $this->ws->ontologyUri, $this->ws->registered_ip, $this->ws->requester_ip);
             $crudDelete->ws_conneg($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_ACCEPT_CHARSET'], $_SERVER['HTTP_ACCEPT_ENCODING'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
             $crudDelete->process();
             if ($crudDelete->pipeline_getResponseHeaderStatus() != 200) {
                 $this->ws->conneg->setStatus($crudDelete->pipeline_getResponseHeaderStatus());
                 $this->ws->conneg->setStatusMsg($crudDelete->pipeline_getResponseHeaderStatusMsg());
                 $this->ws->conneg->setStatusMsgExt($crudDelete->pipeline_getResponseHeaderStatusMsgExt());
                 $this->ws->conneg->setError($crudDelete->pipeline_getError()->id, $crudDelete->pipeline_getError()->webservice, $crudDelete->pipeline_getError()->name, $crudDelete->pipeline_getError()->description, $crudDelete->pipeline_getError()->debugInfo, $crudDelete->pipeline_getError()->level);
                 return;
             }
             unset($crudDelete);
             // Add the new entity in Solr
             // Update the classes and properties into the Solr index
             $crudCreate = new CrudCreate($entitySerialized, "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);
                 return;
             }
             unset($crudCreate);
         }
         // Update the name of the file of the ontology to mark it as "changed"
         $this->ws->ontology->addOntologyAnnotation("http://purl.org/ontology/wsf#ontologyModified", "true");
     }
 }