/** * Constructor * * @return ARS_Mapper */ private function __construct() { // get all loomp vocabularies and add their annotations $loompApi = new LoompApi(); $vocabList = $loompApi->getVocabularies(); $vocabs = array(); foreach ($vocabList as $vocab) { $vocabs[] = $loompApi->getVocabulary($vocab['ID']); } $this->_addAllAnnotations($vocabs); // get the registry $arsConfig = Zend_Registry::get('arsConfig'); // include the ARC2 class file $arc2FilePath = $arsConfig->mapper->arc2->filePath; if ($arsConfig->mapper->arc2->relativeToMapper) { if ('/' != $arc2FilePath[0]) { $arc2FilePath = '/' . $arc2FilePath; } $arc2FilePath = dirname(__FILE__) . $arc2FilePath; } /** * @see ARC2 */ require_once $arc2FilePath; // get the file path of the mappings file $mappingsFilePath = $arsConfig->mapper->mappingsRDF->filePath; if ($arsConfig->mapper->mappingsRDF->relativeToMapper) { if ('/' != $mappingsFilePath[0]) { $mappingsFilePath = '/' . $mappingsFilePath; } $mappingsFilePath = dirname(__FILE__) . $mappingsFilePath; } // get the file path of the seeAlso mappings file $seeAlsoMappingsFilePath = $arsConfig->mapper->seeAlsoMappingsRDF->filePath; if ($arsConfig->mapper->seeAlsoMappingsRDF->relativeToMapper) { if ('/' != $seeAlsoMappingsFilePath[0]) { $seeAlsoMappingsFilePath = '/' . $seeAlsoMappingsFilePath; } $seeAlsoMappingsFilePath = dirname(__FILE__) . $seeAlsoMappingsFilePath; } // get RDF parser $parser = ARC2::getRDFParser(); // handle the simple index for the mappings file $parser->parse($mappingsFilePath); $simpleIndex = $parser->getSimpleIndex(); $this->_addAllMappings($simpleIndex); // handle the simple index for the seeAlso mappings file $parser->parse($seeAlsoMappingsFilePath); $simpleIndex = $parser->getSimpleIndex(); $this->_addAllSeeAlsoMappings($simpleIndex); return $this; }
/** * Constructor * * @param string $text * The text from which annotations has to be extracted. * @return ARS_AnnotationExtractor */ public function __construct($text) { // get all loomp vocabularies and add their annotations $loompApi = new LoompApi(); $vocabList = $loompApi->getVocabularies(); $vocabs = array(); foreach ($vocabList as $vocab) { $vocabs[] = $loompApi->getVocabulary($vocab['ID']); } $this->_addAllAnnotations($vocabs); // extract the annotations contained within the text $this->_extractAnnotations($text); return $this; }
// loomp vocabulary class require_once './../LOOMP_C.php'; // --------------- require_once "./../api.php"; require_once "./../mashup.php"; require_once "./../fragment.php"; require_once "./../vocabulary.php"; require_once "./../annotation.php"; /* $folder=dir("./../../../application/annotations/"); while($folderEntry=$folder->read()){ echo $folderEntry."<br>"; } $folder->close(); */ $api = new LoompApi(); $v = $api->getVocabularies("de"); foreach ($v as $vo) { foreach ($vo as $k => $voo) { echo $k . " " . $voo . "<br>"; } } $vs = $api->getVocabulary("geo.rdf"); $vs->_htmlOutput(); /* foreach ($v->getAnnotations() as $ann) { $ann->_htmlOutput(); } */