Skip to content

Commit

Permalink
Revert "fix: invalid view query during publishing"
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Oct 5, 2023
1 parent c4a9b38 commit bf402e8
Show file tree
Hide file tree
Showing 23 changed files with 581 additions and 938 deletions.
5 changes: 0 additions & 5 deletions .changeset/small-falcons-peel.md

This file was deleted.

7 changes: 4 additions & 3 deletions apps/api/lib/auth.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { createRequire } from 'module'
import { Router } from 'express'
import auth from 'express-basic-auth'
import $rdf from '@view-builder/core/env.js'
import clownface from 'clownface'
import $rdf from 'rdf-ext'
import asyncMiddleware from 'middleware-async'
import { DESCRIBE } from '@tpluscode/sparql-builder'
import { rdf, vcard } from '@tpluscode/rdf-ns-builders'
Expand Down Expand Up @@ -34,7 +35,7 @@ function setAgent(client) {
.execute(client.query)
const dataset = await $rdf.dataset().import(userQuery)

let [foundUser] = $rdf.clownface({ dataset })
let [foundUser] = clownface({ dataset })
.has(vcard.hasUID, userName)
.toArray()
.filter(isNamedNode)
Expand All @@ -43,7 +44,7 @@ function setAgent(client) {
req.knossos.log(`Current user ${foundUser.value}`)
} else {
const id = req.rdf.namedNode(`/user/${encodeURIComponent(userName)}`)
foundUser = $rdf.clownface({ dataset: $rdf.dataset() })
foundUser = clownface({ dataset: $rdf.dataset() })
.namedNode(id)
.addOut(rdf.type, vcard.Individual)
.addOut(vcard.hasUID, userName)
Expand Down
4 changes: 2 additions & 2 deletions apps/api/lib/errors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable class-methods-use-this */
import { ProblemDocument } from 'http-problem-details'
import rdf from '@view-builder/core/env.js'
import { fromPointer } from '@rdfine/shacl/lib/ValidationReport'
import { hex } from '@hydrofoil/vocabularies/builders'

export class ValidationErrorMapper {
Expand All @@ -9,7 +9,7 @@ export class ValidationErrorMapper {
}

mapError(error) {
const report = error.reports.map(ptr => rdf.rdfine.sh.ValidationReport(ptr).toJSON())
const report = error.reports.map(ptr => fromPointer(ptr).toJSON())

const problem = new ProblemDocument({
title: 'Data issues were found',
Expand Down
5 changes: 3 additions & 2 deletions apps/api/lib/sourceViewCollection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import $rdf from '@view-builder/core/env.js'
import $rdf from 'rdf-ext'
import clownface from 'clownface'
import asyncMiddleware from 'middleware-async'
import { hydra, rdf, rdfs, schema } from '@tpluscode/rdf-ns-builders'
import { CONSTRUCT } from '@tpluscode/sparql-builder'
Expand All @@ -11,7 +12,7 @@ import { ssz } from '@view-builder/core/ns.js'
* The response is a hydra collection
*/
export const get = asyncMiddleware(async (req, res) => {
const collection = $rdf.clownface({
const collection = clownface({
dataset: $rdf.dataset(),
term: req.hydra.term,
})
Expand Down
2 changes: 1 addition & 1 deletion apps/api/loadUsers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import { INSERT, sparql } from '@tpluscode/sparql-builder'
import { vcard } from '@tpluscode/rdf-ns-builders'
import $rdf from '@view-builder/core/env.js'
import $rdf from 'rdf-ext'
import StreamClient from 'sparql-http-client'
import { loadUsers } from './lib/auth.js'

Expand Down
19 changes: 10 additions & 9 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@
},
"dependencies": {
"@hydrofoil/knossos": "^0.9.11",
"@hydrofoil/vocabularies": "^1.1.1",
"@rdfine/hydra": "^0.10.2",
"@rdfine/shacl": "^0.10.2",
"@tpluscode/rdf-ns-builders": "^4",
"@tpluscode/rdfine": "^0.7.4",
"@tpluscode/sparql-builder": "^1",
"@hydrofoil/vocabularies": "^0.3.3",
"@rdfine/hydra": "^0.8.6",
"@rdfine/shacl": "^0.8.7",
"@tpluscode/rdf-ns-builders": "^2.0.1",
"@tpluscode/rdfine": "^0.5.41",
"@tpluscode/sparql-builder": "^0.3.23",
"@view-builder/core": "^0.0.0",
"@view-builder/publish-views": "^0.0.4",
"@zazuko/vocabulary-extras": "^2.0.1",
"clownface": "^2.0.1",
"@zazuko/vocabulary-extras": "^1.2.3",
"clownface": "^1.5.1",
"cors": "^2.8.5",
"express": "^4.18.1",
"express-basic-auth": "^1.2.1",
"http-problem-details": "^0.1.5",
"is-graph-pointer": "^2",
"is-graph-pointer": "^1.2.2",
"middleware-async": "^1.3.5",
"rdf-dataset-ext": "^1.0.1",
"rdf-ext": "^2.0.1",
"rdf-literal": "^1.3.0",
"sparql-http-client": "^2.4.1",
"tempy": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion apps/ontodia/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
onPageLoad,
tryLoadLayoutFromLocalStorage,
saveLayoutToLocalStorage,
} from './common.js'
} from './common'

function onWorkspaceMounted(workspace: Workspace) {
if (!workspace) {
Expand Down
20 changes: 10 additions & 10 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@hydrofoil/vocabularies": "^0.3.2",
"@material/mwc-drawer": "^0.27",
"@ngard/tiny-difference": "^1.0.0",
"@rdfine/hydra": "^0.10.2",
"@rdfine/hydra": "^0.8.6",
"@rdfjs-elements/lit-helpers": "^0.3.4",
"@rdfjs-elements/formats-pretty": "^0.5.1",
"@rdfjs/data-model": "^2.0.1",
Expand All @@ -28,20 +28,20 @@
"@rdfjs/term-set": "^2.0.0",
"@rdfjs/traverser": "^0.1.0",
"@shoelace-style/shoelace": "^2.0.0-beta.80",
"@tpluscode/rdf-ns-builders": "^4",
"@tpluscode/rdf-string": "^1.0.3",
"@tpluscode/sparql-builder": "^1.1.0",
"@tpluscode/rdf-ns-builders": "^2.0.1",
"@tpluscode/rdf-string": "^0.2.26",
"@tpluscode/sparql-builder": "^0.3.23",
"content-disposition": "^0.5.4",
"@view-builder/core": "0.0.0",
"@view-builder/view-util": "0.0.1",
"@zazuko/prefixes": "^2.0.0",
"@zazuko/vocabulary-extras": "^2.0.1",
"@zazuko/rdf-vocabularies": "^2022.6.29",
"@zazuko/vocabulary-extras": "^1.2.3",
"alcaeus": "^2.3.2",
"clownface": "^2",
"clownface-shacl-path": "^2.0.2",
"clownface": "^1.5.1",
"clownface-shacl-path": "^1.3.2",
"get-stream": "^6.0.1",
"is-absolute-url": "^4.0.1",
"is-graph-pointer": "^2.1.0",
"is-graph-pointer": "^1.2.2",
"lit": "^2.3.0",
"n3": "^1.16.2",
"nanoid": "^4.0.0",
Expand All @@ -58,7 +58,7 @@
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
"@babel/preset-typescript": "^7.16.5",
"@open-wc/building-webpack": "^2.13.46",
"@rdfine/shacl": "^0.10.2",
"@rdfine/shacl": "^0.8.7",
"@view-builder/testing": "0.0.0",
"chai": "^4.3.6",
"copy-webpack-plugin": "^6",
Expand Down
5 changes: 3 additions & 2 deletions apps/www/src/clownface.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import $rdf from '@view-builder/core/env.js'
import $rdf from '@rdfjs/dataset'
import Traverser from '@rdfjs/traverser'
import clownface from 'clownface'
import TermSet from '@rdfjs/term-set'

export function newReference(ptr) {
return $rdf.clownface({
return clownface({
dataset: $rdf.dataset([...ptr.dataset]),
term: ptr.term,
})
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/element/ssz-notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '@shoelace-style/shoelace/dist/components/icon/icon.js'
import '@shoelace-style/shoelace/dist/components/progress-bar/progress-bar.js'
import './ssz-shacl-report.js'
import { rdfs } from '@tpluscode/rdf-ns-builders'
import { store } from '../state/store.js'
import { store } from '../state/store'

export class SszNotifications extends connect(store, LitElement) {
alerts = new Set()
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/element/ssz-shacl-button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css, html, LitElement } from 'lit'
import '@shoelace-style/shoelace/dist/components/icon-button/icon-button.js'
import prefixes from '@zazuko/prefixes'
import prefixes from '@zazuko/rdf-vocabularies/prefixes'
import prefixesExtras from '@zazuko/vocabulary-extras/prefixes'
import { view } from '@view-builder/core/ns.js'

Expand Down
9 changes: 5 additions & 4 deletions apps/www/src/state/plugin/view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { rdf } from '@tpluscode/rdf-ns-builders'
import { turtle } from '@tpluscode/rdf-string'
import $rdf from '@view-builder/core/env.js'
import $rdf from 'rdf-ext'
import clownface from 'clownface'
import * as ns from '@view-builder/core/ns.js'
import { nanoid } from 'nanoid'
import { getAllTriplesFromRoot } from '../../clownface.js'
Expand All @@ -24,7 +25,7 @@ export const viewForm = {
clearView(state) {
if (!('pointer' in state)) return state

const { pointer, ...rest } = state // eslint-disable-line @typescript-eslint/no-unused-vars
const { pointer, ...rest } = state
return rest
},
setSaveOperation(state, saveOperation) {
Expand Down Expand Up @@ -57,7 +58,7 @@ export const viewForm = {
const { pointer, saveOperation } = store.getState().viewForm

const dataset = $rdf.dataset([...getAllTriplesFromRoot(pointer)])
const payload = $rdf.clownface({ dataset }).node(pointer)
const payload = clownface({ dataset }).node(pointer)
dispatch.operation.invoke({
operation: saveOperation,
payload,
Expand Down Expand Up @@ -158,7 +159,7 @@ export const viewForm = {
.match(null, null, null, term)
.map(({ subject, predicate, object }) => $rdf.quad(subject, predicate, object))

dispatch.viewForm.setView($rdf.clownface({ dataset }).node(term))
dispatch.viewForm.setView(clownface({ dataset }).node(term))
},
toggleButtons: toggleButtons(store),
setView: multiEffect(
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/state/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create, core, resource, operation } from '@hydrofoil/shell'
import * as plugins from './plugins.js'
import * as plugins from './plugins'
import { app } from './app/index.js'

export const config = {
Expand Down
41 changes: 22 additions & 19 deletions apps/www/test/forms/dynamicXone.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import sinon from 'sinon'
import { expect } from 'chai'
import $rdf from '@view-builder/core/env.js'
import clownface from 'clownface'
import $rdf from 'rdf-ext'
import { fromPointer } from '@rdfine/shacl/lib/NodeShape'
import { fromPointer as propertyShape } from '@rdfine/shacl/lib/PropertyShape'
import { owl, sh } from '@tpluscode/rdf-ns-builders'
import sh1 from '@hydrofoil/shaperone-core/ns.js'
import { ex, testData } from '@view-builder/testing'
Expand All @@ -17,7 +20,7 @@ describe('forms/dynamicXone.js', () => {
let xone

beforeEach(async () => {
focusNode = $rdf.clownface({ dataset: $rdf.dataset() }).blankNode()
focusNode = clownface({ dataset: $rdf.dataset() }).blankNode()
shape = await testData`
<>
${sh1.xoneDiscriminator} ${ex.predicate} ;
Expand All @@ -38,7 +41,7 @@ describe('forms/dynamicXone.js', () => {
${sh.property} <PropertyBaz> .
`
xone = [{
shapes: shape.any().has(sh1.discriminatorValue).map($rdf.rdfine.sh.PropertyShape),
shapes: shape.any().has(sh1.discriminatorValue).map(propertyShape),
}]
actions = {
showProperty: sinon.spy(),
Expand All @@ -54,13 +57,13 @@ describe('forms/dynamicXone.js', () => {
focusNode: {
focusNode,
logicalConstraints: { xone },
shape: $rdf.rdfine.sh.NodeShape(shape),
shape: fromPointer(shape),
properties: [{
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyFoo')),
shape: propertyShape(shape.namedNode('PropertyFoo')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBar')),
shape: propertyShape(shape.namedNode('PropertyBar')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBaz')),
shape: propertyShape(shape.namedNode('PropertyBaz')),
}],
},
actions,
Expand All @@ -82,13 +85,13 @@ describe('forms/dynamicXone.js', () => {
focusNode: {
focusNode,
logicalConstraints: { xone },
shape: $rdf.rdfine.sh.NodeShape(shape),
shape: fromPointer(shape),
properties: [{
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyFoo')),
shape: propertyShape(shape.namedNode('PropertyFoo')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBar')),
shape: propertyShape(shape.namedNode('PropertyBar')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBaz')),
shape: propertyShape(shape.namedNode('PropertyBaz')),
}],
},
actions,
Expand All @@ -114,13 +117,13 @@ describe('forms/dynamicXone.js', () => {
focusNode: {
focusNode,
logicalConstraints: { xone },
shape: $rdf.rdfine.sh.NodeShape(shape),
shape: fromPointer(shape),
properties: [{
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyFoo')),
shape: propertyShape(shape.namedNode('PropertyFoo')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBar')),
shape: propertyShape(shape.namedNode('PropertyBar')),
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBaz')),
shape: propertyShape(shape.namedNode('PropertyBaz')),
}],
},
actions,
Expand All @@ -146,15 +149,15 @@ describe('forms/dynamicXone.js', () => {
focusNode: {
focusNode,
logicalConstraints: { xone },
shape: $rdf.rdfine.sh.NodeShape(shape),
shape: fromPointer(shape),
properties: [{
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyFoo')),
shape: propertyShape(shape.namedNode('PropertyFoo')),
hidden: true,
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBar')),
shape: propertyShape(shape.namedNode('PropertyBar')),
hidden: true,
}, {
shape: $rdf.rdfine.sh.PropertyShape(shape.namedNode('PropertyBaz')),
shape: propertyShape(shape.namedNode('PropertyBaz')),
hidden: true,
}],
},
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"author": "Zazuko GmbH <[email protected]>",
"repository": "https://github.com/zazuko/ssz-view-builder",
"dependencies": {
"@hydrofoil/knossos": "^0.9.11",
"@hydrofoil/knossos": "^0.9.6",
"@hydrofoil/talos": "^0.6.2",
"compression": "^1.7.4",
"express": "^4.17.1",
Expand All @@ -40,12 +40,12 @@
"url-state": "3.0.2"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@changesets/cli": "^2.25.2",
"@open-wc/eslint-config": "^8.0.2",
"@tpluscode/eslint-config": "^0.4.4",
"@tpluscode/eslint-config": "^0.3.0",
"@types/sparql-http-client": "^2.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"c8": "^7.12.0",
"chai-as-promised": "^7.1.1",
"chai-snapshot-matcher": "^2.0.3",
Expand All @@ -58,7 +58,6 @@
"eslint-plugin-n": "^15.2.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-wc": "^1.3.2",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
Expand Down
6 changes: 0 additions & 6 deletions packages/core/env.js

This file was deleted.

4 changes: 1 addition & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "0.0.0",
"type": "module",
"dependencies": {
"@rdfine/env": "^1.0.3",
"@rdfine/shacl": "^0.10.2",
"@rdfjs/namespace": "^2.0.0",
"@zazuko/vocabulary-extras": "^2.0.1"
"@zazuko/vocabulary-extras": "^1.2.3"
}
}
Loading

0 comments on commit bf402e8

Please sign in to comment.