[Mediawiki-l] Ontology import

Mei Wu mwu.mailbox at gmail.com
Sun Jul 16 01:11:45 UTC 2006


Hi all!

I am trying to import Ontologies into Mediawiki. I downloaded a couple of
ontologies from the web in .rdf format and imported them using the "Import
ontologies" Special page. However, every time I hit Import an error message
appears (see below).
I am running MediaWiki 1.6.7 and SemanticMediaWiki extension 0.4.3.2. I also
added the rdfapi-php to the SemanticMediaWiki "libs" folder. It looks like
the .php script is not recognized but I do not really know what the problem
is.

Does anybody has experiences with importing ontologies and have an idea what
the cause of this problem might be?

Thank you very much!

Best,
Mei

------------------error
message------------------------------------------------------------------------------

* * @package sparql */ class SparqlClient extends Object { var $server; var
$output; /** * Constructor of SparlClient. * * @param String $server server
address. */ function SparqlClient($server){ $this->server = $server;
$this->output = "array"; } /** * Sets the output format for a SELECT or ASK
query. Possible formats are "xml" for * Sparql Query Results XML Format (
http://www.w3.org/TR/rdf-sparql-XMLres/) or array * for the format described
in our SparqlEngine. * * @param String $format the format. */ function
setOutputFormat($format){ if(strtolower($format)=="xml") $this->output =
"xml"; if(strtolower($format)=="array") $this->output = "array"; } /** *
Main function of SparqlClient. * * @param ClientQuery $query the ClientQuery
object. * @return mixed returns an array that contains the variables an
their bindings or a MemModel * */ function query($query){
if(!is_a($query,"ClientQuery")) die;//ErrorHandling $url =
$this->_buildurl($query); $result = $this->_http_get($url); return
$this->returnResult($result); } /** * Helper function that builds the url. *
* @param ClientQuery $query the ClientQuery Object. */ function
_buildurl($query){ $url = ""; $url =
$this->server."?query=".urlencode($query->query); foreach($query->default as
$defaultg){ $url = $url."&default-graph-uri=".$defaultg; }
foreach($query->named as $namedg){ $url = $url."&named-graph-uri=".$namedg;
} return $url; } /** * Returns the query result. * * @param String $result
the result. * @return mixed */ function returnResult($result){
if(strpos($result,"generateModel(substr($result,strpos($result,"output ==
"xml"){ $pos = strpos($result,"output == "array"){ // $pos =
strpos($buffer,"parseResult($result); } return $result; } function
parseResult($buffer){ include(RDFAPI_INCLUDE_DIR.PACKAGE_SYNTAX_SPARQLRES);
$parser = new SparqlResultParser(); return $parser->parse($buffer); } /** *
Executes the GET Request. * * @param String $url the url. * @return String
result. */ function _http_get($url) { $url = parse_url($url); $port =
isset($url['port']) ? $url['port'] : 80; $fp = fsockopen($url['host'],
$port); $replace = $url['path']; fputs($fp, "GET
".$replace."?".$url['query']." HTTP/1.0\n"); fputs($fp, "Host:".
$url['host']." \r\n"); fputs($fp, "Accept: text/html \r\n"); fputs($fp,
"Connection: close\n\n"); $buffer = ""; while ($tmp = fread($fp, 1024)) {
$buffer .= $tmp; } // return $buffer; $pos = strpos($buffer," * * @package
sparql */ class ClientQuery extends Object { var $default = array(); var
$named = array(); var $prefixes = array(); var $query; /** * Adds a default
graph to the query object. * * @param String $default default graph name */
function addDefaultGraph($default){ if(!in_array($named,$this->default))
$this->default[] = $default; } /** * Adds a named graph to the query object.
* * @param String $default named graph name */ function
addNamedGraph($named){ if(!in_array($named,$this->named)) $this->named[] =
$named; } /** * Adds the SPARQL query string to the query object. * * @param
String $query the query string */ function query($query){ $this->query =
$query; } } ?>
---------------------------------------------------------------------------------------------------------------------------end
error message---------------------------------



More information about the MediaWiki-l mailing list