src/TypesGenerator.php
private function getParentClasses(\EasyRdf_Resource $resource, array $parentClasses = [])
    {
        if ([] === $parentClasses) {
            return $this->getParentClasses($resource, [$resource->getUri()]);
        }

        $subclasses = $resource->all('rdfs:subClassOf');

        if (empty($subclasses)) {
            return $parentClasses;
        }

        $parentClass = $subclasses[0];
        $parentClasses[] = $parentClass->getUri();

        foreach ($this->graphs as $graph) {
            foreach ($graph->allOfType('rdfs:Class') as $type) {
                if ($type->getUri() === $parentClass->getUri()) {
                    $parentClasses = $this->getParentClasses($type, $parentClasses);

                    break 2;
                }
            }
        }

        return $parentClasses;
    }
private function getParentClasses(\EasyRdf_Resource $resource, array $parentClasses = [])
    {
        if ([] === $parentClasses) {
            return $this->getParentClasses($resource, [$resource->getUri()]);
        }

        $subclasses = $resource->all('rdfs:subClassOf');

        if (empty($subclasses)) {
            return $parentClasses;
        }

        $parentClass = $subclasses[0];
        $parentClasses[] = $parentClass->getUri();

        foreach ($this->graphs as $graph) {
            foreach ($graph->allOfType('rdfs:Class') as $type) {
                if ($type->getUri() === $parentClass->getUri()) {
                    $parentClasses = $this->getParentClasses($type, $parentClasses);

                    break 2;
                }
            }
        }

        return $parentClasses;
    }
Gets the parent classes of the current one and add them to $parentClasses array.

@param \EasyRdf_Resource $resource
@param string[]          $parentClasses

@return array