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); }
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; }
public function insertOntology($id, $options) { $valid = array('ontology_url', 'ontology_fullname', 'ontology_abbrv', 'end_point', 'ontology_graph_url', 'term_url_prefix', 'ontology_creation_digit', 'source', 'loaded'); foreach ($options as $name => $value) { if (!in_array($name, $valid)) { unset($options[$name]); } } $options['id'] = $id; $rdfFactory = new RDFStoreFactory(); $rdf = $rdfFactory->createRDFStore($options['end_point']); if ($rdf->ping()) { $this->db->insert('okw_ontology', $options); return true; } else { return false; } }