Created
March 31, 2017 18:51
-
-
Save bshambaugh/0dea15263d9b3a8f1d3c292159d96e4b to your computer and use it in GitHub Desktop.
switch between ldp - sparql - and file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select('SPARQL','http://localhost:8080/marmotta/sparql?query=SELECT%20*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20LIMIT%2010'); | |
// build a ldp request (store case LDP) | |
select('LDP','http://localhost:8080/marmotta/ldp'); | |
//load a file | |
// If it is explicity mentioned...bypass the automatic check | |
// check to see if expr is defined... | |
// else load a random uri and do an automatic function | |
// pass uri through urijs | |
// if sparql query...go to sparql | |
// if not sparql query ... pass through http.get ... | |
// if the header contains ldp/Resource ... got to LDP | |
// if the header does not contain ldp/resource ... it is a file... | |
function select(expr,url) { | |
switch (expr) { | |
case 'SPARQL': | |
// automatic: | |
// use urijs to confirm that query is not null ~/Documents/testing-urijs | |
console.log('I match a SPARQL query'+' for: '+url); | |
break; | |
case 'LDP': | |
// automatic: | |
// use requests to match the link header | |
// /var/www/html/node-arc-d3/js/tests/sparqlldpfiledisambig/ex1.js | |
console.log('I match a LDP container'+' for: '+url); | |
break; | |
default: | |
console.log('I match a file'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment