Giter VIP home page Giter VIP logo

stardog.js's Issues

Implement Query Management API

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}

Browserify CORS

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 to `getPrefixes` is returning a fixed set of namespaces

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.

Error handling

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.

Query fails if it contains Group_Concat expression with a custom separator

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> ...)'

Rollup integration

Use webpack to manage bundling, minification, and library definitions.

Can't seem to make a variable that includes bindings from an OPTIONAL clase

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)

isomorphic-fetch

Replace home rolled solution with a single library that does all of this.

No support for update queries

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.

Async: false option

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.

Normalize Create Methods

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.

CI Integration

Fogure out how to run stardog on travis so we have proper CI integration.

Breakdown code into multiple APIs

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.

Test Migration

Migrate tests to jest or similar. The current test setup is really awkward to work with.

Changelog

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.

(feature req) Specifying reasoning level per-query

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.

problem with Running Tests in the browser

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

Use POST instead of GET for SPARQL queries

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.

Better error reporting & exception handling

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)

Lodash

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')

Named parameters object?

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) {});

Typedefs

Add TypScript definitions. Only the defs though, TypeScript would be overkill here.

CORS question

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.

Create Sync version of API calls

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.