gkellogg-reddy 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +2 -0
- data/.gitignore +9 -0
- data/.gitmodules +3 -0
- data/History.txt +66 -0
- data/README.rdoc +107 -0
- data/Rakefile +96 -0
- data/VERSION +1 -0
- data/bin/reddy +59 -0
- data/lib/reddy.rb +62 -0
- data/lib/reddy/bnode.rb +101 -0
- data/lib/reddy/conjunctive_graph.rb +47 -0
- data/lib/reddy/exceptions.rb +11 -0
- data/lib/reddy/graph.rb +327 -0
- data/lib/reddy/literal.rb +340 -0
- data/lib/reddy/n3_grammar.rb +2171 -0
- data/lib/reddy/n3_grammar.treetop +143 -0
- data/lib/reddy/n3parser.rb +151 -0
- data/lib/reddy/namespace.rb +82 -0
- data/lib/reddy/nokogiri_hacks.rb +8 -0
- data/lib/reddy/parser.rb +127 -0
- data/lib/reddy/rdfaparser.rb +398 -0
- data/lib/reddy/rdfxmlparser.rb +529 -0
- data/lib/reddy/store/abstract_store.rb +64 -0
- data/lib/reddy/store/list_store.rb +61 -0
- data/lib/reddy/store/memory_store.rb +349 -0
- data/lib/reddy/string_hacks.rb +108 -0
- data/lib/reddy/triple.rb +144 -0
- data/lib/reddy/uriref.rb +95 -0
- data/script/console +10 -0
- data/spec/bnode_spec.rb +58 -0
- data/spec/conjunctive_graph_spec.rb +59 -0
- data/spec/graph_spec.rb +390 -0
- data/spec/literal_spec.rb +314 -0
- data/spec/matchers.rb +148 -0
- data/spec/n3parser_spec.rb +229 -0
- data/spec/namespaces_spec.rb +66 -0
- data/spec/ntriples/test.nt +78 -0
- data/spec/parser_spec.rb +29 -0
- data/spec/rdfa-triples/0001.nt +1 -0
- data/spec/rdfa-triples/0006.nt +2 -0
- data/spec/rdfa-triples/0007.nt +3 -0
- data/spec/rdfa-triples/0008.nt +1 -0
- data/spec/rdfa-triples/0009.nt +1 -0
- data/spec/rdfa-triples/0010.nt +2 -0
- data/spec/rdfa-triples/0011.nt +3 -0
- data/spec/rdfa-triples/0012.nt +1 -0
- data/spec/rdfa-triples/0013.nt +1 -0
- data/spec/rdfa-triples/0014.nt +1 -0
- data/spec/rdfa-triples/0015.nt +2 -0
- data/spec/rdfa-triples/0017.nt +3 -0
- data/spec/rdfa-triples/0018.nt +1 -0
- data/spec/rdfa-triples/0019.nt +1 -0
- data/spec/rdfa-triples/0020.nt +1 -0
- data/spec/rdfa-triples/0021.nt +1 -0
- data/spec/rdfa-triples/0023.nt +1 -0
- data/spec/rdfa-triples/0025.nt +2 -0
- data/spec/rdfa-triples/0026.nt +1 -0
- data/spec/rdfa-triples/0027.nt +1 -0
- data/spec/rdfa-triples/0029.nt +1 -0
- data/spec/rdfa-triples/0030.nt +1 -0
- data/spec/rdfa-triples/0031.nt +1 -0
- data/spec/rdfa-triples/0032.nt +1 -0
- data/spec/rdfa-triples/0033.nt +2 -0
- data/spec/rdfa-triples/0034.nt +1 -0
- data/spec/rdfa-triples/0035.nt +1 -0
- data/spec/rdfa-triples/0036.nt +1 -0
- data/spec/rdfa-triples/0037.nt +1 -0
- data/spec/rdfa-triples/0038.nt +1 -0
- data/spec/rdfa-triples/0039.nt +1 -0
- data/spec/rdfa-triples/0040.nt +1 -0
- data/spec/rdfa-triples/0041.nt +1 -0
- data/spec/rdfa-triples/0042.nt +0 -0
- data/spec/rdfa-triples/0046.nt +3 -0
- data/spec/rdfa-triples/0047.nt +3 -0
- data/spec/rdfa-triples/0048.nt +3 -0
- data/spec/rdfa-triples/0049.nt +2 -0
- data/spec/rdfa-triples/0050.nt +2 -0
- data/spec/rdfa-triples/0051.nt +2 -0
- data/spec/rdfa-triples/0052.nt +1 -0
- data/spec/rdfa-triples/0053.nt +2 -0
- data/spec/rdfa-triples/0054.nt +2 -0
- data/spec/rdfa-triples/0055.nt +2 -0
- data/spec/rdfa-triples/0056.nt +3 -0
- data/spec/rdfa-triples/0057.nt +4 -0
- data/spec/rdfa-triples/0058.nt +6 -0
- data/spec/rdfa-triples/0059.nt +6 -0
- data/spec/rdfa-triples/0060.nt +2 -0
- data/spec/rdfa-triples/0061.nt +1 -0
- data/spec/rdfa-triples/0062.nt +1 -0
- data/spec/rdfa-triples/0063.nt +1 -0
- data/spec/rdfa-triples/0064.nt +1 -0
- data/spec/rdfa-triples/0065.nt +3 -0
- data/spec/rdfa-triples/0066.nt +1 -0
- data/spec/rdfa-triples/0067.nt +1 -0
- data/spec/rdfa-triples/0068.nt +1 -0
- data/spec/rdfa-triples/0069.nt +1 -0
- data/spec/rdfa-triples/0070.nt +1 -0
- data/spec/rdfa-triples/0071.nt +1 -0
- data/spec/rdfa-triples/0072.nt +1 -0
- data/spec/rdfa-triples/0073.nt +1 -0
- data/spec/rdfa-triples/0074.nt +1 -0
- data/spec/rdfa-triples/0075.nt +1 -0
- data/spec/rdfa-triples/0076.nt +23 -0
- data/spec/rdfa-triples/0077.nt +23 -0
- data/spec/rdfa-triples/0078.nt +6 -0
- data/spec/rdfa-triples/0079.nt +3 -0
- data/spec/rdfa-triples/0080.nt +1 -0
- data/spec/rdfa-triples/0081.nt +6 -0
- data/spec/rdfa-triples/0082.nt +8 -0
- data/spec/rdfa-triples/0083.nt +6 -0
- data/spec/rdfa-triples/0084.nt +8 -0
- data/spec/rdfa-triples/0085.nt +4 -0
- data/spec/rdfa-triples/0086.nt +0 -0
- data/spec/rdfa-triples/0087.nt +23 -0
- data/spec/rdfa-triples/0088.nt +3 -0
- data/spec/rdfa-triples/0089.nt +1 -0
- data/spec/rdfa-triples/0090.nt +1 -0
- data/spec/rdfa-triples/0091.nt +3 -0
- data/spec/rdfa-triples/0092.nt +3 -0
- data/spec/rdfa-triples/0093.nt +2 -0
- data/spec/rdfa-triples/0094.nt +3 -0
- data/spec/rdfa-triples/0099.nt +1 -0
- data/spec/rdfa-triples/0100.nt +3 -0
- data/spec/rdfa-triples/0101.nt +3 -0
- data/spec/rdfa-triples/0102.nt +1 -0
- data/spec/rdfa-triples/0103.nt +1 -0
- data/spec/rdfa-triples/0104.nt +3 -0
- data/spec/rdfa-triples/0105.nt +1 -0
- data/spec/rdfa-triples/0106.nt +1 -0
- data/spec/rdfa-triples/0107.nt +0 -0
- data/spec/rdfa-triples/0108.nt +1 -0
- data/spec/rdfa-triples/0109.nt +1 -0
- data/spec/rdfa-triples/0110.nt +1 -0
- data/spec/rdfa-triples/0111.nt +2 -0
- data/spec/rdfa-triples/0112.nt +1 -0
- data/spec/rdfa-triples/0113.nt +2 -0
- data/spec/rdfa-triples/0114.nt +3 -0
- data/spec/rdfa-triples/0115.nt +4 -0
- data/spec/rdfa-triples/0116.nt +2 -0
- data/spec/rdfa-triples/0117.nt +2 -0
- data/spec/rdfa-triples/0118.nt +1 -0
- data/spec/rdfa-triples/0119.nt +1 -0
- data/spec/rdfa-triples/0120.nt +1 -0
- data/spec/rdfa-triples/0121.nt +2 -0
- data/spec/rdfa-triples/0122.nt +1 -0
- data/spec/rdfa-triples/0123.nt +3 -0
- data/spec/rdfa-triples/0124.nt +4 -0
- data/spec/rdfa-triples/0125.nt +1 -0
- data/spec/rdfa-triples/0126.nt +3 -0
- data/spec/rdfa-triples/1001.nt +6 -0
- data/spec/rdfa_helper.rb +189 -0
- data/spec/rdfa_parser_spec.rb +130 -0
- data/spec/rdfcore/Manifest.rdf +5395 -0
- data/spec/rdfcore/amp-in-url/test001.nt +16 -0
- data/spec/rdfcore/amp-in-url/test001.rdf +40 -0
- data/spec/rdfcore/datatypes-intensional/test001.nt +18 -0
- data/spec/rdfcore/datatypes-intensional/test002.nt +18 -0
- data/spec/rdfcore/datatypes/test001.nt +15 -0
- data/spec/rdfcore/datatypes/test001.rdf +29 -0
- data/spec/rdfcore/datatypes/test002.nt +14 -0
- data/spec/rdfcore/datatypes/test002.rdf +27 -0
- data/spec/rdfcore/datatypes/test002b.nt +17 -0
- data/spec/rdfcore/datatypes/test003a.nt +16 -0
- data/spec/rdfcore/datatypes/test003b.nt +16 -0
- data/spec/rdfcore/datatypes/test005a.nt +16 -0
- data/spec/rdfcore/datatypes/test005b.nt +16 -0
- data/spec/rdfcore/datatypes/test006.nt +17 -0
- data/spec/rdfcore/datatypes/test008a.nt +15 -0
- data/spec/rdfcore/datatypes/test008b.nt +15 -0
- data/spec/rdfcore/datatypes/test009a.nt +15 -0
- data/spec/rdfcore/datatypes/test009b.nt +15 -0
- data/spec/rdfcore/datatypes/test010.nt +17 -0
- data/spec/rdfcore/datatypes/test011a.nt +17 -0
- data/spec/rdfcore/datatypes/test011b.nt +17 -0
- data/spec/rdfcore/horst-01/test001.rdf +38 -0
- data/spec/rdfcore/horst-01/test002.rdf +39 -0
- data/spec/rdfcore/horst-01/test003.rdf +40 -0
- data/spec/rdfcore/horst-01/test004.rdf +42 -0
- data/spec/rdfcore/pfps-10/test001a.nt +14 -0
- data/spec/rdfcore/pfps-10/test001b.nt +15 -0
- data/spec/rdfcore/rdf-charmod-literals/test001.nt +15 -0
- data/spec/rdfcore/rdf-charmod-literals/test001.rdf +34 -0
- data/spec/rdfcore/rdf-charmod-uris/test001.nt +14 -0
- data/spec/rdfcore/rdf-charmod-uris/test001.rdf +34 -0
- data/spec/rdfcore/rdf-charmod-uris/test002.nt +15 -0
- data/spec/rdfcore/rdf-charmod-uris/test002.rdf +33 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/error001.rdf +27 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/error002.rdf +34 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test001.nt +17 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test001.rdf +27 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test002.nt +19 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test002.rdf +37 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test003.nt +18 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test003.rdf +29 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test004.nt +29 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test004.rdf +33 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test006.nt +40 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test006.rdf +28 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test007.nt +20 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test007.rdf +32 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test008.nt +15 -0
- data/spec/rdfcore/rdf-containers-syntax-vs-schema/test008.rdf +28 -0
- data/spec/rdfcore/rdf-element-not-mandatory/test001.nt +10 -0
- data/spec/rdfcore/rdf-element-not-mandatory/test001.rdf +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0001.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0001.rdf +35 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0003.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0003.rdf +35 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0004.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0004.rdf +34 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0005.nt +15 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0005.rdf +40 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0006.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0006.rdf +32 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0009.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0009.rdf +32 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0010.nt +14 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0010.rdf +38 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0011.nt +15 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0011.rdf +40 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0012.nt +15 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0012.rdf +40 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0013.nt +15 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0013.rdf +40 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0014.nt +15 -0
- data/spec/rdfcore/rdf-ns-prefix-confusion/test0014.rdf +42 -0
- data/spec/rdfcore/rdfms-abouteach/error001.rdf +35 -0
- data/spec/rdfcore/rdfms-abouteach/error002.rdf +35 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/error1.rdf +25 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test1.nt +14 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test1.rdf +22 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test2.nt +14 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test2.rdf +22 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test3.nt +14 -0
- data/spec/rdfcore/rdfms-difference-between-ID-and-about/test3.rdf +22 -0
- data/spec/rdfcore/rdfms-duplicate-member-props/test001.nt +17 -0
- data/spec/rdfcore/rdfms-duplicate-member-props/test001.rdf +30 -0
- data/spec/rdfcore/rdfms-empty-property-elements/error001.rdf +33 -0
- data/spec/rdfcore/rdfms-empty-property-elements/error002.rdf +33 -0
- data/spec/rdfcore/rdfms-empty-property-elements/error003.rdf +39 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test001.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test001.rdf +33 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test002.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test002.rdf +31 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test003.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test003.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test004.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test004.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test005.nt +18 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test005.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test006.nt +18 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test006.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test007.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test007.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test008.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test008.rdf +31 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test009.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test009.rdf +32 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test010.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test010.rdf +31 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test011.nt +18 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test011.rdf +30 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test012.nt +18 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test012.rdf +30 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test013.nt +15 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test013.rdf +35 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test014.nt +15 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test014.rdf +34 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test015.nt +15 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test015.rdf +38 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test016.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test016.rdf +31 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test017.nt +14 -0
- data/spec/rdfcore/rdfms-empty-property-elements/test017.rdf +38 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test001.nt +14 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test001.rdf +33 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test002.nt +15 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test002.rdf +33 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test003.nt +14 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test003.rdf +31 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test004.nt +15 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test004.rdf +33 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test005.nt +14 -0
- data/spec/rdfcore/rdfms-identity-anon-resources/test005.rdf +31 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test001.nt +19 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test001.rdf +29 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test002.nt +15 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test002.rdf +29 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test004.nt +18 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test004.rdf +29 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test005.nt +19 -0
- data/spec/rdfcore/rdfms-not-id-and-resource-attr/test005.rdf +29 -0
- data/spec/rdfcore/rdfms-para196/test001.nt +17 -0
- data/spec/rdfcore/rdfms-para196/test001.rdf +35 -0
- data/spec/rdfcore/rdfms-rdf-id/error001.rdf +26 -0
- data/spec/rdfcore/rdfms-rdf-id/error002.rdf +26 -0
- data/spec/rdfcore/rdfms-rdf-id/error003.rdf +29 -0
- data/spec/rdfcore/rdfms-rdf-id/error004.rdf +27 -0
- data/spec/rdfcore/rdfms-rdf-id/error005.rdf +31 -0
- data/spec/rdfcore/rdfms-rdf-id/error006.rdf +26 -0
- data/spec/rdfcore/rdfms-rdf-id/error007.rdf +29 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-001.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-002.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-003.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-004.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-005.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-006.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-007.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-008.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-009.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-010.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-011.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-012.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-013.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-014.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-015.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-016.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-017.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-018.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-019.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/error-020.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-001.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-001.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-002.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-002.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-003.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-003.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-004.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-004.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-005.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-005.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-006.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-006.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-007.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-007.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-008.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-008.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-009.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-009.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-010.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-010.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-011.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-011.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-012.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-012.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-013.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-013.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-014.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-014.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-015.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-015.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-016.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-016.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-017.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-017.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-018.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-018.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-019.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-019.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-020.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-020.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-021.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-021.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-022.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-022.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-023.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-023.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-024.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-024.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-025.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-025.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-026.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-026.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-027.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-027.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-028.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-028.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-029.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-029.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-030.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-030.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-031.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-031.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-032.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-032.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-033.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-033.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-034.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-034.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-035.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-035.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-036.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-036.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-037.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/test-037.rdf +24 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-001.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-001.rdf +23 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-002.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-002.rdf +25 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-003.nt +1 -0
- data/spec/rdfcore/rdfms-rdf-names-use/warn-003.rdf +24 -0
- data/spec/rdfcore/rdfms-reification-required/test001.nt +15 -0
- data/spec/rdfcore/rdfms-reification-required/test001.rdf +29 -0
- data/spec/rdfcore/rdfms-seq-representation/empty.nt +13 -0
- data/spec/rdfcore/rdfms-seq-representation/test001.nt +19 -0
- data/spec/rdfcore/rdfms-seq-representation/test001.rdf +33 -0
- data/spec/rdfcore/rdfms-seq-representation/test002.nt +14 -0
- data/spec/rdfcore/rdfms-seq-representation/test003a.nt +14 -0
- data/spec/rdfcore/rdfms-seq-representation/test003b.nt +14 -0
- data/spec/rdfcore/rdfms-seq-representation/test004.nt +14 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error001.rdf +26 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error002.rdf +26 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error003.rdf +29 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error004.rdf +25 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error005.rdf +25 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/error006.rdf +28 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test001.nt +14 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test001.rdf +28 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test002.nt +19 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test002.rdf +38 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test003.nt +17 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test003.rdf +28 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test004.nt +21 -0
- data/spec/rdfcore/rdfms-syntax-incomplete/test004.rdf +36 -0
- data/spec/rdfcore/rdfms-uri-substructure/error001.nt +18 -0
- data/spec/rdfcore/rdfms-uri-substructure/test001.nt +17 -0
- data/spec/rdfcore/rdfms-uri-substructure/test001.rdf +29 -0
- data/spec/rdfcore/rdfms-xml-literal-namespaces/test001.nt +13 -0
- data/spec/rdfcore/rdfms-xml-literal-namespaces/test001.rdf +33 -0
- data/spec/rdfcore/rdfms-xml-literal-namespaces/test002.nt +14 -0
- data/spec/rdfcore/rdfms-xml-literal-namespaces/test002.rdf +47 -0
- data/spec/rdfcore/rdfms-xmllang/test001.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test001.rdf +30 -0
- data/spec/rdfcore/rdfms-xmllang/test002.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test002.rdf +29 -0
- data/spec/rdfcore/rdfms-xmllang/test003.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test003.rdf +28 -0
- data/spec/rdfcore/rdfms-xmllang/test004.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test004.rdf +28 -0
- data/spec/rdfcore/rdfms-xmllang/test005.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test005.rdf +28 -0
- data/spec/rdfcore/rdfms-xmllang/test006.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test006.rdf +29 -0
- data/spec/rdfcore/rdfms-xmllang/test007a.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test007b.nt +14 -0
- data/spec/rdfcore/rdfms-xmllang/test007c.nt +14 -0
- data/spec/rdfcore/rdfs-container-membership-superProperty/not1C.rdf +13 -0
- data/spec/rdfcore/rdfs-container-membership-superProperty/not1P.rdf +14 -0
- data/spec/rdfcore/rdfs-domain-and-range/nonconclusions005.rdf +28 -0
- data/spec/rdfcore/rdfs-domain-and-range/nonconclusions006.rdf +28 -0
- data/spec/rdfcore/rdfs-domain-and-range/premises005.rdf +32 -0
- data/spec/rdfcore/rdfs-domain-and-range/premises006.rdf +32 -0
- data/spec/rdfcore/rdfs-domain-and-range/test001.nt +16 -0
- data/spec/rdfcore/rdfs-domain-and-range/test001.rdf +29 -0
- data/spec/rdfcore/rdfs-domain-and-range/test002.nt +16 -0
- data/spec/rdfcore/rdfs-domain-and-range/test002.rdf +29 -0
- data/spec/rdfcore/rdfs-entailment/test001.nt +16 -0
- data/spec/rdfcore/rdfs-entailment/test002.nt +15 -0
- data/spec/rdfcore/rdfs-no-cycles-in-subClassOf/test001.nt +18 -0
- data/spec/rdfcore/rdfs-no-cycles-in-subClassOf/test001.rdf +37 -0
- data/spec/rdfcore/rdfs-no-cycles-in-subPropertyOf/test001.nt +18 -0
- data/spec/rdfcore/rdfs-no-cycles-in-subPropertyOf/test001.rdf +40 -0
- data/spec/rdfcore/rdfs-subClassOf-a-Property/test001.nt +15 -0
- data/spec/rdfcore/rdfs-subPropertyOf-semantics/test001.nt +24 -0
- data/spec/rdfcore/rdfs-subPropertyOf-semantics/test002.nt +21 -0
- data/spec/rdfcore/statement-entailment/test001a.nt +12 -0
- data/spec/rdfcore/statement-entailment/test001b.nt +2 -0
- data/spec/rdfcore/statement-entailment/test002a.nt +2 -0
- data/spec/rdfcore/statement-entailment/test002b.nt +5 -0
- data/spec/rdfcore/tex-01/test001.rdf +34 -0
- data/spec/rdfcore/tex-01/test002.rdf +33 -0
- data/spec/rdfcore/unrecognised-xml-attributes/test001.nt +15 -0
- data/spec/rdfcore/unrecognised-xml-attributes/test001.rdf +31 -0
- data/spec/rdfcore/unrecognised-xml-attributes/test002.nt +14 -0
- data/spec/rdfcore/unrecognised-xml-attributes/test002.rdf +32 -0
- data/spec/rdfcore/xml-canon/test001.nt +16 -0
- data/spec/rdfcore/xml-canon/test001.rdf +28 -0
- data/spec/rdfcore/xmlbase/test001.nt +14 -0
- data/spec/rdfcore/xmlbase/test001.rdf +27 -0
- data/spec/rdfcore/xmlbase/test002.nt +14 -0
- data/spec/rdfcore/xmlbase/test002.rdf +28 -0
- data/spec/rdfcore/xmlbase/test003.nt +14 -0
- data/spec/rdfcore/xmlbase/test003.rdf +25 -0
- data/spec/rdfcore/xmlbase/test004.nt +18 -0
- data/spec/rdfcore/xmlbase/test004.rdf +27 -0
- data/spec/rdfcore/xmlbase/test006.nt +15 -0
- data/spec/rdfcore/xmlbase/test006.rdf +26 -0
- data/spec/rdfcore/xmlbase/test007.nt +14 -0
- data/spec/rdfcore/xmlbase/test007.rdf +25 -0
- data/spec/rdfcore/xmlbase/test008.nt +14 -0
- data/spec/rdfcore/xmlbase/test008.rdf +25 -0
- data/spec/rdfcore/xmlbase/test009.nt +14 -0
- data/spec/rdfcore/xmlbase/test009.rdf +26 -0
- data/spec/rdfcore/xmlbase/test010.nt +14 -0
- data/spec/rdfcore/xmlbase/test010.rdf +26 -0
- data/spec/rdfcore/xmlbase/test011.nt +14 -0
- data/spec/rdfcore/xmlbase/test011.rdf +27 -0
- data/spec/rdfcore/xmlbase/test013.nt +15 -0
- data/spec/rdfcore/xmlbase/test013.rdf +28 -0
- data/spec/rdfcore/xmlbase/test014.nt +15 -0
- data/spec/rdfcore/xmlbase/test014.rdf +28 -0
- data/spec/rdfcore/xmlsch-02/test001.rdf +34 -0
- data/spec/rdfcore/xmlsch-02/test002.rdf +34 -0
- data/spec/rdfcore/xmlsch-02/test003.rdf +37 -0
- data/spec/rdfcore_helper.rb +137 -0
- data/spec/rdfxml_spec.rb +349 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/store_spec.rb +205 -0
- data/spec/string_hacks_spec.rb +21 -0
- data/spec/triple_spec.rb +172 -0
- data/spec/uriref_spec.rb +117 -0
- data/test/longtests_spec.rb +25 -0
- data/test/n3_tests/lcsh/sh85062913.n3 +41 -0
- data/test/n3_tests/lcsh/sh85062913.nt +21 -0
- data/test/n3_tests/lcsh/sh85082139.n3 +157 -0
- data/test/n3_tests/lcsh/sh85082139.nt +79 -0
- data/test/n3_tests/lcsh/sh85118553.n3 +123 -0
- data/test/n3_tests/lcsh/sh85118553.nt +63 -0
- data/test/n3_tests/misc/on_now-01.n3 +30 -0
- data/test/n3_tests/misc/on_now-01.nt +15 -0
- data/test/n3_tests/n3p/simple-01.n3 +1 -0
- data/test/n3_tests/n3p/simple-01.nt +0 -0
- data/test/n3_tests/n3p/simple-02.n3 +4 -0
- data/test/n3_tests/n3p/simple-02.nt +0 -0
- data/test/n3_tests/n3p/simple-03.n3 +5 -0
- data/test/n3_tests/n3p/simple-03.nt +1 -0
- data/test/n3_tests/n3p/simple-04.n3 +6 -0
- data/test/n3_tests/n3p/simple-04.nt +3 -0
- data/test/n3_tests/n3p/simple-05.n3 +7 -0
- data/test/n3_tests/n3p/simple-05.nt +2 -0
- data/test/n3_tests/n3p/simple-06.n3 +6 -0
- data/test/n3_tests/n3p/simple-06.nt +4 -0
- data/test/n3_tests/n3p/simple-07.n3 +7 -0
- data/test/n3_tests/n3p/simple-07.nt +6 -0
- data/test/perf_test/test.rb +11 -0
- data/test/perf_test/tommorris.rdf +2267 -0
- data/test/rdf_tests/cc197bad-dc9c-440d-a5b5-d52ba2e14234.nt +24 -0
- data/test/rdf_tests/cc197bad-dc9c-440d-a5b5-d52ba2e14234.rdf +46 -0
- data/test/rdf_tests/tm_001.nt +1 -0
- data/test/rdf_tests/tm_001.rdf +7 -0
- data/test/rdf_tests/xml-literal-mixed.nt +7 -0
- data/test/rdf_tests/xml-literal-mixed.rdf +15 -0
- data/test/xml.rdf +6 -0
- metadata +698 -0
data/.autotest
ADDED
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/History.txt
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
=== 0.2.1
|
2
|
+
* Added MemoryStore, a context-aware store based on Python RDFLib IOMemory
|
3
|
+
* Add ConjunctiveGraph, a conjunction of all graphs in a context-aware store
|
4
|
+
* Triple(nil, nil, nil) is wildcard, plus variations. No support for regular expressions.
|
5
|
+
* BNodes not graph/store specific, generated using milli-second time and sequence.
|
6
|
+
* Graph(:store) may be one of :list_store or :memory_store, which will instanciate appropriate store
|
7
|
+
* Graph#contains? iterates over triples if object is a literal to allow for fuzzy matching.
|
8
|
+
* Change gem name to "gkellogg-reddy" to allow publishing to Github.
|
9
|
+
* ConjunctiveGraph tests.
|
10
|
+
|
11
|
+
=== 0.2.0
|
12
|
+
* API and RDoc cleanup
|
13
|
+
* Removed Graph#each_with_subject, Graph#get_resource, Graph#has_bnode_identifier?
|
14
|
+
* Added Graph#predicates and Graph#objects
|
15
|
+
* Changed Graph#triples to take optional subject predicate and object to match statements.
|
16
|
+
* Renamed Graph#bind o Graph#merge!
|
17
|
+
* Graph#triples yields triples if a block is provided
|
18
|
+
* Changed Namespace#short to Namespace#prefix
|
19
|
+
* Change BNode to require a graph. Most uses go from graph.bnode, rather than BNode.new. This is required because bnodes are only equivalent within the same graph
|
20
|
+
* Added identifier to Graph, defaults to BNode. This from Python RDFlib based on TriX recommendation, see: http://www.w3.org/2004/03/trix/
|
21
|
+
* Only add triple to graph if it does not already exist in graph.
|
22
|
+
* Added Graph#contains? to look for existance of triple.
|
23
|
+
* Added Graph#eql? (and ===) to do simple check for graph equality. This version ignores BNodes (like Python RDFlib)
|
24
|
+
* Prepend "named" to named BNodes to ensure no overlap between generated and named BNodes.
|
25
|
+
* Added Graph#clone and Triple#clone
|
26
|
+
* Merge Graphs, replacing BNodes with new values from new graph.
|
27
|
+
* Remove duplicate triples when adding or merging graphs
|
28
|
+
* Added Abstract Store and List Store.
|
29
|
+
* Delegate Graph methods to store. Currently only supports :list.
|
30
|
+
* Reduce dependence on HTML namespace in RDFa parser.
|
31
|
+
* Add RDFa tests for HTML4 and HTML5
|
32
|
+
|
33
|
+
=== 0.1.5
|
34
|
+
* Update RDFa tests to use Reddy RDF/XML parser.
|
35
|
+
* All negative RDF/XML parser tests pass.
|
36
|
+
* Add Reddy::Parser, super-class of other parsers and move common code.
|
37
|
+
* Change N3Parser to use same new/parse logic as other parsers.
|
38
|
+
* Remove debug array by default, and add in calls to tests.
|
39
|
+
=== 0.1.4
|
40
|
+
* Update N3 treetop parser to version 1.4.0 (no digits in parser rule names).
|
41
|
+
* Fix N3 literal handling (still has bug with escaped double quote).
|
42
|
+
* Handle N3 <#> prefix.
|
43
|
+
* Don't output lang for typed literals in n3 format
|
44
|
+
* Rewrite of RDF/XML parser based on spec; passes existing tests.
|
45
|
+
* Update rdfcore tests based on rdfa test harness.
|
46
|
+
* Move Literal string escape/unescape to string_hacks.
|
47
|
+
* Fix literal n3_encoded parsing.
|
48
|
+
* All positive RDF/XML parser tests pass.
|
49
|
+
|
50
|
+
=== 0.1.3
|
51
|
+
* Added rdfa-test-suite as sub-module and refactored RDFa tests to use them.
|
52
|
+
* Fix but in white-space separated attributes
|
53
|
+
* Downcase XHTML reserved words
|
54
|
+
|
55
|
+
=== 0.1.2
|
56
|
+
* Move most test-case logic into rdfa_helper.
|
57
|
+
* Separate approved and unreviewed tests.
|
58
|
+
* Allow for soft failure of unreviewed tests by catching Spec::Expectations::ExpectationNotMetError.
|
59
|
+
* Integrate rdfa-test-suite and create test cases in the same manner. (Causing SPARQL problems with XMLLiterals)
|
60
|
+
|
61
|
+
=== 0.1.1 / 2009-11-01
|
62
|
+
* Changes from rdfa_parser project.
|
63
|
+
|
64
|
+
=== 0.1.0 / 2008-12-02
|
65
|
+
|
66
|
+
* First public alpha. RDF/XML parsing works but is not fully spec or test compliant. There is much work to be done.
|
data/README.rdoc
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
= reddy
|
2
|
+
|
3
|
+
A set of compliant RDF parsers:
|
4
|
+
* N3-rdf
|
5
|
+
* RDF/XML
|
6
|
+
* RDFa
|
7
|
+
|
8
|
+
== DESCRIPTION:
|
9
|
+
|
10
|
+
Reddy is an RDF library for Ruby.
|
11
|
+
|
12
|
+
== FEATURES:
|
13
|
+
Reddy parses RDF/XML, RDFa and N3-rdf into a Graph object. It also serializes RDF/XML and N-Triples from the Graph.
|
14
|
+
|
15
|
+
* Fully compliant RDF/XML parser.
|
16
|
+
* Fully compliant XHTML/RDFa 1.0 parser.
|
17
|
+
* N3-rdf parser
|
18
|
+
* N-Triples and RDF/XML serializer
|
19
|
+
* RDFa tests use SPARQL for most tests due to Rasqal limitations. Other tests compare directly against N-triples.
|
20
|
+
* Graph serializes into RDF/XML and N-Triples.
|
21
|
+
* ConjunctiveGraph, named Graphs and contextual storage modules.
|
22
|
+
|
23
|
+
Install with 'gem install gkellogg-reddy'
|
24
|
+
|
25
|
+
== SYNOPSIS:
|
26
|
+
|
27
|
+
A simple RDF library for Ruby has been necessary for some time.
|
28
|
+
|
29
|
+
Basic usage:
|
30
|
+
|
31
|
+
require 'reddy'
|
32
|
+
parser = Reddy::RdfXmlParser.new
|
33
|
+
parser.parse(stream, base_uri) do |triple|
|
34
|
+
puts triple.to_ntriple
|
35
|
+
end
|
36
|
+
|
37
|
+
or
|
38
|
+
|
39
|
+
graph = parser.parse(stream, base_uri)
|
40
|
+
graph.to_rdfxml
|
41
|
+
|
42
|
+
== REQUIREMENTS:
|
43
|
+
|
44
|
+
* Addressable
|
45
|
+
* Treetop
|
46
|
+
* Whatlanguage
|
47
|
+
* nokogiri
|
48
|
+
* facets
|
49
|
+
|
50
|
+
=== For testing
|
51
|
+
* Redland/Rasqal
|
52
|
+
|
53
|
+
== INSTALL:
|
54
|
+
|
55
|
+
* (sudo gem install reddy)
|
56
|
+
|
57
|
+
== TODO:
|
58
|
+
* Testing
|
59
|
+
* Integrate ntriples tests in spec/ntriples/test.nt
|
60
|
+
* Turtle tests from http://www.w3.org/2000/10/swap/test/n3/turtle-manifest.n3 (if can find .ttl and .out files)
|
61
|
+
* N3-RDF tests from http://www.w3.org/2000/10/swap/test/n3/n3-rdf.tests
|
62
|
+
* N3-Full tests from http://www.w3.org/2000/10/swap/test/n3/n3-full.tests
|
63
|
+
* N3 grammar tests?
|
64
|
+
* RDFa updates for new tests and non XHTML representations.
|
65
|
+
* Graphs
|
66
|
+
* Pluggable storage modules
|
67
|
+
* Contexts
|
68
|
+
* n3 serialization
|
69
|
+
* Graph operations from Redland
|
70
|
+
* SPARQL
|
71
|
+
* RDFS logic and RDF entailment tests
|
72
|
+
* Ruby objects
|
73
|
+
* ActiveRDF-like class support
|
74
|
+
* Integrate with RDFObjects (http://github.com/rsinger/RDFObjects)
|
75
|
+
|
76
|
+
== LICENSE:
|
77
|
+
|
78
|
+
(The MIT License)
|
79
|
+
|
80
|
+
Copyright (c) 2008 Tom Morris and contributors
|
81
|
+
Copyright (c) 2009 Gregg Kellogg
|
82
|
+
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
84
|
+
a copy of this software and associated documentation files (the
|
85
|
+
'Software'), to deal in the Software without restriction, including
|
86
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
87
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
88
|
+
permit persons to whom the Software is furnished to do so, subject to
|
89
|
+
the following conditions:
|
90
|
+
|
91
|
+
The above copyright notice and this permission notice shall be
|
92
|
+
included in all copies or substantial portions of the Software.
|
93
|
+
|
94
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
95
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
96
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
97
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
98
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
99
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
100
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
101
|
+
|
102
|
+
== FEEDBACK
|
103
|
+
|
104
|
+
* tom@tommorris.org or gregg@kellogg-assoc.com
|
105
|
+
* github.com/tommorris/reddy or github.com/gkellogg/reddy
|
106
|
+
* tommorris.lighthouseapp.com for bug reports
|
107
|
+
* public-rdf-ruby mailing list on w3.org
|
data/Rakefile
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
begin
|
3
|
+
gem 'jeweler'
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gemspec|
|
6
|
+
gemspec.name = "gkellogg-reddy"
|
7
|
+
gemspec.summary = "Reddy is an RDF library for Ruby."
|
8
|
+
gemspec.description = <<-DESCRIPTION
|
9
|
+
Reddy parses RDF/XML, RDFa and N3-rdf into a Graph object. It also serializes RDF/XML and N-Triples from the Graph.
|
10
|
+
|
11
|
+
* Fully compliant RDF/XML parser.
|
12
|
+
* Fully compliant XHTML/RDFa 1.0 parser.
|
13
|
+
* N3-rdf parser
|
14
|
+
* N-Triples and RDF/XML serializer
|
15
|
+
* Graph serializes into RDF/XML and N-Triples.
|
16
|
+
* ConjunctiveGraph, named Graphs and contextual storage modules.
|
17
|
+
|
18
|
+
Install with 'gem install gkellogg-reddy'
|
19
|
+
DESCRIPTION
|
20
|
+
gemspec.email = "gregg@kellogg-assoc.com"
|
21
|
+
gemspec.homepage = "http://github.com/gkellogg/reddy"
|
22
|
+
gemspec.authors = ["Gregg Kellogg", "Tom Morris"]
|
23
|
+
gemspec.add_dependency('addressable', '>= 2.0.0')
|
24
|
+
gemspec.add_dependency('treetop', '>= 1.4.0')
|
25
|
+
gemspec.add_dependency('libxml-ruby', '>= 0.8.3')
|
26
|
+
gemspec.add_dependency('whatlanguage', '>= 1.0.0')
|
27
|
+
gemspec.add_dependency('nokogiri', '>= 1.3.3')
|
28
|
+
gemspec.add_dependency('builder', '>= 2.1.2')
|
29
|
+
gemspec.add_development_dependency('rspec')
|
30
|
+
gemspec.add_development_dependency('active_support', '>= 2.3.0')
|
31
|
+
gemspec.extra_rdoc_files = %w(README.rdoc History.txt)
|
32
|
+
end
|
33
|
+
Jeweler::GemcutterTasks.new
|
34
|
+
rescue LoadError
|
35
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
36
|
+
end
|
37
|
+
|
38
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
39
|
+
#task :default => [:spec, :features]
|
40
|
+
|
41
|
+
desc "Pushes to git"
|
42
|
+
task :push do
|
43
|
+
sh "git push --all"
|
44
|
+
sh "growlnotify -m \"Updates pushed\" \"Git\""
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'spec/rake/spectask'
|
48
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
49
|
+
spec.libs << 'lib' << 'spec'
|
50
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Turns spec results into HTML and publish to web (Tom only!)"
|
54
|
+
task :spec_html do
|
55
|
+
sh "spec --format html:reddy_new_spec.html spec"
|
56
|
+
sh "scp reddy_new_spec.html bbcityco@bbcity.co.uk:www/tom/files/rena_new_spec.html"
|
57
|
+
sh "rm reddy_new_spec.html"
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "Turns spec results into local HTML"
|
61
|
+
task :spec_local do
|
62
|
+
sh "spec --format html:reddy_new_spec.html spec/"
|
63
|
+
# sh "open reddy_new_spec.html"
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "Run specs through RCov"
|
67
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
68
|
+
spec.libs << 'lib' << 'spec'
|
69
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
70
|
+
spec.rcov = true
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Runs specs on JRuby"
|
74
|
+
task :jspec do
|
75
|
+
sh "jruby -S `whereis spec` --colour spec"
|
76
|
+
end
|
77
|
+
|
78
|
+
task :spec => :check_dependencies
|
79
|
+
|
80
|
+
task :default => :spec
|
81
|
+
|
82
|
+
require 'rake/rdoctask'
|
83
|
+
Rake::RDocTask.new do |rdoc|
|
84
|
+
if File.exist?('VERSION')
|
85
|
+
version = File.read('VERSION')
|
86
|
+
else
|
87
|
+
version = RdfaParser::VERSION
|
88
|
+
end
|
89
|
+
|
90
|
+
rdoc.rdoc_dir = 'rdoc'
|
91
|
+
rdoc.title = "rdfa_parser #{version}"
|
92
|
+
rdoc.rdoc_files.include('README*', "History.txt")
|
93
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
94
|
+
end
|
95
|
+
|
96
|
+
# vim: syntax=Ruby
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.1
|
data/bin/reddy
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby -s
|
2
|
+
require 'rubygems'
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/reddy")
|
4
|
+
require 'getoptlong'
|
5
|
+
class Parse
|
6
|
+
include Reddy
|
7
|
+
def parse(file, base_uri)
|
8
|
+
puts "Parse: #{file}" if $quiet
|
9
|
+
parser = case file
|
10
|
+
when /\.nt$/ then N3Parser.new
|
11
|
+
when /\.x?html/ then RdfaParser.new
|
12
|
+
else RdfXmlParser.new
|
13
|
+
end
|
14
|
+
parser.parse(File.read(file), base_uri, :strict => true)
|
15
|
+
output = case $format
|
16
|
+
when "xml"
|
17
|
+
parser.graph.to_rdfxml
|
18
|
+
else
|
19
|
+
parser.graph.to_ntriples
|
20
|
+
end
|
21
|
+
puts output unless $quiet
|
22
|
+
|
23
|
+
puts parser.debug.join("\n\t") if $verbose
|
24
|
+
rescue RdfException => e
|
25
|
+
puts "Parse failure: #{e.message}"
|
26
|
+
puts parser.debug if $verbose && parser
|
27
|
+
#raise
|
28
|
+
rescue Exception => e
|
29
|
+
puts "Parser fault: #{e.message}"
|
30
|
+
puts parser.debug if parser && !$quiet
|
31
|
+
raise
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
$verbose = false
|
36
|
+
base_uri = "http://example.com"
|
37
|
+
|
38
|
+
opts = GetoptLong.new(
|
39
|
+
["--verbose", GetoptLong::NO_ARGUMENT],
|
40
|
+
["--quiet", GetoptLong::NO_ARGUMENT],
|
41
|
+
["--debug", GetoptLong::NO_ARGUMENT],
|
42
|
+
["--format", GetoptLong::REQUIRED_ARGUMENT],
|
43
|
+
["--uri", GetoptLong::REQUIRED_ARGUMENT]
|
44
|
+
)
|
45
|
+
opts.each do |opt, arg|
|
46
|
+
case opt
|
47
|
+
when '--verbose' then $verbose = true
|
48
|
+
when '--quiet' then $quiet = true
|
49
|
+
when '--debug' then $DEBUG = true
|
50
|
+
when '--format' then $format = arg
|
51
|
+
when '--uri' then base_uri = arg
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
x = Parse.new
|
56
|
+
ARGV.each do |test_file|
|
57
|
+
x.parse(test_file, base_uri)
|
58
|
+
end
|
59
|
+
|
data/lib/reddy.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
$:.unshift(File.dirname('reddy'))
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'nokogiri'
|
7
|
+
require 'addressable/uri'
|
8
|
+
require 'builder'
|
9
|
+
require 'treetop'
|
10
|
+
rescue LoadError
|
11
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
12
|
+
gem 'nokogiri'
|
13
|
+
gem 'addressable'
|
14
|
+
require 'nokogiri'
|
15
|
+
require 'addressable/uri'
|
16
|
+
require 'builder'
|
17
|
+
require 'treetop'
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'reddy/**.rb')).each { |f| require f }
|
21
|
+
|
22
|
+
# Include Storage types, but be tollerant of failure to load as dependencies might not be available
|
23
|
+
Dir.glob(File.join(File.dirname(__FILE__), "reddy/store/**.rb")).each do |f|
|
24
|
+
begin
|
25
|
+
require f
|
26
|
+
rescue LoadError
|
27
|
+
puts "Error loading #{f}: #{$!}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Reddy
|
32
|
+
VERSION = File.read(File.join(File.dirname(__FILE__), "..", "VERSION")).chop # Version in parent directory
|
33
|
+
|
34
|
+
LINK_TYPES = %w(
|
35
|
+
alternate appendix bookmark cite chapter contents copyright first glossary
|
36
|
+
help icon index last license meta next p3pv1 prev role section stylesheet subsection
|
37
|
+
start top up
|
38
|
+
)
|
39
|
+
|
40
|
+
NC_REGEXP = Regexp.new(
|
41
|
+
%{^
|
42
|
+
(?!\\\\u0301) # ́ is a non-spacing acute accent.
|
43
|
+
# It is legal within an XML Name, but not as the first character.
|
44
|
+
( [a-zA-Z_]
|
45
|
+
| \\\\u[0-9a-fA-F]
|
46
|
+
)
|
47
|
+
( [0-9a-zA-Z_\.-]
|
48
|
+
| \\\\u([0-9a-fA-F]{4}) # \u followed by a sequence of four hex digits
|
49
|
+
)*
|
50
|
+
$},
|
51
|
+
Regexp::EXTENDED)
|
52
|
+
|
53
|
+
RDF_TYPE = URIRef.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
|
54
|
+
XML_LITERAL = Literal::Encoding.xmlliteral
|
55
|
+
|
56
|
+
RDF_NS = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf")
|
57
|
+
RDFS_NS = Namespace.new("http://www.w3.org/2000/01/rdf-schema#", "rdfs")
|
58
|
+
XHV_NS = Namespace.new("http://www.w3.org/1999/xhtml/vocab#", "xhv")
|
59
|
+
XML_NS = Namespace.new("http://www.w3.org/XML/1998/namespace", "xml")
|
60
|
+
|
61
|
+
XH_MAPPING = {"" => Namespace.new("http://www.w3.org/1999/xhtml/vocab\#", nil)}
|
62
|
+
end
|
data/lib/reddy/bnode.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
module Reddy
|
2
|
+
# The BNode class creates RDF blank nodes.
|
3
|
+
class BNode
|
4
|
+
attr_reader :identifier
|
5
|
+
|
6
|
+
# Create a new BNode, optionally accept a identifier for the BNode.
|
7
|
+
# Otherwise, generated sequentially.
|
8
|
+
#
|
9
|
+
# A BNode may have a bank (empty string) identifier, which will be equivalent to another
|
10
|
+
# blank identified BNode.
|
11
|
+
#
|
12
|
+
# Identifiers only have meaning within a particular parsing context, and are used
|
13
|
+
# to lookup previoiusly defined BNodes using the same identifier. Names are *not* preserved
|
14
|
+
# within the underlying storage model.
|
15
|
+
#
|
16
|
+
# @param [String] identifier:: Legal NCName or nil for a named BNode
|
17
|
+
# @param [Hash] context:: Context used to store named BNodes
|
18
|
+
#
|
19
|
+
# @author Gregg Kellogg
|
20
|
+
def initialize(identifier = nil, context = {})
|
21
|
+
if identifier != nil && self.valid_id?(identifier)
|
22
|
+
identifier = identifier.sub(/nbn\d+[a-z]+N/, '') # creating a named BNode from a named BNode
|
23
|
+
# Generate a name if it's blank. Always prepend "named" to avoid generation overlap
|
24
|
+
@identifier = context[identifier] ||= generate_bn_identifier(identifier)
|
25
|
+
else
|
26
|
+
@identifier = generate_bn_identifier
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Return BNode identifier
|
31
|
+
def to_s
|
32
|
+
return self.identifier.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Exports the BNode in N-Triples form.
|
37
|
+
#
|
38
|
+
# ==== Example
|
39
|
+
# b = BNode.new; b.to_n3 # => returns a string of the BNode in n3 form
|
40
|
+
#
|
41
|
+
# @return [String]:: The BNode in n3.
|
42
|
+
#
|
43
|
+
# @author Tom Morris
|
44
|
+
def to_n3
|
45
|
+
"_:#{self.identifier}"
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Exports the BNode in N-Triples form.
|
50
|
+
#
|
51
|
+
# Syonym for to_n3
|
52
|
+
def to_ntriples
|
53
|
+
self.to_n3
|
54
|
+
end
|
55
|
+
|
56
|
+
# Output URI as resource reference for RDF/XML
|
57
|
+
#
|
58
|
+
# ==== Example
|
59
|
+
# b = BNode.new("foo"); b.xml_args # => [{"rdf:nodeID" => "foo"}]
|
60
|
+
def xml_args
|
61
|
+
[{"rdf:nodeID" => self.identifier}]
|
62
|
+
end
|
63
|
+
|
64
|
+
# The identifier used used for this BNode.
|
65
|
+
def identifier
|
66
|
+
@identifier
|
67
|
+
end
|
68
|
+
|
69
|
+
# Compare BNodes. BNodes are equivalent if they have the same identifier
|
70
|
+
def eql?(other)
|
71
|
+
other.class == self.class &&
|
72
|
+
other.identifier == self.identifier
|
73
|
+
end
|
74
|
+
alias_method :==, :eql?
|
75
|
+
|
76
|
+
# Needed for uniq
|
77
|
+
def hash; self.to_s.hash; end
|
78
|
+
|
79
|
+
def inspect
|
80
|
+
"[bn:#{identifier}]"
|
81
|
+
end
|
82
|
+
|
83
|
+
protected
|
84
|
+
def valid_id?(name)
|
85
|
+
NC_REGEXP.match(name) || name.empty?
|
86
|
+
end
|
87
|
+
|
88
|
+
# Generate a unique identifier (time with milliseconds plus generated increment)
|
89
|
+
def generate_bn_identifier(name = nil)
|
90
|
+
@@base ||= "bn#{(Time.now.to_f * 1000).to_i}"
|
91
|
+
@@next_generated ||= "a"
|
92
|
+
if name
|
93
|
+
bn = "n#{@@base}#{@@next_generated}N#{name}"
|
94
|
+
else
|
95
|
+
bn = "#{@@base}#{@@next_generated}"
|
96
|
+
end
|
97
|
+
@@next_generated = @@next_generated.succ
|
98
|
+
bn
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|