stardog-union / stardog.js Goto Github PK
View Code? Open in Web Editor NEWStardog JavaScript Framework for node.js and the browser
Home Page: https://github.com/stardog-union/stardog.js
License: Other
Stardog JavaScript Framework for node.js and the browser
Home Page: https://github.com/stardog-union/stardog.js
License: Other
Implement the calls for the Query Management API in Stardog.
Calls to:
Get all queries running: GET /admin/queries
Get specific query information GET /admin/queries/{query}
Kill a query: DELETE /admin/queries/{query}
Given the latest contributions by @laczoka we should add docs on how to use stardog.js in the browser, maybe a section in the README.md
There aren't any test case for ICV, create some tests.
Hi, I have a problem with running tests on windows.
Here is the branch:
https://github.com/BeArnis/stardog.js/tree/windows-8.1-tests
when I open it in chrome it says 'Uncaught TypeError: Cannot call method 'getEnv' of undefined'.
Any idea how to fix this problem?
Just put the API in the README.md
Reading the doc in http://clarkparsia.github.io/stardog.js/
There was "stardog-admin server start --http 5823"
In the newest version using http it did not work,
changing it to "stardog-admin server start --port 5823" everything went on going fine.
Hi. I found problem. I have project on node.js. I'am use browserify to run app in browser.
When I try to integrate stardog.js to my project, and run browserify, i get CORS error in browser.
In my app.js in browser this code returned 'true'!:
var isNode = (typeof exports !== "undefined" && typeof module !== "undefined" && module.exports);
If set isNode to FALSE, this worked for me. Is there no other way to check isNode? Sorry for my bad english.
Call getPrefixes
should return the namespaces defined for the database. Even though that information is already covered with the getDBOptions
call by requesting the database.namespaces
option, getPrefixes
should be a shortcut for this information since it can be considered a common task.
Document JS code with JSDoc or other type of documentation tool.
A call to create DBs is missing within the HTTP Admin functions.
Right now, this module isn't following the convention of error first callback. This puts the burden of determining an error on the client rather than the library.
Missing a few features that have been added lately, stardocs, virtual graphs, stored queries
I can't get results for queries that contain a Group_Concat with a custom separator. It seems that the ';', which is required before a custom separator, is being interpreted as EOF.
For example, the following query works fine:
'select ?s (Group_Concat(?o) as ?o_s) where { ?s <#name> ?o } group by ?s'
But if I add a custom seperator, e.g.
'select ?s (Group_Concat(?o ; separator=",") as ?o_s) where { ?s <#name> ?o } group by ?s'
it fails with the following:
'POST http://localhost:5820/testDB/query?reasoning=NONE 400 (Encountered "<EOF>" at line 1, column 29. Was expecting one of: ")" ... ";" ... "=" ... "!=" ... ">" ... "<" ... "<=" ... ">=" ... "||" ... "&&" ... "+" ... "-" ... "*" ... "/" ... "in" ... "not in" ... <INTEGER_POSITIVE> ... <INTEGER_NEGATIVE> ... <DECIMAL_POSITIVE> ... <DECIMAL_NEGATIVE> ... <DOUBLE_POSITIVE> ... <DOUBLE_NEGATIVE> ...)'
Discontinue bower publishing.
Use webpack to manage bundling, minification, and library definitions.
conn.query({
database: proj,
query:select ?uri ?ID ?typeID ?topNode ?multiID \ where { \ ?uri a ?type. \ ?uri ccs:singleLevelID ?ID . \ OPTIONAL {?uri ifcowl:objectType_IfcObject/express:hasString ?type2 .} \ OPTIONAL {?uri ccs:typeID ?typeID .} \ OPTIONAL {?uri ccs:topNode ?topNode .} \ OPTIONAL {?uri ccs:multiLevelID ?multiID .} \ }
}, function (data) {
console.log(data.results.bindings);
for (var i in data.results.bindings) {
var uriV = data.results.bindings[i].uri.value;
var topnode = data.results.bindings[i].topNode.value;
var singleID = data.results.bindings[i].ID.value;
var TypeID = data.results.bindings[i].typeID.value;
}
Error I get :
/home/ubuntu/workspace/server/mhra.js:123
var TypeID = data.results.bindings[i].typeID.value;
^
TypeError: Cannot read property 'value' of undefined
at /home/ubuntu/workspace/server/mhra.js:123:61
at Request.fnResponseHandler (/home/ubuntu/workspace/server/node_modules/stardog/js/stardog.js:186:21)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request._fireSuccess (/home/ubuntu/workspace/server/node_modules/restler/lib/restler.js:226:10)
at /home/ubuntu/workspace/server/node_modules/restler/lib/restler.js:158:20
at Request._encode (/home/ubuntu/workspace/server/node_modules/restler/lib/restler.js:197:9)
at /home/ubuntu/workspace/server/node_modules/restler/lib/restler.js:154:16
at Gunzip.onEnd (zlib.js:213:5)
at emitNone (events.js:91:20)
Support all the library functionality in mayor web browsers
Replace home rolled solution with a single library that does all of this.
As far as I can see there is no support for these verbs i.e. insert (data) and delete (data), which require /update instead of /query in the URL.
stardog.js should be able to make synchronous calls by passing an async: false
option to any of its functions.
Perhaps it makes sense to pass other options for ajax calls in the browser.
Set up prettier to run.
Some methods like creating a user takes "username" and "password" but creating a role takes "name" instead. We should standardize on "name" because the fact that it's a username is implied by the fact that you're creating a user.
Hi, i have as test that does not seem to work.
Here is the the test repository:
https://github.com/BeArnis/stardog_simple_test
running it in chrome I get
OPTIONS http://localhost:5820/myDB2/query?query=select+distinct+%3Fs+where+%7B+%3Fs+%3Fp+%3Fo+%7D&limit=10 401 (Unauthorized)
The user and password are both on 'admin'
Could you suggest something?
Fogure out how to run stardog on travis so we have proper CI integration.
Stardog.js is now big enough to be broken into multiple modules, each module representing a set of API calls in Stardog and other features, helping with maintainability and code readability.
Get the tests working by reading and sending actual file contents.
Migrate tests to jest or similar. The current test setup is really awkward to work with.
LinkedJson is a wrapper of a JSON that follows the JSON-LD format, we could build into it all the JSON-LD processor calls to get that unified.
Once 1.0 is ready, remove "develop" branch and just user master.
Either remove the changelog or automate it. I personally don't find much value in it but I'm open to community feedback on it.
Currently the automated tests are only for node.js. We need a way to automate them so we can test the jquery bits.
Works:
conn.setEndpoint('http://127.0.0.1:5822/');
Does not work:
conn.setEndpoint('http://127.0.0.1:5822');
The second, with no trailing /, causes a connection error.
Suggestion, something like:
Connection.prototype.setEndpoint(endpoint){
if (endpoint.substring(e.length -1) != '/') endpoint = endpoint + '/';
Document this in the project readme.
I think it would be useful to be able to specify the reasoning level to be used per query, i.e. as an option for Connection.query(), as opposed to having to apply it to the whole Connection object.
downloading stardog.js and running it it complains that can not access underscore-min in '../bower_components/underscore/underscore-min'
in that folder there is only underscore.js
even if in SpecRunner.js I charge the path to '../bower_components/underscore/underscore' the programme still does not recognize getEnv in the browser,
as 'Uncaught TypeError: Cannot call method 'getEnv' of undefined'.
When I run bower list it returns
jasmine#2.0.0
jquery#1.10.1 (latest is 2.1.0)
underscore#1.6.0
Documentation links are broken.
The query and queryGraph methods currently use HTTP GET requests, with the SPARQL query in the query string. This means long queries will result in long query strings, which don't play well if the queries are too long (~2900 bytes in my experience).
I suggest that the methods be modified so that the queries are requested using HTTP POST, as described in the SPARQL protocol spec. The query string parameters can just be used as form data.
Need to revise and improve error reporting in callbacks as well as exception handling in all Stardog.js functions.
Error reporting in callbacks should follow the common JS style as:
function cb (err, result)
Reduce or remove reliance on lodash.
If we do keep it, require sub-modules rather than the entire lib
const _ = require('lodash')
vs
const get = require('lodash/get')
A new version of the Stardog CLI is coming with new commands & structures. We need to update the load_test_data.sh script when new CLI is released.
This should make stardog.js more flexible to work with other frameworks.
Both the annotated source and the HTTP Programming links 404.
What about making the function parameters a named object?
So instead of:
conn.query("db-name",
"select distinct * where { ?s ?p ?o } limit 5",
null, 5, 0, function (data) {});
you get:
conn.query('db-name', {query: 'select distinct * where { ?s ?p ?o} limit 5',
baseURI: null,
limit: 5,
offset: 0}, function cb(data){});
which is self-documenting, and collapses to:
conn.query('db-name', {query: 'select distinct * where { ?s ?p ?o} limit 5',
limit: 5}, function cb(data){});
since baseURI and offset are not required, they don't need to be set.
Code samples can look like this:
var query = {},
query.query = "select distinct * where { ?s ?p ?o} limit 5",
query.limit = 5;
conn.query("db-name", query, function cb(data) {});
Add TypScript definitions. Only the defs though, TypeScript would be overkill here.
Currently there's no way to indicate a query to run with reasoning enabled.
Hi all.
How to work correctly with CORS?
var conn = new stardog.Connection();
conn.setEndpoint("http://localhost:5820/");
conn.setCredentials("anonymous", "anonymous");
conn.query({
database: "test",
query: "select ?s { ?s ?p ?o }"
},
function (data) {
console.log(data.results.bindings);
});
This code not work for me.
I'm use browserify and stardog server at localhost:5820.
Sometimes there's a need to execute the calls in a Sync fashion, we could provide the Sync version of every method in stardog.Connection
.
Connection.prototype._httpRequest is missing acceptH parameter, hence broken
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.