Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions classes/RDFIO_SMWPageWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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;
}
Expand Down
10 changes: 6 additions & 4 deletions classes/RDFIO_WikiPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@

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']
);
}
}

Expand Down Expand Up @@ -79,8 +82,8 @@

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 ) {

Check warning on line 85 in classes/RDFIO_WikiPage.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

classes/RDFIO_WikiPage.php#L85

Avoid unused local variables such as '$str_po'.
$facts[] = array( 'p' => $arr_po['p'], 'o' => $arr_po['o'] );
}
return $facts;
}
Expand Down Expand Up @@ -108,4 +111,3 @@
return in_array( $category, $this->categories );
}
}

14 changes: 11 additions & 3 deletions specials/SpecialSPARQLEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@

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;

Check warning on line 97 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L97

The method executeReadOnlyQuery() contains an exit expression.

Check failure on line 97 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L97

Use of exit language construct is discouraged.

Check failure on line 97 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L97

Use of exit language construct is discouraged.
}
$this->prepareCreatingDownloadableFile( $options );
echo $rdf;

Check failure on line 100 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L100

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$rdf'.

Check failure on line 100 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L100

Use of echo language construct is discouraged.

Check failure on line 100 in specials/SpecialSPARQLEndpoint.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

specials/SpecialSPARQLEndpoint.php#L100

Use of echo language construct is discouraged.
exit;
}

if ( $options->outputType == 'htmltab' ) {
Expand Down