[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-30 Thread VladimirAlexiev
VladimirAlexiev added a comment.


  @Peb will this work in a streaming fashion? I know WD has a 60s timeout but 
still it can produce some 10-100 megabytes in that time. Will the JS approach 
be reliable enough ?
  It's also important to be able to get Turtle, using all available prefixes, 
which is a lot more readable than ntriples.
  
  I guess Blazegraph has this,  and I disagree with Lucas that the query should 
not be run a second time. If the user acted a minute later,  they would get 
that data with both approaches,  so what dors it matter if the results are a 
bit different between ui and download?

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb, VladimirAlexiev
Cc: Lucas_Werkmeister_WMDE, Peb, Smalyshev, Aklapper, VladimirAlexiev, 
darthmon_wmde, Premeditated, Ferenczy, sarhan.alaa, Samuditha24, IM3847, 
Dinadineke, Nandana, kostajh, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, 
MichaelSchoenitzer_WMDE, QZanden, EBjune, merbst, LawExplorer, Salgo60, 
Jogi_don, _jensen, rosalieper, D3r1ck01, Jonas, Xmlizer, jkroll, Wikidata-bugs, 
Jdouglas, Jdlrobson, aude, Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, 
Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-18 Thread Peb
Peb added a comment.


  ignore the previous patch, i should have used existing `_renderValueTSV` 
function. so far implemented for NTriples and JSON-LD. for JSON-LD (using 
`jsonld.js`), i need to modify the download function in the `ResultView.js` 
(the one calling handler function) to accomodate handler function returning 
Promise object instead of string.

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb
Cc: Lucas_Werkmeister_WMDE, Peb, Smalyshev, Aklapper, VladimirAlexiev, 
darthmon_wmde, alaa_wmde, Ferenczy, sarhan.alaa, Samuditha24, IM3847, 
Dinadineke, Nandana, kostajh, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, 
MichaelSchoenitzer_WMDE, QZanden, EBjune, merbst, LawExplorer, Salgo60, 
Jogi_don, _jensen, rosalieper, D3r1ck01, Jonas, Xmlizer, jkroll, Wikidata-bugs, 
Jdouglas, Jdlrobson, aude, Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, 
Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-15 Thread Peb
Peb added a comment.


  made a starting code to download as NTriples by converting from 
SPARQL-Result-JSON. 
  The JSON-LD might be quite straightforward using jsonld.js 
 `fromRdf` function given NT input
  
diff --git a/wikibase/queryService/api/Sparql.js 
b/wikibase/queryService/api/Sparql.js
index 9a4e5e1..7003587 100644
--- a/wikibase/queryService/api/Sparql.js
+++ b/wikibase/queryService/api/Sparql.js
@@ -422,6 +422,60 @@ wikibase.queryService.api.Sparql = ( function( $ ) {
};
 
/**
+* Get the result of the submitted query as N-Triples
+*
+* @return {string}
+*/
+   SELF.prototype.getResultAsNTriples = function() {
+   var output = '',
+   data = this._rawData;
+
+   output = this._processData( data, function( row, out ) {
+   var rowOut = '';
+   var rowVar = 'subject';
+   if ( ( row[rowVar] || {} ).type === 'uri' ) {
+   rowOut += '<';
+   rowOut += ( row[rowVar] || {} ).value;
+   rowOut += '> ';
+   } else if ( ( row[rowVar] || {} ).type === 'bnode' ) {
+   rowOut += '_:';
+   rowOut += ( row[rowVar] || {} ).value;
+   rowOut += ' ';
+   }
+   //predicate MUST be of type uri
+   rowVar = 'predicate';
+   rowOut += '<';
+   rowOut += ( row[rowVar] || {} ).value;
+   rowOut += '> ';
+   //object
+   rowVar = 'object';
+   if ( ( row[rowVar] || {} ).type === 'uri' ) {
+   rowOut += '<';
+   rowOut += ( row[rowVar] || {} ).value;
+   rowOut += '> ';
+   } else if ( ( row[rowVar] || {} ).type === 'literal' ) {
+   var obj = ( row[rowVar] || {} );
+   var escapedObj = JSON.stringify( String( 
obj.value ) );
+   escapedObj = escapedObj.substring( 1, 
escapedObj.length - 1 );
+   rowOut += '"';
+   rowOut += escapedObj;
+   rowOut += '"';
+   if ( 'datatype' in obj ) {
+   rowOut += '^^<';
+   rowOut += obj.datatype;
+   rowOut += '>';
+   } else if ( 'xml:lang' in obj ) {
+   rowOut += '@';
+   rowOut += obj['xml:lang'];
+   }
+   }
+   rowOut += ' .\n';
+   return out + rowOut;
+   }, output );
+   return output;
+   };
+
+   /**
 * Render value as per 
http://www.w3.org/TR/sparql11-results-csv-tsv/#tsv
 *
 * @param {Object} binding

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb
Cc: Lucas_Werkmeister_WMDE, Peb, Smalyshev, Aklapper, VladimirAlexiev, 
darthmon_wmde, alaa_wmde, Ferenczy, sarhan.alaa, Samuditha24, IM3847, 
Dinadineke, Nandana, kostajh, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, QZanden, 
EBjune, merbst, LawExplorer, Salgo60, Jogi_don, _jensen, rosalieper, D3r1ck01, 
Jonas, Xmlizer, Samwilson, jkroll, Wikidata-bugs, Jdouglas, Jdlrobson, aude, 
Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-15 Thread Smalyshev
Smalyshev added a comment.


  @Lucas_Werkmeister_WMDE this is true, though I think adding a 
button/link/some other UI to convert a query to result download wouldn't hurt 
either, with the understanding that this download makes a separate query (so 
it's distinct from downloading result of existing query). We already have 
"SPARQL result" button but it might be possible to have more result formats 
like this.

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb, Smalyshev
Cc: Lucas_Werkmeister_WMDE, Peb, Smalyshev, Aklapper, VladimirAlexiev, 
darthmon_wmde, alaa_wmde, Ferenczy, sarhan.alaa, Samuditha24, IM3847, 
Dinadineke, Nandana, kostajh, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, QZanden, 
EBjune, merbst, LawExplorer, Salgo60, Jogi_don, _jensen, rosalieper, D3r1ck01, 
Jonas, Xmlizer, Samwilson, jkroll, Wikidata-bugs, Jdouglas, Jdlrobson, aude, 
Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-15 Thread Lucas_Werkmeister_WMDE
Lucas_Werkmeister_WMDE added a comment.


  Blazegraph supports it, yes, but that’s not really useful for us, as far as I 
can tell. The download should always result in the same data that is shown to 
the user, so you can’t send the query to the server again, asking for a 
different format, and hope that it will still return the same result – you have 
to turn the results you already have client-side (originally downloaded as 
JSON) into RDF.

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb, Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Peb, Smalyshev, Aklapper, VladimirAlexiev, 
darthmon_wmde, alaa_wmde, Ferenczy, sarhan.alaa, Samuditha24, IM3847, 
Dinadineke, Nandana, kostajh, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, QZanden, 
EBjune, merbst, LawExplorer, Salgo60, Jogi_don, _jensen, rosalieper, D3r1ck01, 
Jonas, Xmlizer, Samwilson, jkroll, Wikidata-bugs, Jdouglas, Jdlrobson, aude, 
Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-05-15 Thread Peb
Peb added a comment.


  According to blazegraph documentation 
, the endpoint 
supports various formats. 
  I tried using my sparql query app  and 
all listed formats there are returned.

TASK DETAIL
  https://phabricator.wikimedia.org/T211177

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Peb
Cc: Peb, Smalyshev, Aklapper, VladimirAlexiev, darthmon_wmde, alaa_wmde, 
Ferenczy, sarhan.alaa, Samuditha24, IM3847, Dinadineke, Nandana, kostajh, 
tabish.shaikh91, Lahi, Gq86, Lucas_Werkmeister_WMDE, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, Chicocvenancio, JakeTheDeveloper, QZanden, 
EBjune, merbst, LawExplorer, Salgo60, Jogi_don, _jensen, rosalieper, D3r1ck01, 
Jonas, Xmlizer, Samwilson, jkroll, Wikidata-bugs, Jdouglas, Jdlrobson, aude, 
Tobias1984, Manybubbles, Lydia_Pintscher, TheDJ, Mbch331, Rxy
___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T211177: WDQ UI should support download of RDF formats

2019-01-03 Thread Smalyshev
Smalyshev added a comment.
It shouldn't be hard to make at least NTriples export format - basically the same as CSV/TSV but with different separators.TASK DETAILhttps://phabricator.wikimedia.org/T211177EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: SmalyshevCc: Smalyshev, Aklapper, VladimirAlexiev, Nandana, Lahi, Gq86, Lucas_Werkmeister_WMDE, GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, Salgo60, _jensen, D3r1ck01, Jonas, Xmlizer, jkroll, Wikidata-bugs, Jdouglas, aude, Tobias1984, Manybubbles, Lydia_Pintscher, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs