@@ -87,7 +87,7 @@ private function executeReadOnlyQuery( $options ) {
8787 }
8888
8989 if ( $ options ->queryType == 'select ' ) {
90- if ( $ options ->outputType == 'rdfxml ' ) {
90+ if ( in_array ( $ options ->outputType , array ( 'rdfxml ' ) ) ) {
9191 $ this ->errorMsg ( wfMessage ( 'rdfio-error-invalid-output-for-select ' )->parse () );
9292 $ this ->printHTMLForm ( $ options );
9393 return ;
@@ -108,26 +108,25 @@ private function executeReadOnlyQuery( $options ) {
108108 }
109109
110110 if ( $ options ->queryType == 'construct ' ) {
111- if ( $ options ->outputType == 'rdfxml ' ) {
112- // Here the results should be RDF/XML triples,
113- // not just plain XML SPARQL result set
114- $ tripleindex = $ outputArr ['result ' ];
115-
116- $ arc2 = new ARC2_Class ( array (), $ this );
117- $ triples = $ arc2 ->toTriples ( $ tripleindex );
111+ if ( $ options ->outputType !== 'turtle ' ) {
112+ // Falling back on using RDF/XML as default
113+ $ options ->outputType = 'rdfxml ' ;
114+ }
118115
119- if ( $ options -> outputEquivUris ) {
120- $ triples = $ this -> storewrapper -> toEquivUrisInTriples ( $ triples );
121- }
116+ // Here the results should be RDF/XML triples,
117+ // not just plain XML SPARQL result set
118+ $ tripleindex = $ outputArr [ ' result ' ];
122119
123- $ this ->prepareCreatingDownloadableFile ( $ options );
124- // Using echo instead of $wgOut->addHTML() here, since output format is not HTML
125- echo $ this ->triplesToRDFXML ( $ triples );
126- return ;
120+ $ arc2 = new ARC2_Class ( array (), $ this );
121+ $ triples = $ arc2 ->toTriples ( $ tripleindex );
127122
123+ if ( $ options ->outputEquivUris ) {
124+ $ triples = $ this ->storewrapper ->toEquivUrisInTriples ( $ triples );
128125 }
129- $ this ->errorMsg ( wfMessage ( 'rdfio-error-invalid-output-for-construct ' )->parse () );
130- $ this ->printHTMLForm ( $ options );
126+
127+ $ this ->prepareCreatingDownloadableFile ( $ options );
128+ // Using echo instead of $wgOut->addHTML() here, since output format is not HTML
129+ echo $ this ->triplesToRDFXML ( $ triples );
131130 return ;
132131 }
133132 }
@@ -434,6 +433,7 @@ private function getHTMLForm( $query = '' ) {
434433 $ chkFilterVocab = $ wRequest ->getBool ( 'filtervocab ' , false ) == 1 ? ' checked="true" ' : '' ;
435434 $ selOutputHTML = $ wRequest ->getText ( 'output ' , '' ) == 'htmltab ' ? ' selected="selected" ' : '' ;
436435 $ selOutputRDFXML = $ wRequest ->getText ( 'output ' , '' ) == 'rdfxml ' ? ' selected="selected" ' : '' ;
436+ //$selOutputTurtle = $wRequest->getText( 'output', '' ) == 'turtle' ? ' selected="selected" ' : '';
437437
438438 // Make the HTML format selected by default
439439 if ( $ selOutputRDFXML == '' ) {
@@ -472,10 +472,10 @@ private function getHTMLForm( $query = '' ) {
472472 <!-- <option value="json" >JSON</option> -->
473473 <!-- <option value="plain" >Plain</option> -->
474474 <!-- <option value="php_ser" >Serialized PHP</option> -->
475- <!-- <option value="turtle" >Turtle</option> -->
476475 <option value="htmltab" ' . $ selOutputHTML . '>HTML</option>
477476 <option value="sparqlresult" >SPARQL Resultset (XML)</option>
478477 <option value="rdfxml" ' . $ selOutputRDFXML . '>RDF/XML</option>
478+ <!-- option value="turtle" >Turtle</option -->
479479 <!-- <option value="infos" >Query Structure</option> -->
480480 <!-- <option value="tsv" >TSV</option> -->
481481 </select>
0 commit comments