Esempio n. 1
0
 /**
  * Gets the vocab element represented by this state instance.
  *
  * @return \Gedcomx\Vocab\VocabElement
  */
 public function getVocabElement()
 {
     $vocabElement = new VocabElement();
     $idQuad = $this->rdfCollection->getPropertyQuad(VocabConstants::DC_NAMESPACE . "identifier");
     $vocabElement->setId(RdfNode::getValue($idQuad->getObject()));
     $vocabElement->setUri(RdfNode::getValue($this->rdfCollection->first()->getSubject()));
     $subclass = $this->rdfCollection->getPropertyQuad(VocabConstants::RDFS_NAMESPACE . "subClassOf");
     if ($subclass != null) {
         $vocabElement->setSubclass(RdfNode::getValue($subclass->getObject()));
     }
     $type = $this->rdfCollection->getPropertyQuad(VocabConstants::DC_NAMESPACE . "type");
     if ($type != null) {
         $vocabElement->setType(RdfNode::getValue($type->getObject()));
     }
     $labels = $this->rdfCollection->quadsMatchingProperty(VocabConstants::RDFS_NAMESPACE . "label");
     if ($labels->count()) {
         foreach ($labels as $label) {
             $node = $label->getObject();
             $vocabElement->addLabel(RdfNode::getValue($node), RdfNode::getLanguage($node));
         }
     }
     $comments = $this->rdfCollection->quadsMatchingProperty(VocabConstants::RDFS_NAMESPACE . "comment");
     if ($comments->count()) {
         foreach ($comments as $comment) {
             $node = $comment->getObject();
             $vocabElement->addDescription(RdfNode::getValue($node), RdfNode::getLanguage($node));
         }
     }
     return $vocabElement;
 }