forked from timbl/rabel
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove -inXML as command, add application/xml as format. Add data isl…
…and test
- Loading branch information
Tim Berners-Lee
committed
Feb 7, 2016
1 parent
72f1cb0
commit 5136226
Showing
5 changed files
with
145 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# rabel | ||
Program for reading and writing linked data in various formats. Short for "RDF Babel". | ||
# rabel - linked data format converter | ||
|
||
Program for reading and writing linked data in various formats. | ||
|
||
To install, | ||
|
||
npm install -g rabel | ||
|
||
## Command line | ||
|
||
Commands look like unix options are executed *in order* from left to right. They include: | ||
``` | ||
-base=rrrr Set the current base URI (relative URI) | ||
-clear Clear the current store | ||
-dump Serialize the store in current content-type to the console | ||
-format=cccc Set the current content-type | ||
-help This message | ||
-in=uri Load a web resource or file | ||
-out=filename Output in the current content type | ||
-size Give the current store size in triples | ||
-version Give the version of this program | ||
``` | ||
|
||
Formats cccc are given as MIME types. These can be used for input or output: | ||
|
||
* text/turtle *(default)* | ||
* application/rdf+xml | ||
|
||
whereas these can only input: | ||
|
||
* application/rdfa | ||
* application/xml | ||
|
||
#### Example | ||
|
||
``` | ||
rabel -format=application/xml -in=foo.xml -format=text/turtle -out=foo.ttl | ||
rabel part*.ttl -out=whole.ttl | ||
``` | ||
## Details | ||
Currently rabel can read from the web or files, and write only to files. Filenames are deemed to be relative URIs just taken relative to file:///{pwd}/ where {pwd} is the current working directory. | ||
|
||
One use case is testing the all the parsers. Another is providing a stable serialization. The output serialization is designed to be stable under small changes of the the data, to allow data files to be checked into source code control systems. | ||
|
||
The name comes from RDF and Babel. | ||
|
||
### XML | ||
|
||
When loading XML, elements are mapped to arcs, and text content to trimmed RDF strings. For the XML namespace used for IANA registry documents, custom mapping is done, both of properties and datatypes, and local identifier generation. | ||
(See the source for details!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>XML Data Block Demo</title> | ||
<link rel="derivedfrom" href="https://developer.mozilla.org/en/docs/Using_XML_Data_Islands_in_Mozilla"/> | ||
<script id="purchase-order" type="application/xml"> | ||
<purchaseOrder xmlns="http://example.mozilla.org/PurchaseOrderML"> | ||
<lineItem> | ||
<name>Line Item 1</name> | ||
<price>1.25</price> | ||
</lineItem> | ||
<lineItem> | ||
<name>Line Item 2</name> | ||
<price>2.48</price> | ||
</lineItem> | ||
</purchaseOrder> | ||
</script> | ||
<script> | ||
function runDemo() { | ||
var orderSource = document.getElementById("purchase-order").textContent; | ||
var parser = new DOMParser(); | ||
var doc = parser.parseFromString(orderSource, "application/xml"); | ||
var lineItems = doc.getElementsByTagNameNS("http://example.mozilla.org/PurchaseOrderML", "lineItem"); | ||
var firstPrice = lineItems[0].getElementsByTagNameNS("http://example.mozilla.org/PurchaseOrderML", "price")[0].textContent; | ||
document.body.textContent = "The purchase order contains " + lineItems.length + " line items. The price of the first line item is " + firstPrice + "."; | ||
} | ||
</script> | ||
</head> | ||
<body onload="runDemo()";> | ||
Demo did not run | ||
</body> | ||
</html> |
File renamed without changes.
File renamed without changes.