diff --git a/classes/RDFIO_SMWPageWriter.php b/classes/RDFIO_SMWPageWriter.php index 2f98a61..17a5094 100644 --- a/classes/RDFIO_SMWPageWriter.php +++ b/classes/RDFIO_SMWPageWriter.php @@ -96,7 +96,7 @@ public function import( $wikiPages ) { // 11. If neither of 8-10 was done, add as new fact statements // ---------------------------------------------------------------------- $prop = $fact['p']; - if ( !array_key_exists( $prop, $oldFacts ) && !( $propTplIndex[$prop] ) ) { + if ( !array_key_exists( $prop.$fact['o'], $oldFacts ) && !( $propTplIndex[$prop] ) ) { $wikiTextUpdated = $this->addNewExplicitFact( $fact, $wikiTextUpdated ); } @@ -253,7 +253,11 @@ private function extractFacts( $wikiContent ) { $propName = $matches[1]; $propVal = $matches[2]; foreach ( $propName as $idx => $pName ) { - $facts[$pName] = array( 'property' => $pName, 'value' => $propVal[$idx], 'wikitext' => $wikiText[$idx] ); + $facts[$pName.$propVal[$idx]] = array( + 'property' => $pName, + 'value' => $propVal[$idx], + 'wikitext' => $wikiText[$idx] + ); } return $facts; } diff --git a/classes/RDFIO_WikiPage.php b/classes/RDFIO_WikiPage.php index e605d54..aea8d71 100644 --- a/classes/RDFIO_WikiPage.php +++ b/classes/RDFIO_WikiPage.php @@ -28,7 +28,10 @@ public function addEquivalentURI( $equivURI ) { public function addFact( $fact ) { if ( !is_null( $fact ) ) { - $this->factIndex[$fact['p']] = $fact['o']; + $this->factIndex[$fact['p'].$fact['o']] = array( + 'p' => $fact['p'], + 'o' => $fact['o'] + ); } } @@ -79,8 +82,8 @@ public function getEquivalentUris() { public function getFacts() { $facts = array(); - foreach( $this->factIndex as $prop => $obj ) { - $facts[] = array( 'p' => $prop, 'o' => $obj ); + foreach( $this->factIndex as $str_po => $arr_po ) { + $facts[] = array( 'p' => $arr_po['p'], 'o' => $arr_po['o'] ); } return $facts; } @@ -108,4 +111,3 @@ private function categoryExists( $category ) { return in_array( $category, $this->categories ); } } - diff --git a/specials/SpecialSPARQLEndpoint.php b/specials/SpecialSPARQLEndpoint.php index 6dda630..ad18632 100644 --- a/specials/SpecialSPARQLEndpoint.php +++ b/specials/SpecialSPARQLEndpoint.php @@ -88,9 +88,17 @@ private function executeReadOnlyQuery( $options ) { if ( $options->queryType == 'select' ) { if ( in_array( $options->outputType, array( 'rdfxml' ) ) ) { - $this->errorMsg( wfMessage( 'rdfio-error-invalid-output-for-select' )->parse() ); - $this->printHTMLForm( $options ); - return; + $ser = ARC2::getRDFXMLSerializer(); + $array = unserialize( $outputSer ); + + $rdf = $ser->getSerializedTriples($array{'result'}{'rows'}); + if ( $ser->getErrors() ) { + $this->error("Exited RDF Export script due to previous errors:\n" . implode("\n", $ser->getErrors() ), 1 ); + exit; + } + $this->prepareCreatingDownloadableFile( $options ); + echo $rdf; + exit; } if ( $options->outputType == 'htmltab' ) {