query($q); if (!$s->getErrors()) { $index_returned_query_type = [ 'construct', 'describe' ]; $result = (in_array($rs['query_type'], $index_returned_query_type)) ? $rs : $rs['result']['rows']; if ($vd) var_dump($result); return $result; } else { var_dump($s->getErrors()); exit(); } } $config = array( 'db_host' => 'localhost', 'db_name' => $infos['db_name'], 'db_user' => $infos['db_user'], 'db_pwd' => $infos['db_pwd'], 'store_name' => $infos['store_name'], 'max_errors' => 1, 'store_write_buffer' => 40000 ); /* namespace prefixes */ $ns = array( 'ecrm' => 'http://erlangen-crm.org/current/', 'geo' => 'http://www.opengis.net/ont/geosparql#', 'owl' => 'http://www.w3.org/2002/07/owl#', 'qdmtl' => 'http://onto.qdmtl.ca/', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'rico' => 'https://www.ica.org/standards/RiC/ontology#' ); $ns_config = array('ns' => $ns); /* instantiation */ $store = ARC2::getStore($config); $ser = ARC2::getRDFXMLSerializer($ns_config); // $store->createDBCon(); if (!$store->isSetUp()) { $store->setUp(); } $path = $_GET["path"]; // vérifier si objet de owl:sameAs pour traduction $q = ' PREFIX owl: PREFIX qdmtld: SELECT ?s WHERE { ?s owl:sameAs qdmtld:' . $path . ' . } '; $has_sameAs = use_path_to_query($q, $store); preg_match('/[A-Z][a-z]+\/(.+)/', $path, $chunked_path); foreach ($has_sameAs as $sameAs) { preg_match('/http:\/\/data\.qdmtl\.ca\/([A-Z][a-z]+\/)(.+)/', $sameAs['s'], $chunked_uri_path); if ($chunked_path[1] == $chunked_uri_path[2]) $path = $chunked_uri_path[1] . $chunked_uri_path[2]; } $q = ' PREFIX qdmtld: DESCRIBE qdmtld:' . $path ; $triples = use_path_to_query($q, $store); $doc = $ser->getSerializedIndex($triples['result']); header('Content-type: text/xml'); echo $doc; ?>