예제 #1
0
 public function testSetType()
 {
     $this->object->setLoadState(KVDthes_Term::LS_NOTES);
     $this->object->setLoadState(KVDthes_Term::LS_REL);
     $this->object->setLoadState(KVDthes_Term::LS_MATCH);
     $this->object->setType(new KVDthes_TermType('ND', 'Non-Descriptor'));
     $this->assertEquals('ND', $this->object->getType()->getId());
 }
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     if ($node->hasRelations(KVDthes_Relation::REL_NT)) {
         $this->currItem = new KVDthes_DojoDatastoreComposite($node->getId(), $node->getQualifiedTerm(), $this->depth, $node->getType()->getId());
     } else {
         $this->currItem = new KVDthes_DojoDatastoreTerm($node->getId(), $node->getQualifiedTerm(), $this->depth, $node->getType()->getId());
     }
     $this->result->addItem($this->currItem);
     return true;
 }
예제 #3
0
 /**
  * transform
  *
  * @param KVDthes_Term $thes
  * @return EasyRdf_Resource
  */
 public function transform(KVDthes_Term $thes)
 {
     if ($thes->isNull()) {
         throw new InvalidArgumentException('Een nullobject kan niet geserialiseerd worden!');
     }
     if ($thes->getType()->getId() != 'HR') {
         throw new InvalidArgumentException('Om een thesaurus te kunnen serialiseren hebben we de HR term nodig.');
     }
     $term = $thes;
     $thes = $term->getThesaurus();
     $type = 'skos:ConceptScheme';
     try {
         $uri = $this->genThesaurusUri($thes);
         $res = $this->graph->resource($uri, $type);
     } catch (InvalidArgumentException $e) {
         $res = $this->graph->newBNode($type);
     }
     $res->add('skos:prefLabel', $thes->getNaam());
     $res->add('dc:title', $thes->getNaam());
     $res->add('dc:language', $thes->getLanguage());
     if ($term->hasNTRelations()) {
         $term->sortRelations(KVDthes_TermSorter::SORT_ID);
         $rels = $term->getNarrowerTerms();
         foreach ($rels as $rel) {
             $tt = $this->graph->resource($this->genTermUri($rel));
             $res->add('skos:hasTopConcept', $tt);
         }
     }
     return $res;
 }
예제 #4
0
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     $this->term = $this->dom->createElement('term');
     $this->term->appendChild($this->createTermId($node->getId()));
     $this->term->appendChild($this->createTermName($node->getTerm()));
     $this->term->appendChild($this->createTermType($node->getType()->getId()));
     $this->term->appendChild($this->createTermLanguage('nl-BE'));
     return true;
 }
예제 #5
0
 /**
  * bindValues
  *
  * @param   PDOStatement    $stmt
  * @param   integer         $nextIndex
  * @param   KVDthes_Term    $term
  * @return  integer         Volgende te gebruiken index.
  */
 protected function bindValues($stmt, $nextIndex, $term)
 {
     $stmt->bindValue($nextIndex++, $term->getTerm(), PDO::PARAM_STR);
     $stmt->bindValue($nextIndex++, $term->getType()->getId(), PDO::PARAM_STR);
     $stmt->bindValue($nextIndex++, $term->getLanguage(), PDO::PARAM_STR);
     $stmt->bindValue($nextIndex++, $term->getQualifier(), PDO::PARAM_STR);
     $stmt->bindValue($nextIndex++, $term->getSortKey(), PDO::PARAM_STR);
     return $nextIndex;
 }