Skip to content

Commit

Permalink
wip: false serializer and cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximvdw committed Nov 18, 2024
1 parent 5d573c5 commit 7f8cb95
Show file tree
Hide file tree
Showing 11 changed files with 352 additions and 306 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@
},
"peerDependencies": {
"@openhps/core": ">=0.6.9",
"@openhps/rdf": ">=0.4.85",
"@openhps/rdf": ">=0.4.90",
"reflect-metadata": ">=0.2.1"
},
"devDependencies": {
"@commitlint/cli": "^19.4.1",
"@commitlint/config-conventional": "^19.4.1",
"@comunica/config-query-sparql": "^3.2.1",
"@openhps/core": ">=0.7.10",
"@openhps/rdf": ">=0.4.86",
"@openhps/rdf": ">=0.4.90",
"@types/chai": "^4.3.19",
"@types/cookie-session": "^2.0.49",
"@types/express": "^4.17.21",
Expand Down
572 changes: 286 additions & 286 deletions src/common/engine-default.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/models/ldes/EventStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class EventStream extends SerializableThing {
@SerializableMember({
rdf: {
predicate: tree.view,
serializer: false
},
})
view: Node;
Expand Down
3 changes: 2 additions & 1 deletion src/models/tree/Collection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SerializableObject } from '@openhps/core';
import { SerializableObject, SerializableArrayMember } from '@openhps/core';
import { tree } from '../../terms';
import { SerializableThing } from '@openhps/rdf';

Expand All @@ -11,6 +11,7 @@ export class Collection extends SerializableThing {
@SerializableArrayMember(SerializableThing, {
rdf: {
predicate: tree.member,
serializer: false,
},
})
members?: SerializableThing[] = [];
Expand Down
7 changes: 2 additions & 5 deletions src/models/tree/Relation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ export abstract class Relation {
@SerializableMember({
rdf: {
predicate: tree.node,
serializer: (node: Node) => {
return node.id;
},
serializer: false,
deserializer: (iri: IriString) => {
return new SerializableThing(iri as any);
}
},
}
})
node? : SerializableThing;
Expand All @@ -37,7 +35,6 @@ export abstract class Relation {
return RDFSerializer.serialize(value);
},
deserializer: (thing: Thing) => {
console.log("Deserializing value of relation", thing)
return RDFSerializer.deserialize(thing);
}
},
Expand Down
3 changes: 3 additions & 0 deletions src/node/SolidClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export class SolidClientService extends SolidService {
const session = this.createSession({
storage: this.storage,
});
if (this.options.clientId === undefined || this.options.clientSecret === undefined) {
throw new Error('Client ID and Client Secret must be set');
}
if (!interactive) {
return new Promise((resolve, reject) => {
session
Expand Down
32 changes: 25 additions & 7 deletions src/terms/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type OtherIndividual = IriString; // eslint-disable-line
/**
*
*
* Links together a tree:Node with its description of this TREE structure
* Links together a tree:Node with a description of this search tree through the search tree itself or through a data service
*
* https://w3id.org/tree#viewDescription
*/
Expand Down Expand Up @@ -48,6 +48,15 @@ export const remainingItems: Property = 'https://w3id.org/tree#remainingItems';
*/
export const node: Property = 'https://w3id.org/tree#node';

/**
* Has Root Node
*
* A view has a root node that can be used to start traversing the search tree
*
* https://w3id.org/tree#rootNode
*/
export const rootNode: Property = 'https://w3id.org/tree#rootNode';

/**
* Value
*
Expand Down Expand Up @@ -168,13 +177,13 @@ export const timeQuery: Property = 'https://w3id.org/tree#timeQuery';
export const Collection: Class = 'https://w3id.org/tree#Collection';

/**
* View Description
* Search Tree
*
* Describes a specific TREE structure on top of the tree:Collection
* A tree:SearchTree publishes the members of a collection.
*
* https://w3id.org/tree#ViewDescription
* https://w3id.org/tree#SearchTree
*/
export const ViewDescription: Class = 'https://w3id.org/tree#ViewDescription';
export const SearchTree: Class = 'https://w3id.org/tree#SearchTree';

/**
* Node
Expand All @@ -185,6 +194,15 @@ export const ViewDescription: Class = 'https://w3id.org/tree#ViewDescription';
*/
export const Node: Class = 'https://w3id.org/tree#Node';

/**
* Root Node
*
* A tree:RootNode is the access point into a search tree.
*
* https://w3id.org/tree#RootNode
*/
export const RootNode: Class = 'https://w3id.org/tree#RootNode';

/**
* Relation
*
Expand Down Expand Up @@ -276,7 +294,7 @@ export const LessThanOrEqualToRelation: Class = 'https://w3id.org/tree#LessThanO
export const EqualToRelation: Class = 'https://w3id.org/tree#EqualToRelation';

/**
* Not equal To Relation
* Not Equal To Relation
*
*
*
Expand Down Expand Up @@ -305,7 +323,7 @@ export const InBetweenRelation: Class = 'https://w3id.org/tree#InBetweenRelation
/**
* TREE
*
* A hypermedia specification for fragmenting collections.
* A hypermedia specification for fragmenting collections of members.
*
* https://w3id.org/tree#Ontology
*/
Expand Down
24 changes: 24 additions & 0 deletions test/scripts/clean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { SolidClientService, SolidPropertyService, SolidSession } from '../../src';
require('dotenv').config();

let session: SolidSession;
const clientService = new SolidClientService({
clientName: "OpenHPS",
clientId: process.env.clientId,
clientSecret: process.env.clientSecret,
});

const service = new SolidPropertyService();
console.log("Logging in...");
clientService.login("https://solid.maximvdw.be/").then(s => {
session = s;
console.log("Building service...");
return service.emitAsync('build');
}).then(() => {
service.service = clientService;
console.log("Deleting test property...");
return service.service.deleteRecursively(session, "https://solid.maximvdw.be/properties/test/");
}).then(() => {
console.log("Logging out...");
return clientService.logout(session);
}).catch(console.error);
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion tsconfig/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"transpileOnline": true,
"include": [
"../test/specs/**/*.ts"
"../test/specs/**/*.ts",
"../test/scripts/**/*.ts"
]
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6143,10 +6143,10 @@
robust-predicates "^3.0.2"
wkt "^0.1.1"

"@openhps/rdf@>=0.4.86":
version "0.4.86"
resolved "https://registry.yarnpkg.com/@openhps/rdf/-/rdf-0.4.86.tgz#b695a05817d4b7d7ae5de840a7c64611e37bf1f6"
integrity sha512-c++Li6F9hn4xv6VtYOZPVd5PtxDN/0jFYXbamMPL9xUXVm5gflEy4dRnLzG/T/P8ABCXtGuB6TNcUquyTtDVcg==
"@openhps/rdf@>=0.4.90":
version "0.4.90"
resolved "https://registry.yarnpkg.com/@openhps/rdf/-/rdf-0.4.90.tgz#ec1313234e94d77afa9d293dd117f4c4228139cd"
integrity sha512-hawARHKeJZeyi4dAjTWvJxfy80J8UXza5VeQNT8qnf2QaYTBH0qBbyQONFUU1KM5RIfZzCAcYtYkDamEI4/Zvw==
dependencies:
"@comunica/query-sparql" "^3.1.2"
"@inquirer/prompts" "^5.1.0"
Expand Down

0 comments on commit 7f8cb95

Please sign in to comment.