You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the loaders it would be possible to offer many different ways to implement operations. If we have to many options, developers get lost in choosing the right option and each framework needs time for the implementation and maintenance. There are two options which should cover a broad range of use cases.
SPARQL View
A SPARQL View is close to SPARQL, hides the express middleware stuff, but still allows using JavaScript to handle incoming data. Frameworks like clownface might be useful to handle incoming graph data. It's a quick solution for small APIs. The SPARQL View middleware already takes care of the request and response handling. The developer only needs to implement a JavaScript module that returns a SPARQL query string.
Example:
module.exports=()=>{return`SELECT * WHERE { ... }`}
Plain JS
Plain JS gives full access to the express middleware stuff, but other middlewares, that handle the request before it arrives at the Plain JS code, extend the req with some useful variables and functions that makes SPARQL queries almost as simple as with the SPARQL View.
SPARQL View example in Plain JS:
module.exports=(req,res)=>{res.dataset(awaitreq.sparqlClient.construct(`SELECT * WHERE { ... }`))}
More complex example:
module.exports=(req,res)=>{req.pipe(fs.createWriteStream('upload.txt'))req.sparqlClient.update(`INSERT DATA { ... }`)res.status(204).end()}
The text was updated successfully, but these errors were encountered:
With the loaders it would be possible to offer many different ways to implement operations. If we have to many options, developers get lost in choosing the right option and each framework needs time for the implementation and maintenance. There are two options which should cover a broad range of use cases.
SPARQL View
A SPARQL View is close to SPARQL, hides the express middleware stuff, but still allows using JavaScript to handle incoming data. Frameworks like clownface might be useful to handle incoming graph data. It's a quick solution for small APIs. The SPARQL View middleware already takes care of the request and response handling. The developer only needs to implement a JavaScript module that returns a SPARQL query string.
Example:
Plain JS
Plain JS gives full access to the express middleware stuff, but other middlewares, that handle the request before it arrives at the Plain JS code, extend the
req
with some useful variables and functions that makes SPARQL queries almost as simple as with the SPARQL View.SPARQL View example in Plain JS:
More complex example:
The text was updated successfully, but these errors were encountered: