public function testHasMatches() { $termType = new KVDthes_TermType('PT', 'voorkeursterm'); $term2 = new KVDthes_TestTerm(508, $this->sessie, 'kapellen', $termType, 'bouwkundig erfgoed'); $this->object->loadMatch(new KVDthes_Match(KVDthes_Match::MATCH_RM, $term2)); $this->object->setLoadState(KVDthes_Matchable::LS_MATCH); $term2->setLoadState(KVDthes_Matchable::LS_MATCH); $this->assertTrue($this->object->hasMatches()); $this->assertTrue($this->object->hasMatches(KVDthes_Match::MATCH_RM)); $this->assertFalse($this->object->hasMatches(KVDthes_Match::MATCH_EM)); }
public function testWithTopTerms() { $oe = new KVDthes_TestTerm(1, $this->sessie, 'Onroerend Erfgoed', new KVDthes_TermType('HR', 'Hierarchy Root'), null, 'nl-BE', null, array('scopeNote' => 'Erfgoed dat niet verplaatst kan worden.', 'indexingNote' => 'Wordt nooit toegekend in de inventaris.', 'historyNote' => 'Vroeger gewoon erfgoed genoemd.', 'sourceNote' => 'Vlaams Instituut voor het Onroerend Erfgoed'), $this->thes); $oe->setLoadState(KVDthes_Term::LS_NOTES); $gs = new KVDthes_TestTerm(500, $this->sessie, 'Gebouwen en structuren', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $gs->setLoadState(KVDthes_Term::LS_NOTES); $oe->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_NT, $gs)); $ke = new KVDthes_TestTerm(1024, $this->sessie, 'Klein erfgoed', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $ke->setLoadState(KVDthes_Term::LS_NOTES); $oe->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_NT, $ke)); $ne = new KVDthes_TestTerm(178, $this->sessie, 'Nederzettingen', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $ne->setLoadState(KVDthes_Term::LS_NOTES); $oe->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_NT, $ne)); $oe->setLoadState(KVDthes_Term::LS_REL); $gs->setLoadState(KVDthes_Term::LS_REL); $ne->setLoadState(KVDthes_Term::LS_REL); $ke->setLoadState(KVDthes_Term::LS_REL); $transformer = new KVDthes_Serialiser_Rdf_ThesaurusSerialiser(); $transformer->addUriGenerator($this->gen); $res = $transformer->transform($oe); $this->assertInstanceOf('EasyRdf_Resource', $res); $xml = '<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:dc="http://purl.org/dc/terms/" > <skos:ConceptScheme rdf:about="http://id.vioe.be/inventaris/thesaurus/typologie"> <skos:prefLabel>Typologie Onroerend Erfgoed</skos:prefLabel> <dc:title>Typologie Onroerend Erfgoed</dc:title> <dc:language>nl-BE</dc:language> <skos:hasTopConcept rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/178" /> <skos:hasTopConcept rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/500" /> <skos:hasTopConcept rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/1024" /> </skos:ConceptScheme> </rdf:RDF>'; $ser = $transformer->serialise('rdfxml'); //$this->assertEquals( $xml, $ser ); $this->assertXmlStringEqualsXmlString($xml, $ser); }
public function testTransformGidsTerm() { $term = new KVDthes_TestTerm(100, $this->sessie, 'Kerken volgens geloof', new KVDthes_TermType('NL', 'Gidsterm'), null, 'nl-BE', null, array(), $this->thes); $term->setLoadState(KVDthes_Term::LS_NOTES); $kerken = new KVDthes_TestTerm(90, $this->sessie, 'Kerken', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $kerken->setLoadState(KVDthes_Term::LS_NOTES); $kk = new KVDthes_TestTerm(150, $this->sessie, 'Katholieke kerken', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $kk->setLoadState(KVDthes_Term::LS_NOTES); $pk = new KVDthes_TestTerm(160, $this->sessie, 'Protestantse kerken', new KVDthes_TermType('PT', 'Voorkeursterm'), null, 'nl-BE', null, array(), $this->thes); $pk->setLoadState(KVDthes_Term::LS_NOTES); $term->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_BT, $kerken)); $term->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_NT, $kk)); $term->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_NT, $pk)); $term->setLoadState(KVDthes_Term::LS_REL); $kerken->setLoadState(KVDthes_Term::LS_REL); $kk->setLoadState(KVDthes_Term::LS_REL); $pk->setLoadState(KVDthes_Term::LS_REL); $transformer = new KVDthes_Serialiser_Rdf_TermSerialiser(); $transformer->addUriGenerator($this->gen); $res = $transformer->transform($term); $xml = '<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" > <skos:Collection rdf:about="http://id.vioe.be/inventaris/thesaurus/typologie/100"> <skos:inScheme rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie" /> <skos:prefLabel>Kerken volgens geloof</skos:prefLabel> <skos:member rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/150" /> <skos:member rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/160" /> </skos:Collection> </rdf:RDF>'; $ser = $transformer->serialise('rdfxml'); $this->assertXmlStringEqualsXmlString($xml, $ser); $transformer = new KVDthes_Serialiser_Rdf_TermSerialiser(); $transformer->addUriGenerator($this->gen); $res = $transformer->transform($kk); $xml = '<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" > <skos:Concept rdf:about="http://id.vioe.be/inventaris/thesaurus/typologie/150"> <skos:inScheme rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie" /> <skos:prefLabel>Katholieke kerken</skos:prefLabel> <skos:broader rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/90"/> </skos:Concept> </rdf:RDF>'; $ser = $transformer->serialise('rdfxml'); $this->assertXmlStringEqualsXmlString($xml, $ser); $transformer = new KVDthes_Serialiser_Rdf_TermSerialiser(); $transformer->addUriGenerator($this->gen); $res = $transformer->transform($kerken); $xml = '<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" > <skos:Concept rdf:about="http://id.vioe.be/inventaris/thesaurus/typologie/90"> <skos:inScheme rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie" /> <skos:prefLabel>Kerken</skos:prefLabel> <skos:narrower rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/150"/> <skos:narrower rdf:resource="http://id.vioe.be/inventaris/thesaurus/typologie/160"/> </skos:Concept> </rdf:RDF>'; $ser = $transformer->serialise('rdfxml'); $this->assertXmlStringEqualsXmlString($xml, $ser); }
public function testLoadRelation() { $termType = new KVDthes_TermType('PT', 'voorkeursterm'); $term2 = new KVDthes_TestTerm(508, $this->sessie, 'kapellen', $termType, 'bouwkundig erfgoed'); $this->object->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_RT, $term2)); $this->object->setLoadState(KVDthes_Term::LS_REL); $this->object->setLoadState(KVDthes_Term::LS_MATCH); $term2->setLoadState(KVDthes_Term::LS_REL); $this->assertEquals(1, count($this->object->getRelations())); $this->assertEquals(1, count($term2->getRelations())); }