rdf_context 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.autotest +2 -0
- data/.gitignore +10 -0
- data/.gitmodules +3 -0
- data/History.txt +73 -0
- data/README.rdoc +145 -0
- data/Rakefile +77 -0
- data/VERSION +1 -0
- data/bin/reddy +59 -0
- data/lib/rdf_context.rb +60 -0
- data/lib/rdf_context/bnode.rb +99 -0
- data/lib/rdf_context/conjunctive_graph.rb +47 -0
- data/lib/rdf_context/exceptions.rb +11 -0
- data/lib/rdf_context/graph.rb +333 -0
- data/lib/rdf_context/literal.rb +340 -0
- data/lib/rdf_context/n3_grammar.rb +2171 -0
- data/lib/rdf_context/n3_grammar.treetop +143 -0
- data/lib/rdf_context/n3parser.rb +152 -0
- data/lib/rdf_context/namespace.rb +82 -0
- data/lib/rdf_context/nokogiri_hacks.rb +8 -0
- data/lib/rdf_context/parser.rb +119 -0
- data/lib/rdf_context/rdfaparser.rb +398 -0
- data/lib/rdf_context/rdfxmlparser.rb +525 -0
- data/lib/rdf_context/store/abstract_sql_store.rb +843 -0
- data/lib/rdf_context/store/abstract_store.rb +64 -0
- data/lib/rdf_context/store/list_store.rb +63 -0
- data/lib/rdf_context/store/memory_store.rb +323 -0
- data/lib/rdf_context/store/sqlite3_store.rb +223 -0
- data/lib/rdf_context/string_hacks.rb +108 -0
- data/lib/rdf_context/term_utils.rb +196 -0
- data/lib/rdf_context/triple.rb +144 -0
- data/lib/rdf_context/uriref.rb +95 -0
- data/script/console +10 -0
- data/spec/bnode_spec.rb +58 -0
- data/spec/conjunctive_graph_spec.rb +60 -0
- data/spec/graph_spec.rb +390 -0
- data/spec/list_store_spec.rb +12 -0
- data/spec/literal_spec.rb +314 -0
- data/spec/matchers.rb +150 -0
- data/spec/memory_store_spec.rb +23 -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 +148 -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/rdfxml_helper.rb +137 -0
- data/spec/rdfxml_spec.rb +362 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/sqlite3_store_spec.rb +41 -0
- data/spec/store_helper.rb +231 -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 +696 -0
data/.autotest
ADDED
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/History.txt
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
=== 0.4.2
|
2
|
+
* Released as RdfContext gem
|
3
|
+
|
4
|
+
=== 0.2.2
|
5
|
+
* Added AbstractSqlStore and SQLite3Store
|
6
|
+
* Store contexts are always graphs
|
7
|
+
|
8
|
+
=== 0.2.1
|
9
|
+
* Added MemoryStore, a context-aware store based on Python RDFLib IOMemory
|
10
|
+
* Add ConjunctiveGraph, a conjunction of all graphs in a context-aware store
|
11
|
+
* Triple(nil, nil, nil) is wildcard, plus variations. No support for regular expressions.
|
12
|
+
* BNodes not graph/store specific, generated using milli-second time and sequence.
|
13
|
+
* Graph(:store) may be one of :list_store or :memory_store, which will instanciate appropriate store
|
14
|
+
* Graph#contains? iterates over triples if object is a literal to allow for fuzzy matching.
|
15
|
+
* Change gem name to "gkellogg-reddy" to allow publishing to Github.
|
16
|
+
* ConjunctiveGraph tests.
|
17
|
+
|
18
|
+
=== 0.2.0
|
19
|
+
* API and RDoc cleanup
|
20
|
+
* Removed Graph#each_with_subject, Graph#get_resource, Graph#has_bnode_identifier?
|
21
|
+
* Added Graph#predicates and Graph#objects
|
22
|
+
* Changed Graph#triples to take optional subject predicate and object to match statements.
|
23
|
+
* Renamed Graph#bind o Graph#merge!
|
24
|
+
* Graph#triples yields triples if a block is provided
|
25
|
+
* Changed Namespace#short to Namespace#prefix
|
26
|
+
* 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
|
27
|
+
* Added identifier to Graph, defaults to BNode. This from Python RDFlib based on TriX recommendation, see: http://www.w3.org/2004/03/trix/
|
28
|
+
* Only add triple to graph if it does not already exist in graph.
|
29
|
+
* Added Graph#contains? to look for existance of triple.
|
30
|
+
* Added Graph#eql? (and ===) to do simple check for graph equality. This version ignores BNodes (like Python RDFlib)
|
31
|
+
* Prepend "named" to named BNodes to ensure no overlap between generated and named BNodes.
|
32
|
+
* Added Graph#clone and Triple#clone
|
33
|
+
* Merge Graphs, replacing BNodes with new values from new graph.
|
34
|
+
* Remove duplicate triples when adding or merging graphs
|
35
|
+
* Added Abstract Store and List Store.
|
36
|
+
* Delegate Graph methods to store. Currently only supports :list.
|
37
|
+
* Reduce dependence on HTML namespace in RDFa parser.
|
38
|
+
* Add RDFa tests for HTML4 and HTML5
|
39
|
+
|
40
|
+
=== 0.1.5
|
41
|
+
* Update RDFa tests to use RdfContext RDF/XML parser.
|
42
|
+
* All negative RDF/XML parser tests pass.
|
43
|
+
* Add RdfContext::Parser, super-class of other parsers and move common code.
|
44
|
+
* Change N3Parser to use same new/parse logic as other parsers.
|
45
|
+
* Remove debug array by default, and add in calls to tests.
|
46
|
+
=== 0.1.4
|
47
|
+
* Update N3 treetop parser to version 1.4.0 (no digits in parser rule names).
|
48
|
+
* Fix N3 literal handling (still has bug with escaped double quote).
|
49
|
+
* Handle N3 <#> prefix.
|
50
|
+
* Don't output lang for typed literals in n3 format
|
51
|
+
* Rewrite of RDF/XML parser based on spec; passes existing tests.
|
52
|
+
* Update rdfcore tests based on rdfa test harness.
|
53
|
+
* Move Literal string escape/unescape to string_hacks.
|
54
|
+
* Fix literal n3_encoded parsing.
|
55
|
+
* All positive RDF/XML parser tests pass.
|
56
|
+
|
57
|
+
=== 0.1.3
|
58
|
+
* Added rdfa-test-suite as sub-module and refactored RDFa tests to use them.
|
59
|
+
* Fix but in white-space separated attributes
|
60
|
+
* Downcase XHTML reserved words
|
61
|
+
|
62
|
+
=== 0.1.2
|
63
|
+
* Move most test-case logic into rdfa_helper.
|
64
|
+
* Separate approved and unreviewed tests.
|
65
|
+
* Allow for soft failure of unreviewed tests by catching Spec::Expectations::ExpectationNotMetError.
|
66
|
+
* Integrate rdfa-test-suite and create test cases in the same manner. (Causing SPARQL problems with XMLLiterals)
|
67
|
+
|
68
|
+
=== 0.1.1 / 2009-11-01
|
69
|
+
* Changes from rdfa_parser project.
|
70
|
+
|
71
|
+
=== 0.1.0 / 2008-12-02
|
72
|
+
|
73
|
+
* 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,145 @@
|
|
1
|
+
= RdfContext
|
2
|
+
|
3
|
+
Context-sensitive RDF Graphs, including a ConjunctiveGraph.
|
4
|
+
|
5
|
+
A set of compliant RDF parsers:
|
6
|
+
* N3-rdf
|
7
|
+
* RDF/XML
|
8
|
+
* RDFa
|
9
|
+
|
10
|
+
Multiple datastores may be attached to a Graph, including Memory, List and SQLite3
|
11
|
+
|
12
|
+
== DESCRIPTION:
|
13
|
+
|
14
|
+
RdfContext is an RDF library for Ruby.
|
15
|
+
|
16
|
+
== FEATURES:
|
17
|
+
RdfContext parses RDF/XML, RDFa and N3-rdf into a Graph object. It also serializes RDF/XML and N-Triples from the Graph.
|
18
|
+
|
19
|
+
* Fully compliant RDF/XML parser.
|
20
|
+
* Fully compliant XHTML/RDFa 1.0 parser.
|
21
|
+
* N3-rdf parser
|
22
|
+
* N-Triples and RDF/XML serializer
|
23
|
+
* RDFa tests use SPARQL for most tests due to Rasqal limitations. Other tests compare directly against N-triples.
|
24
|
+
* Graph serializes into RDF/XML and N-Triples.
|
25
|
+
* ConjunctiveGraph, named Graphs and contextual storage modules.
|
26
|
+
|
27
|
+
RdfContext is based, in part, on Tom Morris' Reddy gem.
|
28
|
+
|
29
|
+
Install with 'gem install rdf_context'
|
30
|
+
|
31
|
+
== Usage:
|
32
|
+
=== Graphs
|
33
|
+
Instantiate a graph using Graph.new. A Graph may take an :identifier (defaults to a BNode) and
|
34
|
+
a :store (defaults to :list_store)
|
35
|
+
|
36
|
+
use RdfContext
|
37
|
+
g = Graph.new(:store => :list_store, :identifier => URIRef.new("http://example.com"))
|
38
|
+
g = Graph.new(:store => SQLite3Store.new(:path => "store.db"),
|
39
|
+
:identifier => URIRef.new("http://example.com"))
|
40
|
+
|
41
|
+
g.add(Triple.new(subject, predicate, object))
|
42
|
+
|
43
|
+
Graphs also store namespace associations, and can serialize graphs to RDF/XML or N-triples
|
44
|
+
|
45
|
+
g.bind(Namespace.new("http://example.com", "ex"))
|
46
|
+
g.namespace("ex")
|
47
|
+
g.prefix("http://example.com")
|
48
|
+
|
49
|
+
g.to_rdfxml
|
50
|
+
g.to_ntriples
|
51
|
+
|
52
|
+
Instantiate an existing graph from a datastore
|
53
|
+
|
54
|
+
s = SQLIte3Store.new(:path => "store.db")
|
55
|
+
g = Graph.new(:store => s, :identifier => "http://example.com/context")
|
56
|
+
|
57
|
+
=== Parsers
|
58
|
+
Instantiate a parser and parse source, specifying type and base-URL
|
59
|
+
|
60
|
+
use RdfContext
|
61
|
+
p = Parser.new
|
62
|
+
graph = p.parse(input, "http://example.com", :type => :rdfxml)
|
63
|
+
|
64
|
+
or, instantiate a type-specific parser:
|
65
|
+
|
66
|
+
p = RdfaParser.new
|
67
|
+
graph = p.parse(input, "http://example.com")
|
68
|
+
|
69
|
+
or, parse directly into a graph
|
70
|
+
|
71
|
+
g = Graph.new(:identifier => "http://example.com", :store => :sqlite3_store)
|
72
|
+
g.parse(input, "http://example.com", :type => :rdfxml)
|
73
|
+
|
74
|
+
=== Data Stores
|
75
|
+
ListStore:: simple non-context aware datastore based on Array
|
76
|
+
MemoryStore:: context aware datastore using multiple hashes to optimize triple lookkup
|
77
|
+
SQLite3Store:: context aware datastore using a SQLite3 database to create a persistent storage model
|
78
|
+
|
79
|
+
== Dependencies:
|
80
|
+
|
81
|
+
* Addressable
|
82
|
+
* Treetop
|
83
|
+
* Whatlanguage
|
84
|
+
* nokogiri
|
85
|
+
* builder
|
86
|
+
|
87
|
+
=== For testing
|
88
|
+
* Redland/Rasqal
|
89
|
+
* ActiveSupport
|
90
|
+
|
91
|
+
== INSTALL:
|
92
|
+
|
93
|
+
* sudo gem install rdf_context
|
94
|
+
|
95
|
+
== TODO:
|
96
|
+
* Testing
|
97
|
+
* Integrate ntriples tests in spec/ntriples/test.nt
|
98
|
+
* Turtle tests from http://www.w3.org/2000/10/swap/test/n3/turtle-manifest.n3 (if can find .ttl and .out files)
|
99
|
+
* N3-RDF tests from http://www.w3.org/2000/10/swap/test/n3/n3-rdf.tests
|
100
|
+
* N3-Full tests from http://www.w3.org/2000/10/swap/test/n3/n3-full.tests
|
101
|
+
* N3 grammar tests?
|
102
|
+
* RDFa updates for new tests and non XHTML representations.
|
103
|
+
* Graphs
|
104
|
+
* n3 serialization
|
105
|
+
* Reasoner/inference engine
|
106
|
+
* SPARQL
|
107
|
+
* RDFS logic and RDF entailment tests
|
108
|
+
* Ruby objects
|
109
|
+
* ActiveRDF-like class support
|
110
|
+
* Integrate with RDFObjects (http://github.com/rsinger/RDFObjects)
|
111
|
+
|
112
|
+
== LICENSE:
|
113
|
+
|
114
|
+
(The MIT License)
|
115
|
+
|
116
|
+
Copyright (c) 2009 Gregg Kellogg
|
117
|
+
|
118
|
+
Copyright (c) 2008 Tom Morris and contributors
|
119
|
+
|
120
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
121
|
+
a copy of this software and associated documentation files (the
|
122
|
+
'Software'), to deal in the Software without restriction, including
|
123
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
124
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
125
|
+
permit persons to whom the Software is furnished to do so, subject to
|
126
|
+
the following conditions:
|
127
|
+
|
128
|
+
The above copyright notice and this permission notice shall be
|
129
|
+
included in all copies or substantial portions of the Software.
|
130
|
+
|
131
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
132
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
133
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
134
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
135
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
136
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
137
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
138
|
+
|
139
|
+
== FEEDBACK
|
140
|
+
|
141
|
|
142
|
+
* gemcutter.org/rdf_context
|
143
|
+
* github.com/gkellogg/rdf_context
|
144
|
+
* gkellogg.lighthouseapp.com for bug reports
|
145
|
+
* public-rdf-ruby mailing list on w3.org
|
data/Rakefile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
begin
|
3
|
+
gem 'jeweler'
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gemspec|
|
6
|
+
gemspec.name = "rdf_context"
|
7
|
+
gemspec.summary = "RdfContext is an RDF library for Ruby supporting contextual graphs, multiple datastores and compliant RDF/XML, RDFa and N3 parsers."
|
8
|
+
gemspec.description = <<-DESCRIPTION
|
9
|
+
RdfContext 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 rdf_context'
|
19
|
+
DESCRIPTION
|
20
|
+
gemspec.email = "[email protected]"
|
21
|
+
gemspec.homepage = "http://github.com/gkellogg/rdf_context"
|
22
|
+
gemspec.authors = ["Gregg Kellogg"]
|
23
|
+
gemspec.add_dependency('addressable', '>= 2.0.0')
|
24
|
+
gemspec.add_dependency('treetop', '>= 1.4.0')
|
25
|
+
gemspec.add_dependency('whatlanguage', '>= 1.0.0')
|
26
|
+
gemspec.add_dependency('nokogiri', '>= 1.3.3')
|
27
|
+
gemspec.add_dependency('builder', '>= 2.1.2')
|
28
|
+
gemspec.add_development_dependency('rspec')
|
29
|
+
gemspec.add_development_dependency('activesupport', '>= 2.3.0')
|
30
|
+
gemspec.extra_rdoc_files = %w(README.rdoc History.txt)
|
31
|
+
end
|
32
|
+
Jeweler::GemcutterTasks.new
|
33
|
+
rescue LoadError
|
34
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
35
|
+
end
|
36
|
+
|
37
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
38
|
+
#task :default => [:spec, :features]
|
39
|
+
|
40
|
+
desc "Pushes to git"
|
41
|
+
task :push do
|
42
|
+
sh "git push --all"
|
43
|
+
sh "growlnotify -m \"Updates pushed\" \"Git\""
|
44
|
+
end
|
45
|
+
|
46
|
+
require 'spec/rake/spectask'
|
47
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
48
|
+
spec.libs << 'lib' << 'spec'
|
49
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Run specs through RCov"
|
53
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
54
|
+
spec.libs << 'lib' << 'spec'
|
55
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
56
|
+
spec.rcov = true
|
57
|
+
end
|
58
|
+
|
59
|
+
task :spec => :check_dependencies
|
60
|
+
|
61
|
+
task :default => :spec
|
62
|
+
|
63
|
+
require 'rake/rdoctask'
|
64
|
+
Rake::RDocTask.new do |rdoc|
|
65
|
+
if File.exist?('VERSION')
|
66
|
+
version = File.read('VERSION')
|
67
|
+
else
|
68
|
+
version = RdfaParser::VERSION
|
69
|
+
end
|
70
|
+
|
71
|
+
rdoc.rdoc_dir = 'rdoc'
|
72
|
+
rdoc.title = "rdf_context #{version}"
|
73
|
+
rdoc.rdoc_files.include('README*', "History.txt")
|
74
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
75
|
+
end
|
76
|
+
|
77
|
+
# vim: syntax=Ruby
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.2
|
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/rdf_context")
|
4
|
+
require 'getoptlong'
|
5
|
+
class Parse
|
6
|
+
include RdfContext
|
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/rdf_context.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'addressable/uri'
|
6
|
+
require 'builder'
|
7
|
+
require 'treetop'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
10
|
+
gem 'nokogiri'
|
11
|
+
gem 'addressable'
|
12
|
+
require 'nokogiri'
|
13
|
+
require 'addressable/uri'
|
14
|
+
require 'builder'
|
15
|
+
require 'treetop'
|
16
|
+
end
|
17
|
+
|
18
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'rdf_context/**.rb')).each { |f| require f }
|
19
|
+
|
20
|
+
# Include Storage types, but be tollerant of failure to load as dependencies might not be available
|
21
|
+
Dir.glob(File.join(File.dirname(__FILE__), "rdf_context/store/**.rb")).each do |f|
|
22
|
+
begin
|
23
|
+
require f
|
24
|
+
rescue LoadError
|
25
|
+
puts "Error loading #{f}: #{$!}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module RdfContext
|
30
|
+
VERSION = File.read(File.join(File.dirname(__FILE__), "..", "VERSION")).chop # Version in parent directory
|
31
|
+
|
32
|
+
LINK_TYPES = %w(
|
33
|
+
alternate appendix bookmark cite chapter contents copyright first glossary
|
34
|
+
help icon index last license meta next p3pv1 prev role section stylesheet subsection
|
35
|
+
start top up
|
36
|
+
)
|
37
|
+
|
38
|
+
NC_REGEXP = Regexp.new(
|
39
|
+
%{^
|
40
|
+
(?!\\\\u0301) # ́ is a non-spacing acute accent.
|
41
|
+
# It is legal within an XML Name, but not as the first character.
|
42
|
+
( [a-zA-Z_]
|
43
|
+
| \\\\u[0-9a-fA-F]
|
44
|
+
)
|
45
|
+
( [0-9a-zA-Z_\.-]
|
46
|
+
| \\\\u([0-9a-fA-F]{4}) # \u followed by a sequence of four hex digits
|
47
|
+
)*
|
48
|
+
$},
|
49
|
+
Regexp::EXTENDED)
|
50
|
+
|
51
|
+
RDF_TYPE = URIRef.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
|
52
|
+
XML_LITERAL = Literal::Encoding.xmlliteral
|
53
|
+
|
54
|
+
RDF_NS = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf")
|
55
|
+
RDFS_NS = Namespace.new("http://www.w3.org/2000/01/rdf-schema#", "rdfs")
|
56
|
+
XHV_NS = Namespace.new("http://www.w3.org/1999/xhtml/vocab#", "xhv")
|
57
|
+
XML_NS = Namespace.new("http://www.w3.org/XML/1998/namespace", "xml")
|
58
|
+
|
59
|
+
XH_MAPPING = {"" => Namespace.new("http://www.w3.org/1999/xhtml/vocab\#", nil)}
|
60
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module RdfContext
|
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
|
+
def initialize(identifier = nil, context = {})
|
19
|
+
if identifier != nil && self.valid_id?(identifier)
|
20
|
+
identifier = identifier.sub(/nbn\d+[a-z]+N/, '') # creating a named BNode from a named BNode
|
21
|
+
# Generate a name if it's blank. Always prepend "named" to avoid generation overlap
|
22
|
+
@identifier = context[identifier] ||= generate_bn_identifier(identifier)
|
23
|
+
else
|
24
|
+
@identifier = generate_bn_identifier
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return BNode identifier
|
29
|
+
def to_s
|
30
|
+
return self.identifier.to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Exports the BNode in N-Triples form.
|
35
|
+
#
|
36
|
+
# ==== Example
|
37
|
+
# b = BNode.new; b.to_n3 # => returns a string of the BNode in n3 form
|
38
|
+
#
|
39
|
+
# @return [String]:: The BNode in n3.
|
40
|
+
#
|
41
|
+
# @author Tom Morris
|
42
|
+
def to_n3
|
43
|
+
"_:#{self.identifier}"
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Exports the BNode in N-Triples form.
|
48
|
+
#
|
49
|
+
# Syonym for to_n3
|
50
|
+
def to_ntriples
|
51
|
+
self.to_n3
|
52
|
+
end
|
53
|
+
|
54
|
+
# Output URI as resource reference for RDF/XML
|
55
|
+
#
|
56
|
+
# ==== Example
|
57
|
+
# b = BNode.new("foo"); b.xml_args # => [{"rdf:nodeID" => "foo"}]
|
58
|
+
def xml_args
|
59
|
+
[{"rdf:nodeID" => self.identifier}]
|
60
|
+
end
|
61
|
+
|
62
|
+
# The identifier used used for this BNode.
|
63
|
+
def identifier
|
64
|
+
@identifier
|
65
|
+
end
|
66
|
+
|
67
|
+
# Compare BNodes. BNodes are equivalent if they have the same identifier
|
68
|
+
def eql?(other)
|
69
|
+
other.class == self.class &&
|
70
|
+
other.identifier == self.identifier
|
71
|
+
end
|
72
|
+
alias_method :==, :eql?
|
73
|
+
|
74
|
+
# Needed for uniq
|
75
|
+
def hash; self.to_s.hash; end
|
76
|
+
|
77
|
+
def inspect
|
78
|
+
"[bn:#{identifier}]"
|
79
|
+
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
def valid_id?(name)
|
83
|
+
NC_REGEXP.match(name) || name.empty?
|
84
|
+
end
|
85
|
+
|
86
|
+
# Generate a unique identifier (time with milliseconds plus generated increment)
|
87
|
+
def generate_bn_identifier(name = nil)
|
88
|
+
@@base ||= "bn#{(Time.now.to_f * 1000).to_i}"
|
89
|
+
@@next_generated ||= "a"
|
90
|
+
if name
|
91
|
+
bn = "n#{@@base}#{@@next_generated}N#{name}"
|
92
|
+
else
|
93
|
+
bn = "#{@@base}#{@@next_generated}"
|
94
|
+
end
|
95
|
+
@@next_generated = @@next_generated.succ
|
96
|
+
bn
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|