Comments (5)
Good find. The documentation mentions both triple and quad forms for this query. I think this is a bug indeed, or a client issue. For others seeing this later, check the documentation and use the quad style for now, but there are situations where there are many operations in the schema that really needs the from
style!
Great catch @alexander-mart
from terminusdb.
This is a client bug, the generated JSON is:
{"@type":"Limit","limit":10,
"query":{"@type":"And",
"and":[{"@type":"From"},
{"@type":"Triple",
"subject":{"@type":"NodeValue","variable":"cls"},
"predicate":{"@type":"NodeValue","node":"rdf:type"},
"object":{"@type":"Value","node":"sys:Class"}}]}}
Fluent syntax apparently does not work here, You can use the two argument call to from for now, and we can fix the documentation, but it would probably be nice if the fluent syntax worked to generate the right code here.
from terminusdb.
I'd like to just check my understanding so that I interpret the fluent style correctly, the fluent style continuation is from my understanding always an extra appended parameter to the argument list? I was thinking about this for the WOQL-TS client and what was the correct interpretation.
Should thus the below be what should be in the doc link?
let v = Vars("cls");
from("schema", WOQL.triple(v.cls, "rdf:type", "sys:Class"))
With triple being the last argument of from()
from terminusdb.
With triple being the last argument of
from()
Yes, for example convention in Ramda (Functional Programming JS-library):
The primary distinguishing features of Ramda are:
- Ramda emphasizes a purer functional style. Immutability and side-effect free functions are at the heart of its design philosophy. This can help you get the job done with simple, elegant code.
- Ramda functions are automatically curried. This allows you to easily build up new functions from old ones simply by not supplying the final parameters.
- The parameters to Ramda functions are arranged to make it convenient for currying. The data to be operated on is generally supplied last.
The last two points together make it very easy to build functions as sequences of simpler functions, each of which transforms the data and passes it along to the next. Ramda is designed to support this style of coding.
Source: https://ramdajs.com/
How is currying work:
These queries should be identical (if from()
function was curried):
let v = Vars("cls");
from("schema", WOQL.triple(v.cls, "rdf:type", "sys:Class"))
let v = Vars("cls");
from("schema").triple(v.cls, "rdf:type", "sys:Class")
from terminusdb.
Good find. The documentation mentions both triple and quad forms for this query. I think this is a bug indeed, or a client issue. For others seeing this later, check the documentation and use the quad style for now, but there are situations where there are many operations in the schema that really needs the
from
style!Great catch @alexander-mart
For those who are looking for a solution 👍
For now, please use:
WOQL.quad("v:cls", "rdf:type", "sys:Class", "schema")
See: https://terminusdb.com/docs/javascript/#fromgraphrefquery
Instead of
from("schema", triple("v:cls", "rdf:type", "sys:Class"))
from terminusdb.
Related Issues (20)
- Add debug info for error: `Not well formed WOQL JSON-LD`
- docker doesn't start: `Authentication Incorrect for reason: basic_auth(admin)` HOT 2
- Incorrect `clone url` in docker version of dashboard HOT 1
- doc: missed `WOQLClient` `key` parameter description from «Connect to docker with js-client» tutorial
- GraphQL: le operator in does not work as expected HOT 3
- Error alert (html component) at wrong place in the new (last) version of UI
- GraphQL: le,lt,ge, gt on datetime work opposite way (ie. le as ge) HOT 3
- oneOf with multilevel inheritance
- Empty screen instead of new document form with error: `getChangeRequestList Path not found: /api/changes/admin/my-data-product` HOT 1
- Basic data management tutorials with TerminusDB for beginners: dump, load RDF-data with CLI-tool
- Add WOQL terms to support time extraction, timezone handling, and comparison HOT 4
- Feedback form probably don't work and don't display any UI-feedback to user after submit [self-hosted and cloud] HOT 1
- Improve handling of rdf:nil when using not() WOQL construct with sys:subdocument
- Can't use `times()` and all of other math WOQL methods as described in the documentation with error: `SERVER ERROR: The query you have sent has no viable mode. Some variables can not be bound under any reordering.` HOT 2
- Error with JSON properties on documents.
- Problem with cost function
- Can't delete/update inherited type instance with ValueHash subdocument that has a list HOT 4
- Website broken HOT 1
- Linking existing databases to the Organization is not possible.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminusdb.