Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Open-Initiative/LDP-framework
Simple Framework for LDP architectures
https://github.com/Open-Initiative/LDP-framework
Last synced: about 1 month ago
JSON representation
Simple Framework for LDP architectures
- Host: GitHub
- URL: https://github.com/Open-Initiative/LDP-framework
- Owner: Open-Initiative
- License: mit
- Created: 2015-02-21T12:20:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-25T14:27:40.000Z (about 6 years ago)
- Last Synced: 2024-10-05T01:47:08.306Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.27 MB
- Stars: 11
- Watchers: 8
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - Open-Initiative/LDP-framework - Simple Framework for LDP architectures (others)
README
# LDP-Framework
Simple framework for LDP achitecturesThis javascript framework enables you to build an application based on the LDP architecture.
Just create js objects and forget about the server. The framework handles that for you!##Features
See index.html as an example.
You can also see webcomponents.html for an example based on web components.### Store Initialization
`new MyStore({options...})`
Allowed options:
* container: iri used as the default container
* context: iri used as the default json-ld context
* template: main template, used as a default for render operations
* partials: other templates to be used in rendering
* models: objects describing the models of the application, used by forms (See below)### Add resource:
`store.save(object)`### Get resource
```
store.get(objectIri).then(function(object){
// Do something with the object
});
```
or to get the full resource when you have a partial or outdated object:
`store.get(object)`### Update resource
```
object = store.get(objectIri);
object.property = value;
store.save(object);
```### List resources of a container
```
store.list(containerIri).then(function(list) {
list.forEach(function(object) {
// Do something with each object
});
});
```### Delete resource
`store.delete(objectIri)`### Create a container
`store.createContainer(containerName, parentContainer)`### Render resource with template
```store.render('#div', resourceIri, '#template-script', context)```
Only the first parameter is required. For the others, the default given in initiatilization will be used.### Asynchronous rendering
`{{{ldpeach object.ldp:contains "div"}}}`
Retrives all the resources of the given array, and renders them as they arrive. They are render in an element of the given tag.### Form handling
`{{{form 'mymodel'}}}`
Renders a form with the model. When submitted, the object is automatically created in the container given in the model.#### Models
A model is described by a JSON object, containing possibly a container uri, and a set of fields, each of which containing a title and a name. For the todos used in the example, the model looks like this:
```
{'todos': {
fields: [
{title: "What do you need to do today?", name: "todos:label"},
{title: "Who should do it?", name: "todos:assignee"}
],
container: "todos/"
}}
```For more information on how all this works, please check the wiki:
-> https://github.com/Open-Initiative/LDP-framework/wiki## Installation process (for developers)
If you would like to contribute, please note that the main file (ldpframework.js) is compiled (and minified ?) using Browserify.So if you fork the project, all modifications/contributions should be done in the non-compiled sources. The main source file is the ldpstore.js one, containing the MyStore class.
To compile the sources, you will need to install all the dependencies using NPM.
To be able able to compile, first install NodeJS and NPM:
```
sudo apt-get install nodejs npm
```Then, launch the installation of all the dependencies from the root of the project folder using:
```
npm install
```This command should create a node_modules folders containing the sources of all the dependencies listed in the package.json file (locate at the root of the project).
If you got error about the node command unknown (useful on Ubuntu for example) you will need to create an alias from the nodejs command to the node one:
```
sudo ln -s /usr/bin/nodejs /usr/bin/node
```Then, install browserify:
```
sudo npm install -g browserify
```Browserify will allow you to compile the sources right after you made modifications, to test on the compiled version and keep a setup close to production.
To compile the sources, use the following command:
```
browserify ldpstore.js -o ldpframework.js
```You can also use Grunt to watch the changes and process automatic compiling while working. To be able to use Grunt, please install it using
```
sudo npm install -g grunt-cli
```
Then, using the following command:```
grunt watch
```From the project root folder, you should see that any changes to the source ldpstore.js should be compiled into the ldpframework.js file.
##Dependencies
###Server side
You need an LDP server in order to serve data to your application.
This application has been tested with RwwPlay!
See https://github.com/Open-Initiative/LDP-Todo-List/wiki/Notes-on-installing-RwwPlay for installationYou can also test read-only templating features with RDF files served by a standard HTTP server.
###Client side
* RDF Extenstions
* RDF-Interface
* JSON-LD
* N3
* JQuery
* ES6 promises
* Handlebars