{"id":13556033,"url":"https://github.com/bergie/VIE","last_synced_at":"2025-04-03T09:30:39.936Z","repository":{"id":58236519,"uuid":"1402785","full_name":"bergie/VIE","owner":"bergie","description":"Semantic Interaction Framework for JavaScript","archived":false,"fork":false,"pushed_at":"2020-05-04T22:51:58.000Z","size":4868,"stargazers_count":305,"open_issues_count":59,"forks_count":58,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-29T22:08:47.702Z","etag":null,"topics":["backbone","rdfa"],"latest_commit_sha":null,"homepage":"http://viejs.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bergie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-23T15:59:05.000Z","updated_at":"2025-03-23T14:24:54.000Z","dependencies_parsed_at":"2022-08-31T09:40:10.439Z","dependency_job_id":null,"html_url":"https://github.com/bergie/VIE","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergie%2FVIE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergie%2FVIE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergie%2FVIE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergie%2FVIE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bergie","download_url":"https://codeload.github.com/bergie/VIE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246976042,"owners_count":20863003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backbone","rdfa"],"created_at":"2024-08-01T12:03:34.775Z","updated_at":"2025-04-03T09:30:39.282Z","avatar_url":"https://github.com/bergie.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"![VIE](https://raw.github.com/bergie/VIE/master/design/vie_logo_100.png) Vienna IKS Editables\n====================\n\nVIE is a utility library for implementing [decoupled Content Management systems](http://bergie.iki.fi/blog/decoupling_content_management/). VIE is developed [as part of](http://www.iks-project.eu/projects/vienna-iks-editables) the EU-funded [IKS project](http://www.iks-project.eu/).\n\n![Decoupled CMS communications](https://raw.github.com/bergie/VIE/master/design/cms-decoupled-communications.png)\n\n* In French, _vie_ means life, showcasing how VIE makes your website come alive\n* In English, _vie_ means striving for victory or superiority\n\nVIE development is now targeting a 2.0 release. [Read this blog post](http://bergie.iki.fi/blog/vie_2-0_is_starting_to_emerge/) to find out the changes from VIE 1.0. There is also a [good introductory post on VIE](http://blog.iks-project.eu/semantic-ui-development-with-vie/) on the IKS blog.\n\n## VIE integration in nutshell\n\nAdding VIE to your system is as easy as:\n\n1. Mark up your pages with RDFa annotations\n2. Include `vie.js` into the pages\n3. Implement [Backbone.sync](http://documentcloud.github.com/backbone/#Sync)\n\n## Changes\n\nPlease refer to the [CHANGES.md document](https://github.com/bergie/VIE/blob/master/CHANGES.md).\n\n## Common representation of content on HTML level\n\nA web editing tool has to understand the contents of the page. It has to understand what parts of the page should be editable, and how they connect together. If there is a list of news for instance, the tool needs to understand it enough to enable users to add new news items. The easy way of accomplishing this is to add some semantic annotations to the HTML pages. These annotations could be handled via Microformats, HTML5 microdata, but the most power lies with RDFa.\n\nRDFa is a way to describe the meaning of particular HTML elements using simple attributes. For example:\n\n    \u003cdiv id=\"myarticle\" typeof=\"http://rdfs.org/sioc/ns#Post\" about=\"http://example.net/blog/news_item\"\u003e\n        \u003ch1 property=\"dcterms:title\"\u003eNews item title\u003c/h1\u003e\n        \u003cdiv property=\"sioc:content\"\u003eNews item contents\u003c/div\u003e\n    \u003c/div\u003e\n\nHere we get all the necessary information for making a blog entry editable:\n\n* typeof tells us the type of the editable object. On typical CMSs this would map to a content model or a database table\n* about gives us the identifier of a particular object. On typical CMSs this would be the object identifier or database row primary key\n* property ties a particular HTML element to a property of the content object. On a CMS this could be a database column\n\nAs a side effect, this also makes pages more understandable to search engines and other semantic tools. So the annotations are not just needed for UI, but also for SEO.\n\n## Common representation of content on JavaScript level\n\nHaving contents of a page described via RDFa makes it very easy to extract the content model into JavaScript. We can have a common utility library for doing this, but we also should have a common way of keeping track of these content objects. Enter [Backbone.js](http://documentcloud.github.com/backbone/):\n\n\u003e Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.\n\nWith Backbone, the content extracted from the RDFa-annotated HTML page is easily manageable via JavaScript. Consider for example:\n\n    v = new VIE();\n    v.use(new v.RdfaService());\n    v.load({element: jQuery('#myarticle')}).from('rdfa').execute().success(function(entities) {\n        _.forEach(entities, function(entity) {\n            entity.set({'dcterms:title': 'Hello, world'});\n            entity.save(null, {\n                success: function(savedModel, response) {\n                    alert(\"Your article '\" + savedModel.get('dcterms:title') + \"' was saved to server\");\n                }\n            });\n        })\n        console.log(\"We got \" + entities.length + \" editable objects from the page\");\n    });\n\nThe classic VIE API will also work:\n\n    var v = new VIE({classic: true});\n    var objectInstance = v.RDFaEntities.getInstance(jQuery('#myarticle'));\n    objectInstance.set({'dcterms:title': 'Hello, world'});\n    objectInstance.save(null, {\n        success: function(savedModel, response) {\n            alert(\"Your article '\" + savedModel.get('dcterms:title') + \"' was saved to server\");\n        }\n    });\n\nThis JS would work across all the different CMS implementations. Backbone.js provides a quite nice RESTful implementation of communicating with the server with JSON, but it can be easily overridden with CMS-specific implementation by just implementing a new [Backbone.sync method](http://documentcloud.github.com/backbone/#Sync).\n\n## Example\n\nThere is a full static HTML example of VIE at work. Saving outputs the edited contents as JSON into the JavaScript console:\n\n* [Example with Hallo](http://createjs.org)\n\nBe sure to read the [annotated VIE source code](http://viejs.org/docs/2.0.0/src/VIE.js.html) for API documentation.\n\n## I/O operations\n\nAll Input/Output operations of VIE are based on the [jQuery Deferred](http://api.jquery.com/category/deferred-object/) object, which means that you can attach callbacks to them either before they run, or also after they've been run.\n\nThe operations may either succeed, in which case the `then` callbacks will fire, or be rejected, in which case the `fail` callbacks will fire. Any `then` callbacks will fire in either case.\n\n## Dependencies\n\nVIE uses the following JavaScript libraries:\n\n* [jQuery](http://jquery.com/) for DOM manipulation and [Deferreds](http://api.jquery.com/category/deferred-object/)\n* [Backbone.js](http://documentcloud.github.com/backbone/) for entities (models) and collections\n* [Underscore.js](http://documentcloud.github.com/underscore/) for various JavaScript utilities\n\nSome functionality in VIE additionally uses:\n\n* [RdfQuery](http://code.google.com/p/rdfquery/) as a triplestore and for reasoning over rules\n\n## Integrations\n\n* [Create](https://github.com/bergie/create)\n* [Google Web Toolkit](https://github.com/alkacon/vie-gwt)\n* [Symfony2](https://github.com/liip/LiipVieBundle)\n* [Palsu](https://github.com/bergie/ViePalsu)\n\n## Using VIE on Node.js\n\nVIE is a CommonJS library that works on both browser and the server. On [Node.js](http://nodejs.org/) you can install it with:\n\n    npm install vie\n\nHere is a simple Node.js script that uses VIE for parsing RDFa:\n\n    var jQuery = require('jquery');\n    var vie = require('vie');\n\n    // Instantiate VIE\n    var VIE = new vie.VIE();\n\n    // Enable the RDFa service\n    VIE.use(new VIE.RdfaService());\n\n    var html = jQuery('\u003cp xmlns:dc=\"http://purl.org/dc/elements/1.1/\" about=\"http://www.example.com/books/wikinomics\"\u003eIn his latest book \u003ccite property=\"dc:title\"\u003eWikinomics\u003c/cite\u003e, \u003cspan property=\"dc:creator\"\u003eDon Tapscott\u003c/span\u003e explains deep changes in technology, demographics and business.\u003c/p\u003e');\n\n    // \n    VIE.load({element: html}).from('rdfa').execute().done(function() {\n    \n      var objectInstance = VIE.entities.get('http://www.example.com/books/wikinomics');\n\n      console.log(objectInstance.get('dc:title'));\n\n    });\n\n## Development\n\nVIE development is coordinated using Git at [bergie/VIE](https://github.com/bergie/VIE).\n\nFeel free to [report issues](https://github.com/bergie/VIE/issues) or send [pull requests](http://help.github.com/pull-requests/) if you have ideas for pushing VIE forward. Contributions that include their own unit tests appreciated! \n\nDevelopment discussions happen on the [VIE mailing list](http://groups.google.com/group/viejs) and the `#iks` channel on Freenode. See also [VIE on Ohloh](http://www.ohloh.net/p/vie).\n\n### Code organization\n\nVIE source code is inside the `src` directory. Each separate unit of functionality should be handled in its own file, with the `src/VIE.js` being the entry point to the system.\n\n![VIE architecture](https://raw.github.com/bergie/VIE/master/design/architecture.png)\n\n### Building VIE\n\nThe VIE library consists of many individual pieces that we merge together in the build process. You'll need [Grunt](http://gruntjs.com). Then just run:\n\n    $ grunt build\n\nThe built VIE library will appear in the `dist` folder.\n\n#### Core-only distribution\n\nIn addition to the regular full build, there is also a slimmer build of VIE available that only includes the core parts of the library and no external service. To build that instead, run:\n\n    $ grunt build:core\n\n### Running Unit Tests\n\nDirect your browser to the `test/index.html` file to run VIE's [QUnit](http://docs.jquery.com/Qunit) tests.\n\n#### Unit tests on Node.js\n\nThe Grunt testing setup includes multiple parts. With it, you can test the library on both Node.js and a headless browser. Run:\n\n    $ grunt test\n\nor:\n\n    $ npm test\n\n#### Automatic unit tests\n\nYou can also run the Grunt setup in *watch mode*, where any change in VIE sources or tests will trigger a rebuild and test run:\n\n    $ grunt watch\n\n#### Continuous integration\n\nVIE uses [Travis](http://travis-ci.org/) for continuous integration. Simply add your fork there and every time you push you'll get the tests run.\n\n[![Build Status](https://secure.travis-ci.org/bergie/VIE.png)](http://travis-ci.org/bergie/VIE)\n[![Greenkeeper badge](https://badges.greenkeeper.io/bergie/VIE.svg)](https://greenkeeper.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergie%2FVIE","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbergie%2FVIE","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergie%2FVIE/lists"}