Skip to content
Permalink
Browse files

Declare subClassOf relationships

  • Loading branch information...
lanthaler committed Jul 20, 2014
1 parent 360fa50 commit bcd4a9be2d7b9632dfe2db81bcf09de04ec22533
Showing with 16 additions and 0 deletions.
  1. +16 −0 HydraApi.php
@@ -231,6 +231,7 @@ public function getDocumentation()
'description' => 'rdfs:comment',
'domain' => array('@id' => 'rdfs:domain', '@type' => '@id'),
'range' => array('@id' => 'rdfs:range', '@type' => '@id'),
'subClassOf' => array('@id' => 'rdfs:subClassOf', '@type' => '@id'),
),
'@id' => $this->vocabUrl,
'@type' => 'ApiDocumentation',
@@ -248,9 +249,24 @@ public function getDocumentation()
'supportedProperty' => $this->documentClassProperties($class),
);
} else {
if (false !== ($superclass = get_parent_class($class->getName()))) {
try {
$superclass = $this->metadata->getMetadataFor($superclass);
$superclass = $superclass->isExternalReference()
? $superclass->getIri()
: 'vocab:' . $superclass->getIri();
} catch (\Exception $e) {
$superclass = null;
}
} else {
$superclass = null;
}
$docu['supportedClass'][] = array(
'@id' => 'vocab:' . $class->getIri(),
'@type' => 'hydra:Class',
'subClassOf' => $superclass,
'label' => $class->getTitle(),
'description' => $class->getDescription(),
'supportedOperation' => $this->documentOperations($class->getOperations()),

0 comments on commit bcd4a9b

Please sign in to comment.
You can’t perform that action at this time.