Skip to content

Commit 7089f47

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 6d4a27f + 42e86d2 commit 7089f47

File tree

8 files changed

+83
-55
lines changed

8 files changed

+83
-55
lines changed

.ci/publish_bintray.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
BRANCH=$1
3+
curl -u "rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/npm/terminusdb/npm-$BRANCH/auth" > .npmrc
4+
curl -XDELETE "https://api.bintray.com/packages/terminusdb/npm-$BRANCH/terminusdb:terminusdb-client" -u "rrooij:$BINTRAY_API_TOKEN"
5+
npm publish
6+
curl -T "dist/terminusdb-client.min.js" -u"rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/content/terminusdb/terminusdb/terminusdb-client/$BRANCH/$BRANCH/terminusdb-client.min.js?publish=1&override=1"
7+
curl -T "dist/terminusdb-client.min.js.map" -u"rrooij:$BINTRAY_API_TOKEN" "https://api.bintray.com/content/terminusdb/terminusdb/terminusdb-client/$BRANCH/$BRANCH/terminusdb-client.min.js.map?publish=1&override=1"

.ci/publish_canary.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ci/publish_dev.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.ci/publish_rc.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/workflow.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build and release on production
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
- canary
7+
- rc
8+
9+
jobs:
10+
setup-build-publish-deploy:
11+
name: Setup, Build, Publish, and Deploy
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 14
20+
- run: npm install
21+
- run: npm run build
22+
- run: bash ".ci/publish_bintray.sh" "${GITHUB_REF##*/}"
23+
env:
24+
BINTRAY_API_TOKEN: ${{ secrets.BINTRAY_API_TOKEN }}

.travis.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,13 @@ node_js:
55

66
stages:
77
- build
8-
- name: deploy_dev
9-
if: branch = dev
10-
- name: deploy_rc
11-
if: branch = rc
12-
- name: deploy_canary
13-
if: branch = canary
148

159
jobs:
1610
include:
1711
- stage: build
1812
after_script:
1913
- npm run coveralls-after
2014

21-
- stage: deploy_dev
22-
script:
23-
- npm run build
24-
- bash .ci/publish_dev.sh
25-
26-
- stage: deploy_rc
27-
script:
28-
- npm run build
29-
- bash .ci/publish_rc.sh
30-
31-
- stage: deploy_canary
32-
script:
33-
- npm run build
34-
- bash .ci/publish_canary.sh
35-
36-
3715
before_deploy:
3816
- npm run doc
3917
- npm run build

lib/query/woqlLibrary.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,46 @@ function WOQLLibrary(mode) {
9797
this.empty = ""
9898
}
9999

100+
101+
WOQLLibrary.prototype.classesAndChoices = function(values, variables, schema_resource){
102+
let g = schema_resource || this.default_schema_resource
103+
this.default_variables = [
104+
'Class ID',
105+
'Class Name',
106+
'Description',
107+
'Parents',
108+
'Children',
109+
'Abstract',
110+
'Parent',
111+
'Child',
112+
'Choices'
113+
]
114+
115+
if (variables) this._set_user_variables(variables)
116+
let select_vars = this._get_varlist().slice(0, 6)
117+
118+
119+
let qpattern = new WOQLQuery().and(
120+
this.classes(values, variables, schema_resource),
121+
new WOQLQuery().opt().select("v:Choices").from("schema/main")
122+
.group_by("v:Class ID", ["v:choice id", "v:choice label", "v:choice description"], "v:Choices")
123+
.and(
124+
new WOQLQuery().select("v:choice id").distinct("v:choice id")
125+
.triple("v:Class ID", "owl:oneOf", "v:Choice")
126+
.path("v:Choice", "rdf:rest+", "v:Entry", "v:Path")
127+
.or(
128+
new WOQLQuery().triple("v:Choice", "rdf:first", "v:choice id"),
129+
new WOQLQuery().triple("v:Entry", "rdf:first", "v:choice id")
130+
),
131+
new WOQLQuery().triple("v:choice id", "label", "v:choice label")
132+
.triple("v:choice id", "comment", "v:choice description")
133+
)
134+
)
135+
136+
return this._add_constraints(qpattern, values)
137+
}
138+
139+
100140
/**
101141
* Patterns to help getting the most useful information from schema graphs
102142
*
@@ -127,6 +167,7 @@ WOQLLibrary.prototype.classes = function(values, variables, schema_resource) {
127167
new WOQLQuery().quad(this._varn('Class ID'), 'label', this._varn('Class Name'), g),
128168
new WOQLQuery().eq(this._varn('Class Name'), "")
129169
),
170+
130171
new WOQLQuery().limit(1).or(
131172
new WOQLQuery().quad(this._varn('Class ID'), 'system:tag', "system:abstract", g).eq(this._varn("Abstract"), "Yes"),
132173
new WOQLQuery().eq(this._varn("Abstract"), "No")

lib/query/woqlSchema.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ WOQLQuery.prototype.insert_class_data = function(data, graph) {
5151
if (data.description) {
5252
this.description(data.description)
5353
}
54+
if(data.abstract===true){
55+
this.abstract()
56+
}
5457
if (data.parent) {
5558
if (!Array.isArray(data.parent)) data.parent = [data.parent]
5659
this.parent(...data.parent)
@@ -199,8 +202,9 @@ WOQLQuery.prototype.generateChoiceList = function(cls, clslabel, clsdesc, choice
199202
graph = this._sg(graph)
200203
var clist = []
201204
var listid = '_:' + (cls.indexOf(':') == -1 ? cls : cls.split(':')[1])
205+
const className=this.cleanClass(cls, true)
202206
var lastid = listid
203-
let wq = new WOQLQuery().add_class(cls, graph).label(clslabel)
207+
let wq = new WOQLQuery().add_class(className, graph).label(clslabel)
204208
if (clsdesc) wq.description(clsdesc)
205209
if (parent) wq.parent(parent)
206210
var confs = [wq]
@@ -215,7 +219,7 @@ WOQLQuery.prototype.generateChoiceList = function(cls, clslabel, clsdesc, choice
215219
var clab = UTILS.labelFromURL(chid)
216220
var desc = false
217221
}
218-
let cq = new WOQLQuery().insert(chid, cls, graph).label(clab)
222+
let cq = new WOQLQuery().insert(chid, className, graph).label(clab)
219223
if (desc) cq.description(desc)
220224
confs.push(cq)
221225
var nextid = i < choices.length - 1 ? listid + '_' + i : 'rdf:nil'
@@ -225,18 +229,18 @@ WOQLQuery.prototype.generateChoiceList = function(cls, clslabel, clsdesc, choice
225229
}
226230
//do the owl oneof
227231
let oneof = new WOQLQuery().and(
228-
new WOQLQuery().add_quad(cls, 'owl:oneOf', new WOQLQuery().iri(listid), graph),
232+
new WOQLQuery().add_quad(className, 'owl:oneOf', new WOQLQuery().iri(listid), graph),
229233
...clist,
230234
)
231235
return this.and(...confs, oneof)
232236
}
233237

234-
WOQLQuery.prototype.deleteChoiceList = function(cls, graph) {
238+
WOQLQuery.prototype.deleteChoiceList = function(classId, graph) {
235239
graph = this._sg(graph)
236240
return new WOQLQuery().and(
237241
new WOQLQuery().from(graph).and(
238242
new WOQLQuery().select("v:Rest")
239-
.distinct("v:Rest").triple(cls, "owl:oneOf", "v:Clist")
243+
.distinct("v:Rest").triple(classId, "owl:oneOf", "v:Clist")
240244
.path("v:Clist", "rdf:rest+", "v:Entry", "v:Path")
241245
.or(
242246
new WOQLQuery().triple("v:Entry", "rdf:first", "v:Rest"),
@@ -245,12 +249,12 @@ WOQLQuery.prototype.deleteChoiceList = function(cls, graph) {
245249
new WOQLQuery().triple("v:Rest", "v:valprop", "v:valval")
246250
.triple("v:X", "rdf:first", "v:Rest")
247251
.triple("v:Y", "rdf:rest", "v:valRest")
248-
.triple("scm:Confidence", "v:classProp", "v:classPropVal")
252+
.triple(classId, "v:classProp", "v:classPropVal")
249253
),
250254
new WOQLQuery().delete_quad("v:Rest", "v:valprop", "v:valval", graph)
251255
.delete_quad("v:X", "rdf:first", "v:Rest", graph)
252256
.delete_quad("v:Y", "rdf:rest", "v:valRest", graph)
253-
.delete_quad(cls, "v:classProp", "v:classPropVal", graph)
257+
.delete_quad(classId, "v:classProp", "v:classPropVal", graph)
254258
)
255259
}
256260

0 commit comments

Comments
 (0)