getParsedBody(); $class = $this->getClass($parsedBody['classUri']); $property = $this->getProperty($parsedBody['uri']); $propertyType = $this->getPropertyType($property); if ($propertyType !== null) { $propertyName = $this->getPropertyRealName($property->getLabel(), $propertyType->getUri()); $this->getEventManager()->trigger(new ClassPropertyRemovedEvent($class, $propertyName)); } $this->invalidatePropertyCache($property); // Delete property mode foreach ($class->getProperties() as $classProperty) { if ($classProperty->equals($property)) { $indexes = $property->getPropertyValues($this->getProperty(OntologyIndex::PROPERTY_INDEX)); // Delete property and the existing values of this property if ($property->delete(true)) { $this->getEventManager()->trigger( new ClassPropertyDeletedEvent( $class, [ 'propertyUri' => $property->getUri() ] ) ); // Delete index linked to the property foreach ($indexes as $indexUri) { $index = $this->getResource($indexUri); $index->delete(true); } return true; } } } return false; } private function invalidatePropertyCache(core_kernel_classes_Property $property): void { if ($property->getRange()) { $this->getParentPropertyListCachedRepository()->deleteCache( [ 'listUri' => $property->getRange()->getUri() ] ); } } private function getEventManager(): EventManager { return $this->getServiceManager()->get(EventManager::SERVICE_ID); } private function getParentPropertyListCachedRepository(): ParentPropertyListCachedRepository { return $this->getServiceLocator()->get(ParentPropertyListCachedRepository::class); } }