-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.js
More file actions
executable file
·48 lines (46 loc) · 2.16 KB
/
example.js
File metadata and controls
executable file
·48 lines (46 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var rdf2json = require("../lib/rdf2json");
var util = require('util');
rdf2json.convertFileIntoRDFJSON("./test/wine.rdf", "flat", function(err, rdfjson){
if(err) util.puts("Something wrong here ...");
var obj = eval("("+ rdfjson +")");
util.puts(JSON.stringify(obj));
});
rdf2json.convertURLIntoRDFJSON("http://www.w3.org/TR/owl-guide/wine.rdf", "sparql", function(err, rdfjson){
if(err) util.puts("Something wrong here ...");
var obj = eval("("+ rdfjson +")");
util.puts(JSON.stringify(obj));
});
rdf2json.convertStringIntoRDFJSON("" +
"<?xml version=\"1.0\"?>" +
" <!DOCTYPE rdf:RDF [" +
" <!ENTITY vin \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#\" >" +
" <!ENTITY food \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#\" >" +
" <!ENTITY owl \"http://www.w3.org/2002/07/owl#\" >" +
" <!ENTITY xsd \"http://www.w3.org/2001/XMLSchema#\" >" +
"]>" +
"<rdf:RDF" +
" xmlns = \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#\"" +
" xmlns:vin = \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#\"" +
" xml:base = \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#\"" +
" xmlns:food= \"http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#\"" +
" xmlns:owl = \"http://www.w3.org/2002/07/owl#\"" +
" xmlns:rdf = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"" +
" xmlns:rdfs= \"http://www.w3.org/2000/01/rdf-schema#\"" +
" xmlns:xsd = \"http://www.w3.org/2001/XMLSchema#\">" +
"" +
" <owl:Ontology rdf:about=\"\">" +
" <rdfs:comment>An example OWL ontology</rdfs:comment>" +
" <owl:priorVersion>" +
" <owl:Ontology rdf:about=\"http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine\"/>" +
" </owl:priorVersion>" +
" <owl:imports rdf:resource=\"http://www.w3.org/TR/2003/PR-owl-guide-20031209/food\"/>" +
" <rdfs:comment>Derived from the DAML Wine ontology at " +
" http://ontolingua.stanford.edu/doc/chimaera/ontologies/wines.daml" +
" Substantially changed, in particular the Region based relations." +
" </rdfs:comment>" +
" <rdfs:label>Wine Ontology</rdfs:label>" +
" </owl:Ontology>" +
"</rdf:RDF>", "talis", function(err, rdfjson){
var obj = eval("("+ rdfjson +")");
util.puts(JSON.stringify(obj));
});