├── _config.yml ├── package.json ├── LICENSE ├── fiddles.ttl ├── index.html ├── README.md └── sparql-fiddle.js /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sparql-fiddle", 3 | "version": "0.1.0", 4 | "description": "run SPARQL queries online and off using rdflib.js", 5 | "main": "sparql-fiddle.js", 6 | "dependencies": { 7 | "rdflib": "^0.19.1" 8 | }, 9 | "devDependencies": {}, 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "keywords": [ 14 | "solid", 15 | "linked-data" 16 | ], 17 | "author": "Jeff Zucker", 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jeff Zucker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /fiddles.ttl: -------------------------------------------------------------------------------- 1 | @prefix : <#>. 2 | @prefix schema: . 3 | 4 | <> a :FiddleLibrary. 5 | [] 6 | a :Fiddle; 7 | :name "hello world"; 8 | :dataFormat "text/turtle"; 9 | :data """@prefix s: . <> s:name "hello world"."""; 10 | :query "PREFIX s: SELECT ?msg WHERE {?x s:name ?msg.}" 11 | . 12 | [] 13 | a :Fiddle; 14 | :name "show all examples"; 15 | :dataFormat "text/turtle"; 16 | :data "http://localhost/solid/sparql-fiddle/fiddles.ttl"; 17 | :query """ 18 | PREFIX : 19 | SELECT ?name ?format ?data ?query WHERE { 20 | ?x :name ?name; :dataFormat ?format; :data ?data; :query ?query . 21 | } 22 | """ 23 | . 24 | [] 25 | a :Fiddle; 26 | :name "show all triples"; 27 | :query "SELECT * WHERE { ?subject ?predicate ?object . }"; 28 | :dataFormat "text/turtle"; 29 | :data """ 30 | @prefix s: . 31 | <> a s:MusicPlaylist; 32 | s:name "Jazz"; 33 | s:track 34 | [s:name "A Love Supreme"; s:creator "John Coltrane"], 35 | [s:name "Take Five"; s:creator "Dave Brubeck"] 36 | . 37 | """ 38 | . 39 | [] 40 | a :Fiddle; 41 | :name "no ontology"; 42 | :dataFormat "text/turtle"; 43 | :data """ 44 | @prefix : <#>. 45 | <> :isA :Foo; :hasBar 46 | [:madeUpProperty "Look, Ma - no ontology!"] 47 | . 48 | """; 49 | :query """ 50 | # this prefix declaration is invalid SPARQL but 51 | # lets us refer to the in-memory RDF and work without 52 | # an ontology - bad practice in general but good for 53 | # rapid prototyping. 54 | 55 | PREFIX : <#> 56 | SELECT ?message WHERE { 57 | ?thing :isA :Foo; :hasBar ?x . 58 | ?x :madeUpProperty ?message . 59 | } 60 | """ 61 | . 62 | [] 63 | a :Fiddle; 64 | :name "find tracks in a playlist"; 65 | :dataFormat "text/turtle"; 66 | :data """ 67 | @prefix s: . 68 | <> a s:MusicPlaylist; 69 | s:name "Jazz"; 70 | s:track 71 | [s:name "A Love Supreme"; s:creator "John Coltrane"], 72 | [s:name "Take Five"; s:creator "Dave Brubeck"] 73 | . 74 | """; 75 | :query """ 76 | PREFIX s: 77 | SELECT ?artist ?trackName WHERE { 78 | ?x s:track ?y . 79 | ?y s:name ?trackName; s:creator ?artist . 80 | } 81 | """; 82 | . 83 | 84 | 85 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | SPARQL Fiddle 3 | 4 | 5 | 6 | 7 | 8 | 9 | RDF format : 10 | Turtle 11 | N3 12 | RDF/XML 13 | 14 | 15 | run 16 | clear 17 | 18 | examples 19 | hello world 20 | find tracks in a playlist 21 | show all triples 22 | no ontology 23 | 24 | visit the code repo 25 | 26 | 27 | 28 | 29 | Endpoint : enter RDF text or import 30 | 31 | 32 | 33 | 34 | 35 | Query : enter SPARQL text or import 36 | 37 | 38 | 39 | 40 | 100 | 149 |