Exemplo n.º 1
0
 public function __construct($ontAbbr)
 {
     $sql = new SQLStore(wfGetDB(DB_SLAVE));
     $sqlResult = $sql->getOntologyAttributes($ontAbbr, array('end_point', 'ontology_graph_url', 'term_url_prefix', 'ontology_creation_digit'));
     $this->ontAbbr = $ontAbbr;
     $this->endpoint = $sqlResult->end_point;
     $this->graph = $sqlResult->ontology_graph_url;
     $this->prefix = $sqlResult->term_url_prefix;
     $this->digit = intval($sqlResult->ontology_creation_digit);
     $this->prefixNS = $GLOBALS['okwRDFConfig']['prefixNS'];
     $rdfFactory = new RDFStoreFactory();
     $this->rdf = $rdfFactory->createRDFStore($sqlResult->end_point);
 }
Exemplo n.º 2
0
 public static function isExistTitleText($title)
 {
     if (Title::newFromText($title)->exists() && self::isValidTitleText($title)) {
         $title = explode(':', $title);
         $ontAbbr = $title[0];
         $sql = new SQLStore(wfGetDB(DB_SLAVE));
         if ($sql->hasOntology($ontAbbr)) {
             $sqlResult = $sql->getOntologyAttributes($ontAbbr, array('end_point', 'ontology_graph_url', 'term_url_prefix'));
             $endpoint = $sqlResult->end_point;
             $graph = $sqlResult->ontology_graph_url;
             $prefix = $sqlResult->term_url_prefix;
             $term = $prefix . str_replace(' ', '_', $title[1]);
             $rdfFactory = new RDFStoreFactory();
             $rdf = $rdfFactory->createRDFStore($sqlResult->end_point);
             if ($rdf->existClass($graph, $term)) {
                 return true;
             }
         }
     }
     return false;
 }