0.2.14 • Published 7 months ago

shex-methods v0.2.14

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
7 months ago

shex-methods

A library to read, create, update or delete rdf nodes that fit a given shape expression.

Examples | Usage | Features | Contributing

Examples

To create a shape object you can use the generated context and types from shex-codegen.

import { Shape } from "shex-methods";
import {
  chatShex,
  ChatShape,
  ChatShapeType,
  ChatShapeContext,
} from "../resources/shex"; // generated by shex-codegen

const chat = new Shape<ChatShape>({
  id: "https://shaperepo.com/schemas/longChat#ChatShape",
  shape: chatShex,
  context: ChatShapeContext,
  type: ChatShapeType,
});

Then you can use the shape object to create nodes of this shape using plain javascript-objects for specifying data. The id of the input data will be used as the node iri of the shape so make sure to pass a valid url.

const newChat = await chat.create({
  doc: testDoc,
  data: {
    id: firstChatIri,
    type: ChatShapeType.LongChat,
    title: "Test Chat",
    author: webId,
    created: new Date(),
  },
});
const { data, errors } = newChat;

Usage

Install the package via your preferred node package manager: npm i shex-methods or yarn add shex-methods

See the auto-generated documentation to learn about all methods.

Features

Current features:

  • Can read, create, update and delete a single shape in remote resources
  • Can read multiple shapes in remote resources
  • User can specify data as primitive type or rdf node

Planned features:

  • Can do all operations on a local graph
  • Can create, update and delete many nodes at once
  • Can publish a shape to an index of shapes
  • Can subscribe to an index of shapes

Contributing

Run yarn to install dependencies and generate shape types.

Configure Environment

Make a copy of example.env and add the required environment variables for running tests that involve authentication/authorization.

Use yarn develop to start the build process in watch mode and run the tests on file changes.

0.2.14

7 months ago

0.2.13

7 months ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.7

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.4

1 year ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.1.30

2 years ago

0.1.31

2 years ago

0.1.32

2 years ago

0.1.33

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.37

2 years ago

0.1.27

2 years ago

0.1.29

2 years ago

0.1.41

2 years ago

0.1.42

2 years ago

0.1.43

2 years ago

0.1.44

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.40

2 years ago

0.1.38

2 years ago

0.1.39

2 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.8

3 years ago

0.1.17

3 years ago

0.1.7

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago