sage-client
Javascript/typescript client for querying a SaGe server, built on top of the sparql-engine
framework.
Installation
Requirements:
npm installation
npm install -g sage-client
Manual installation
git clone https://github.com/Callidon/sage-client.gitcd sage-clientnpm install --production
CLI Usage
Usage: sage-client <server-url> <default-graph-iri> [options]
Execute a SPARQL query using a SaGe server and the IRI of the default RDF graph
Options:
-q, --query <query> evaluates the given SPARQL query
-f, --file <file> evaluates the SPARQL query stored in the given file
-h, --help output usage information
Library usage
The SaGe client can also be used as a regular Javascript/Typescript library
const SageClient Spy = // Create a spy to collect stats during query executionconst spy = // The URL of the SaGe serverconst serverURL = 'http://sage.univ-nantes.fr/sparql'// The IRI of the default graphconst defaultGraph = 'http://sage.univ-nantes.fr/sparql/dbpedia-2016-04'// The SPARQL query to executeconst query = `prefix dbo: <http://dbpedia.org/ontology/>prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>SELECT ?movie ?title ?name WHERE { ?movie dbo:starring [ rdfs:label 'Brad Pitt'@en ]; rdfs:label ?title; dbo:director [ rdfs:label ?name ]. FILTER LANGMATCHES(LANG(?title), 'EN') FILTER LANGMATCHES(LANG(?name), 'EN')}` // Create a new SaGe clientconst client = serverURL defaultGraph spy // Execute the SPARQL queryclient