rdf-rdfxml 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.yardopts +2 -1
- data/CONTRIBUTORS +1 -0
- data/History.txt +7 -0
- data/README.rdoc +19 -2
- data/Rakefile +14 -0
- data/VERSION +1 -1
- data/example.rb +0 -1
- data/lib/rdf/rdfxml.rb +14 -6
- data/lib/rdf/rdfxml/format.rb +6 -5
- data/lib/rdf/rdfxml/patches/array_hacks.rb +53 -0
- data/lib/rdf/rdfxml/patches/nokogiri_hacks.rb +8 -0
- data/lib/rdf/rdfxml/patches/rdf_escape.rb +131 -0
- data/lib/rdf/rdfxml/reader.rb +90 -57
- data/lib/rdf/rdfxml/version.rb +1 -1
- data/lib/rdf/rdfxml/vocab.rb +3 -0
- data/lib/rdf/rdfxml/writer.rb +399 -0
- data/rdf-rdfxml.gemspec +448 -0
- data/script/console +10 -0
- data/spec/format_spec.rb +22 -0
- data/spec/matchers.rb +121 -0
- data/spec/rdf_helper.rb +176 -0
- data/spec/rdf_tests/cc197bad-dc9c-440d-a5b5-d52ba2e14234.nt +24 -0
- data/spec/rdf_tests/cc197bad-dc9c-440d-a5b5-d52ba2e14234.rdf +46 -0
- data/spec/rdf_tests/tm_001.nt +1 -0
- data/spec/rdf_tests/tm_001.rdf +7 -0
- data/spec/rdf_tests/xml-literal-mixed.nt +6 -0
- data/spec/rdf_tests/xml-literal-mixed.rdf +15 -0
- data/spec/rdfcore/Manifest.rdf +5395 -0
- data/spec/rdfcore/Manifest.yml +1970 -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/reader_spec.rb +421 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/xml_serializer_spec.rb +386 -0
- metadata +385 -6
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# Copyright World Wide Web Consortium, (Massachusetts Institute of
|
3
|
+
# Technology, Institut National de Recherche en Informatique et en
|
4
|
+
# Automatique, Keio University).
|
5
|
+
#
|
6
|
+
# All Rights Reserved.
|
7
|
+
#
|
8
|
+
# Please see the full Copyright clause at
|
9
|
+
# <http://www.w3.org/Consortium/Legal/copyright-software.html>
|
10
|
+
#
|
11
|
+
# $Id: test013.nt,v 1.1 2002/03/08 12:21:41 dajobe Exp $
|
12
|
+
#
|
13
|
+
#####################################################################
|
14
|
+
<http://example.org/dir/file> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/type> .
|
15
|
+
<http://example.org/dir/file#foo> <http://example.org/value> <http://example.org/dir/relpath> .
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
5
|
+
Technology, Institut National de Recherche en Informatique et en
|
6
|
+
Automatique, Keio University).
|
7
|
+
|
8
|
+
All Rights Reserved.
|
9
|
+
|
10
|
+
Please see the full Copyright clause at
|
11
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
12
|
+
|
13
|
+
Description: With an xml:base with fragment the fragment is ignored.
|
14
|
+
Author: Jeremy Carroll (jjc@hpl.hp.com)
|
15
|
+
|
16
|
+
$Id: test013.rdf,v 1.1 2002/03/08 12:21:41 dajobe Exp $
|
17
|
+
-->
|
18
|
+
|
19
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
20
|
+
xmlns:eg="http://example.org/"
|
21
|
+
xml:base="http://example.org/dir/file#frag">
|
22
|
+
|
23
|
+
<eg:type rdf:about="" />
|
24
|
+
<rdf:Description rdf:ID="foo" >
|
25
|
+
<eg:value rdf:resource="relpath" />
|
26
|
+
</rdf:Description>
|
27
|
+
|
28
|
+
</rdf:RDF>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# Copyright World Wide Web Consortium, (Massachusetts Institute of
|
3
|
+
# Technology, Institut National de Recherche en Informatique et en
|
4
|
+
# Automatique, Keio University).
|
5
|
+
#
|
6
|
+
# All Rights Reserved.
|
7
|
+
#
|
8
|
+
# Please see the full Copyright clause at
|
9
|
+
# <http://www.w3.org/Consortium/Legal/copyright-software.html>
|
10
|
+
#
|
11
|
+
# $Id: test014.nt,v 1.2 2002/11/15 11:45:42 jgrant Exp $
|
12
|
+
#
|
13
|
+
#####################################################################
|
14
|
+
<http://example.org/dir/file#frag> <http://example.org/value> "v" .
|
15
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/xmlbase/test014.rdf#frag> <http://example.org/value> "v" .
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
5
|
+
Technology, Institut National de Recherche en Informatique et en
|
6
|
+
Automatique, Keio University).
|
7
|
+
|
8
|
+
All Rights Reserved.
|
9
|
+
|
10
|
+
Please see the full Copyright clause at
|
11
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
12
|
+
|
13
|
+
Description: two identical rdf:ID's are allowed, as long as they
|
14
|
+
refer to different resources.
|
15
|
+
Author: Jeremy Carroll (jjc@hpl.hp.com)
|
16
|
+
|
17
|
+
$Id: test014.rdf,v 1.1 2002/03/08 12:21:41 dajobe Exp $
|
18
|
+
-->
|
19
|
+
|
20
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
21
|
+
xmlns:eg="http://example.org/"
|
22
|
+
>
|
23
|
+
|
24
|
+
<rdf:Description xml:base="http://example.org/dir/file"
|
25
|
+
rdf:ID="frag" eg:value="v" />
|
26
|
+
<rdf:Description rdf:ID="frag" eg:value="v" />
|
27
|
+
|
28
|
+
</rdf:RDF>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
5
|
+
Technology, European Research Consortium for Informatics and
|
6
|
+
Mathematics, Keio University).
|
7
|
+
|
8
|
+
All Rights Reserved.
|
9
|
+
|
10
|
+
Please see the full Copyright clause at
|
11
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
12
|
+
|
13
|
+
Description: the typed literal in this file is well-formed.
|
14
|
+
|
15
|
+
Related issue:
|
16
|
+
|
17
|
+
http://www.w3.org/2001/sw/RDFCore/20030123-issues/#xmlsch-02
|
18
|
+
|
19
|
+
Author: Jeremy Carroll
|
20
|
+
|
21
|
+
$Id: test001.rdf,v 1.1 2003/05/12 20:07:01 jcarroll Exp $
|
22
|
+
|
23
|
+
-->
|
24
|
+
|
25
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
26
|
+
xmlns:eg="http://example.org/">
|
27
|
+
|
28
|
+
|
29
|
+
<rdf:Description rdf:about="http://www.example.org/a">
|
30
|
+
<eg:prop rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</eg:prop>
|
31
|
+
</rdf:Description>
|
32
|
+
|
33
|
+
</rdf:RDF>
|
34
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
5
|
+
Technology, European Research Consortium for Informatics and
|
6
|
+
Mathematics, Keio University).
|
7
|
+
|
8
|
+
All Rights Reserved.
|
9
|
+
|
10
|
+
Please see the full Copyright clause at
|
11
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
12
|
+
|
13
|
+
Description: the typed literal in this file is not well-formed.
|
14
|
+
|
15
|
+
Related issue:
|
16
|
+
|
17
|
+
http://www.w3.org/2001/sw/RDFCore/20030123-issues/#xmlsch-02
|
18
|
+
|
19
|
+
Author: Jeremy Carroll
|
20
|
+
|
21
|
+
$Id: test002.rdf,v 1.3 2003/05/12 20:12:03 jcarroll Exp $
|
22
|
+
|
23
|
+
-->
|
24
|
+
|
25
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
26
|
+
xmlns:eg="http://example.org/">
|
27
|
+
|
28
|
+
|
29
|
+
<rdf:Description rdf:about="http://www.example.org/a">
|
30
|
+
<eg:prop rdf:datatype="http://www.w3.org/2001/XMLSchema#int"> 3 </eg:prop>
|
31
|
+
</rdf:Description>
|
32
|
+
|
33
|
+
</rdf:RDF>
|
34
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
5
|
+
Technology, European Research Consortium for Informatics and
|
6
|
+
Mathematics, Keio University).
|
7
|
+
|
8
|
+
All Rights Reserved.
|
9
|
+
|
10
|
+
Please see the full Copyright clause at
|
11
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
12
|
+
|
13
|
+
Description: eg:prop has a literal value.
|
14
|
+
|
15
|
+
Related issue:
|
16
|
+
|
17
|
+
http://www.w3.org/2001/sw/RDFCore/20030123-issues/#xmlsch-02
|
18
|
+
|
19
|
+
Author: Jeremy Carroll
|
20
|
+
|
21
|
+
$Id: test003.rdf,v 1.1 2003/05/12 20:07:01 jcarroll Exp $
|
22
|
+
|
23
|
+
-->
|
24
|
+
|
25
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
26
|
+
xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
|
27
|
+
xmlns:eg="http://example.org/">
|
28
|
+
|
29
|
+
|
30
|
+
<rdf:Description rdf:about="http://www.example.org/a">
|
31
|
+
<eg:prop>
|
32
|
+
<rdfs:Literal/>
|
33
|
+
</eg:prop>
|
34
|
+
</rdf:Description>
|
35
|
+
|
36
|
+
</rdf:RDF>
|
37
|
+
|
data/spec/reader_spec.rb
ADDED
@@ -0,0 +1,421 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
3
|
+
|
4
|
+
# w3c test suite: http://www.w3.org/TR/rdf-testcases/
|
5
|
+
|
6
|
+
describe "RDF::RDFXML::Reader" do
|
7
|
+
context "discovery" do
|
8
|
+
{
|
9
|
+
"rdf" => RDF::Reader.for(:rdf),
|
10
|
+
"xml" => RDF::Reader.for(:xml),
|
11
|
+
"etc/foaf.xml" => RDF::Reader.for("etc/foaf.xml"),
|
12
|
+
"etc/foaf.rdf" => RDF::Reader.for("etc/foaf.rdf"),
|
13
|
+
"foaf.xml" => RDF::Reader.for(:file_name => "foaf.xml"),
|
14
|
+
"foaf.rdf" => RDF::Reader.for(:file_name => "foaf.xml"),
|
15
|
+
".xml" => RDF::Reader.for(:file_extension => "xml"),
|
16
|
+
".rdf" => RDF::Reader.for(:file_extension => "rdf"),
|
17
|
+
"application/xml" => RDF::Reader.for(:content_type => "application/xml"),
|
18
|
+
"application/rdf+xml" => RDF::Reader.for(:content_type => "application/rdf+xml"),
|
19
|
+
}.each_pair do |label, format|
|
20
|
+
it "should discover '#{label}'" do
|
21
|
+
format.should == RDF::RDFXML::Reader
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context :interface do
|
27
|
+
before(:each) do
|
28
|
+
@sampledoc = <<-EOF;
|
29
|
+
<?xml version="1.0" ?>
|
30
|
+
<GenericXML xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/">
|
31
|
+
<rdf:RDF>
|
32
|
+
<rdf:Description rdf:about="http://example.org/one">
|
33
|
+
<ex:name>Foo</ex:name>
|
34
|
+
</rdf:Description>
|
35
|
+
</rdf:RDF>
|
36
|
+
<blablabla />
|
37
|
+
<rdf:RDF>
|
38
|
+
<rdf:Description rdf:about="http://example.org/two">
|
39
|
+
<ex:name>Bar</ex:name>
|
40
|
+
</rdf:Description>
|
41
|
+
</rdf:RDF>
|
42
|
+
</GenericXML>
|
43
|
+
EOF
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should yield reader" do
|
47
|
+
inner = mock("inner")
|
48
|
+
inner.should_receive(:called).with(RDF::RDFXML::Reader)
|
49
|
+
RDF::RDFXML::Reader.new(@sampledoc) do |reader|
|
50
|
+
inner.called(reader.class)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return reader" do
|
55
|
+
RDF::RDFXML::Reader.new(@sampledoc).should be_a(RDF::RDFXML::Reader)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should yield statements" do
|
59
|
+
inner = mock("inner")
|
60
|
+
inner.should_receive(:called).with(RDF::Statement).twice
|
61
|
+
RDF::RDFXML::Reader.new(@sampledoc).each_statement do |statement|
|
62
|
+
inner.called(statement.class)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should yield triples" do
|
67
|
+
inner = mock("inner")
|
68
|
+
inner.should_receive(:called).with(RDF::URI, RDF::URI, RDF::Literal).twice
|
69
|
+
RDF::RDFXML::Reader.new(@sampledoc).each_triple do |subject, predicate, object|
|
70
|
+
inner.called(subject.class, predicate.class, object.class)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "simple parsing" do
|
76
|
+
it "should recognise and create single triple for empty non-RDF root" do
|
77
|
+
sampledoc = %(<?xml version="1.0" ?>
|
78
|
+
<NotRDF />)
|
79
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
80
|
+
graph.size.should == 1
|
81
|
+
statement = graph.statements.first
|
82
|
+
statement.subject.class.should == RDF::Node
|
83
|
+
statement.predicate.should == RDF.type
|
84
|
+
statement.object.should == RDF::XML.NotRDF
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should parse on XML documents with multiple RDF nodes" do
|
88
|
+
sampledoc = <<-EOF;
|
89
|
+
<?xml version="1.0" ?>
|
90
|
+
<GenericXML xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/">
|
91
|
+
<rdf:RDF>
|
92
|
+
<rdf:Description rdf:about="http://example.org/one">
|
93
|
+
<ex:name>Foo</ex:name>
|
94
|
+
</rdf:Description>
|
95
|
+
</rdf:RDF>
|
96
|
+
<blablabla />
|
97
|
+
<rdf:RDF>
|
98
|
+
<rdf:Description rdf:about="http://example.org/two">
|
99
|
+
<ex:name>Bar</ex:name>
|
100
|
+
</rdf:Description>
|
101
|
+
</rdf:RDF>
|
102
|
+
</GenericXML>
|
103
|
+
EOF
|
104
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
105
|
+
objects = graph.statements.map {|s| s.object.value}.sort
|
106
|
+
objects.should == ["Bar", "Foo"]
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should be able to parse a simple single-triple document" do
|
110
|
+
sampledoc = <<-EOF;
|
111
|
+
<?xml version="1.0" ?>
|
112
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
113
|
+
xmlns:ex="http://www.example.org/" xml:lang="en" xml:base="http://www.example.org/foo">
|
114
|
+
<ex:Thing rdf:about="http://example.org/joe" ex:name="bar">
|
115
|
+
<ex:belongsTo rdf:resource="http://tommorris.org/" />
|
116
|
+
<ex:sampleText rdf:datatype="http://www.w3.org/2001/XMLSchema#string">foo</ex:sampleText>
|
117
|
+
<ex:hadADodgyRelationshipWith>
|
118
|
+
<rdf:Description>
|
119
|
+
<ex:name>Tom</ex:name>
|
120
|
+
<ex:hadADodgyRelationshipWith>
|
121
|
+
<rdf:Description>
|
122
|
+
<ex:name>Rob</ex:name>
|
123
|
+
<ex:hadADodgyRelationshipWith>
|
124
|
+
<rdf:Description>
|
125
|
+
<ex:name>Mary</ex:name>
|
126
|
+
</rdf:Description>
|
127
|
+
</ex:hadADodgyRelationshipWith>
|
128
|
+
</rdf:Description>
|
129
|
+
</ex:hadADodgyRelationshipWith>
|
130
|
+
</rdf:Description>
|
131
|
+
</ex:hadADodgyRelationshipWith>
|
132
|
+
</ex:Thing>
|
133
|
+
</rdf:RDF>
|
134
|
+
EOF
|
135
|
+
|
136
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
137
|
+
#puts @debug
|
138
|
+
graph.size.should == 10
|
139
|
+
# print graph.to_ntriples
|
140
|
+
# TODO: add datatype parsing
|
141
|
+
# TODO: make sure the BNode forging is done correctly - an internal element->nodeID mapping
|
142
|
+
# TODO: proper test
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should be able to handle Bags/Alts etc." do
|
146
|
+
sampledoc = <<-EOF;
|
147
|
+
<?xml version="1.0" ?>
|
148
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:eg="http://example.org/">
|
149
|
+
<rdf:Bag>
|
150
|
+
<rdf:li rdf:resource="http://tommorris.org/" />
|
151
|
+
<rdf:li rdf:resource="http://twitter.com/tommorris" />
|
152
|
+
</rdf:Bag>
|
153
|
+
</rdf:RDF>
|
154
|
+
EOF
|
155
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
156
|
+
graph.predicates.map(&:to_s).should include("http://www.w3.org/1999/02/22-rdf-syntax-ns#_1", "http://www.w3.org/1999/02/22-rdf-syntax-ns#_2")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context :exceptions do
|
161
|
+
it "should raise an error if rdf:aboutEach is used, as per the negative parser test rdfms-abouteach-error001 (rdf:aboutEach attribute)" do
|
162
|
+
sampledoc = <<-EOF;
|
163
|
+
<?xml version="1.0" ?>
|
164
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
165
|
+
xmlns:eg="http://example.org/">
|
166
|
+
|
167
|
+
<rdf:Bag rdf:ID="node">
|
168
|
+
<rdf:li rdf:resource="http://example.org/node2"/>
|
169
|
+
</rdf:Bag>
|
170
|
+
|
171
|
+
<rdf:Description rdf:aboutEach="#node">
|
172
|
+
<dc:rights xmlns:dc="http://purl.org/dc/elements/1.1/">me</dc:rights>
|
173
|
+
|
174
|
+
</rdf:Description>
|
175
|
+
|
176
|
+
</rdf:RDF>
|
177
|
+
EOF
|
178
|
+
|
179
|
+
lambda do
|
180
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
181
|
+
end.should raise_error(RDF::ReaderError, /Obsolete attribute .*aboutEach/)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should raise an error if rdf:aboutEachPrefix is used, as per the negative parser test rdfms-abouteach-error002 (rdf:aboutEachPrefix attribute)" do
|
185
|
+
sampledoc = <<-EOF;
|
186
|
+
<?xml version="1.0" ?>
|
187
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
188
|
+
xmlns:eg="http://example.org/">
|
189
|
+
|
190
|
+
<rdf:Description rdf:about="http://example.org/node">
|
191
|
+
<eg:property>foo</eg:property>
|
192
|
+
</rdf:Description>
|
193
|
+
|
194
|
+
<rdf:Description rdf:aboutEachPrefix="http://example.org/">
|
195
|
+
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">me</dc:creator>
|
196
|
+
|
197
|
+
</rdf:Description>
|
198
|
+
|
199
|
+
</rdf:RDF>
|
200
|
+
EOF
|
201
|
+
|
202
|
+
lambda do
|
203
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
204
|
+
end.should raise_error(RDF::ReaderError, /Obsolete attribute .*aboutEachPrefix/)
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should fail if given a non-ID as an ID (as per rdfcore-rdfms-rdf-id-error001)" do
|
208
|
+
sampledoc = <<-EOF;
|
209
|
+
<?xml version="1.0"?>
|
210
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
211
|
+
<rdf:Description rdf:ID='333-555-666' />
|
212
|
+
</rdf:RDF>
|
213
|
+
EOF
|
214
|
+
|
215
|
+
lambda do
|
216
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
217
|
+
end.should raise_error(RDF::ReaderError, /ID addtribute '.*' must be a NCName/)
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should make sure that the value of rdf:ID attributes match the XML Name production (child-element version)" do
|
221
|
+
sampledoc = <<-EOF;
|
222
|
+
<?xml version="1.0" ?>
|
223
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
224
|
+
xmlns:eg="http://example.org/">
|
225
|
+
<rdf:Description>
|
226
|
+
<eg:prop rdf:ID="q:name" />
|
227
|
+
</rdf:Description>
|
228
|
+
</rdf:RDF>
|
229
|
+
EOF
|
230
|
+
|
231
|
+
lambda do
|
232
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
233
|
+
end.should raise_error(RDF::ReaderError, /ID addtribute '.*' must be a NCName/)
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should make sure that the value of rdf:ID attributes match the XML Name production (data attribute version)" do
|
237
|
+
sampledoc = <<-EOF;
|
238
|
+
<?xml version="1.0" ?>
|
239
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
240
|
+
xmlns:eg="http://example.org/">
|
241
|
+
<rdf:Description rdf:ID="a/b" eg:prop="val" />
|
242
|
+
</rdf:RDF>
|
243
|
+
EOF
|
244
|
+
|
245
|
+
lambda do
|
246
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
247
|
+
end.should raise_error(RDF::ReaderError, "ID addtribute 'a/b' must be a NCName")
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should detect bad bagIDs" do
|
251
|
+
sampledoc = <<-EOF;
|
252
|
+
<?xml version="1.0" ?>
|
253
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
254
|
+
<rdf:Description rdf:bagID='333-555-666' />
|
255
|
+
</rdf:RDF>
|
256
|
+
EOF
|
257
|
+
|
258
|
+
lambda do
|
259
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
260
|
+
puts @debug
|
261
|
+
end.should raise_error(RDF::ReaderError, /Obsolete attribute .*bagID/)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
context :reification do
|
266
|
+
it "should be able to reify according to §2.17 of RDF/XML Syntax Specification" do
|
267
|
+
sampledoc = <<-EOF;
|
268
|
+
<?xml version="1.0"?>
|
269
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
270
|
+
xmlns:ex="http://example.org/stuff/1.0/"
|
271
|
+
xml:base="http://example.org/triples/">
|
272
|
+
<rdf:Description rdf:about="http://example.org/">
|
273
|
+
<ex:prop rdf:ID="triple1">blah</ex:prop>
|
274
|
+
</rdf:Description>
|
275
|
+
</rdf:RDF>
|
276
|
+
EOF
|
277
|
+
|
278
|
+
triples = <<-EOF
|
279
|
+
<http://example.org/> <http://example.org/stuff/1.0/prop> \"blah\" .
|
280
|
+
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> .
|
281
|
+
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://example.org/> .
|
282
|
+
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://example.org/stuff/1.0/prop> .
|
283
|
+
<http://example.org/triples/#triple1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> \"blah\" .
|
284
|
+
EOF
|
285
|
+
|
286
|
+
graph = parse(sampledoc, :base_uri => "http://example.com", :strict => true)
|
287
|
+
graph.should be_equivalent_graph(triples, :about => "http://example.com/", :trace => @debug)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
context "parsing rdf files" do
|
292
|
+
def test_file(filepath, uri)
|
293
|
+
rdf_string = File.read(filepath)
|
294
|
+
graph = parse(rdf_string, :base_uri => uri, :strict => true)
|
295
|
+
|
296
|
+
nt_string = File.read(filepath.sub('.rdf', '.nt'))
|
297
|
+
nt_graph = RDF::Graph.new
|
298
|
+
nt_graph.load(filepath.sub('.rdf', '.nt'))
|
299
|
+
|
300
|
+
graph.should be_equivalent_graph(nt_graph, :about => uri, :trace => @debug)
|
301
|
+
end
|
302
|
+
|
303
|
+
before(:all) do
|
304
|
+
@rdf_dir = File.join(File.dirname(__FILE__), 'rdf_tests')
|
305
|
+
end
|
306
|
+
|
307
|
+
it "should parse Coldplay's BBC Music profile" do
|
308
|
+
gid = 'cc197bad-dc9c-440d-a5b5-d52ba2e14234'
|
309
|
+
file = File.join(@rdf_dir, "#{gid}.rdf")
|
310
|
+
test_file(file, "http://www.bbc.co.uk/music/artists/#{gid}")
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should parse xml literal test" do
|
314
|
+
file = File.join(@rdf_dir, "xml-literal-mixed.rdf")
|
315
|
+
test_file(file, "http://www.example.com/books#book12345")
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# W3C Test suite from http://www.w3.org/2000/10/rdf-tests/rdfcore/
|
320
|
+
describe "w3c rdfcore tests" do
|
321
|
+
require 'rdf_helper'
|
322
|
+
|
323
|
+
def self.positive_tests
|
324
|
+
RdfHelper::TestCase.positive_parser_tests(RDFCORE_TEST, RDFCORE_DIR)
|
325
|
+
end
|
326
|
+
|
327
|
+
def self.negative_tests
|
328
|
+
[] #RdfHelper::TestCase.negative_parser_tests(RDFCORE_TEST, RDFCORE_DIR) rescue []
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should parse testcase" do
|
332
|
+
sampledoc = <<-EOF;
|
333
|
+
<?xml version="1.0" ?>
|
334
|
+
<rdf:RDF
|
335
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
336
|
+
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
337
|
+
xmlns:test="http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#"
|
338
|
+
>
|
339
|
+
<!-- amp-in-url/Manifest.rdf -->
|
340
|
+
<test:PositiveParserTest rdf:about="http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001">
|
341
|
+
|
342
|
+
<test:status>APPROVED</test:status>
|
343
|
+
<test:approval rdf:resource="http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2001Sep/0326.html" />
|
344
|
+
<!-- <test:discussion rdf:resource="pointer to archived email or other discussion" /> -->
|
345
|
+
<!-- <test:description>
|
346
|
+
-if we have a description, fill it in here -
|
347
|
+
</test:description> -->
|
348
|
+
|
349
|
+
<test:inputDocument>
|
350
|
+
<test:RDF-XML-Document rdf:about="http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.rdf" />
|
351
|
+
</test:inputDocument>
|
352
|
+
|
353
|
+
<test:outputDocument>
|
354
|
+
<test:NT-Document rdf:about="http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.nt" />
|
355
|
+
</test:outputDocument>
|
356
|
+
|
357
|
+
</test:PositiveParserTest>
|
358
|
+
</rdf:RDF>
|
359
|
+
EOF
|
360
|
+
|
361
|
+
triples = <<-EOF
|
362
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#PositiveParserTest> .
|
363
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#approval> <http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2001Sep/0326.html> .
|
364
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#inputDocument> <http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.rdf> .
|
365
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#outputDocument> <http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.nt> .
|
366
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/Manifest.rdf#test001> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#status> "APPROVED" .
|
367
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.nt> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#NT-Document> .
|
368
|
+
<http://www.w3.org/2000/10/rdf-tests/rdfcore/amp-in-url/test001.rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#RDF-XML-Document> .
|
369
|
+
EOF
|
370
|
+
uri = "http://www.w3.org/2000/10/rdf-tests/rdfcore/xmlbase/Manifest.rdf#test001"
|
371
|
+
|
372
|
+
graph = parse(sampledoc, :base_uri => uri, :strict => true)
|
373
|
+
graph.should be_equivalent_graph(triples, :about => uri, :trace => @debug)
|
374
|
+
end
|
375
|
+
|
376
|
+
# Negative parser tests should raise errors.
|
377
|
+
describe "positive parser tests" do
|
378
|
+
positive_tests.each do |t|
|
379
|
+
#next unless t.about =~ /rdfms-rdf-names-use/
|
380
|
+
#next unless t.name =~ /11/
|
381
|
+
#puts t.inspect
|
382
|
+
specify "#{t.name}: " + (t.description || "#{t.inputDocument} against #{t.outputDocument}") do
|
383
|
+
t.run_test do |rdf_string|
|
384
|
+
t.debug = []
|
385
|
+
g = RDF::Graph.new
|
386
|
+
RDF::RDFXML::Reader.new(rdf_string, :base_uri => t.about, :strict => true, :debug => t.debug).each do |statement|
|
387
|
+
g << statement
|
388
|
+
end
|
389
|
+
g
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
describe "negative parser tests" do
|
396
|
+
negative_tests.each do |t|
|
397
|
+
#next unless t.about =~ /rdfms-empty-property-elements/
|
398
|
+
#next unless t.name =~ /1/
|
399
|
+
#puts t.inspect
|
400
|
+
specify "test #{t.name}: " + (t.description || t.inputDocument) do
|
401
|
+
t.run_test do |rdf_string, parser|
|
402
|
+
lambda do
|
403
|
+
parser.parse(rdf_string, :base_uri => t.about, :strict => true, :debug => [])
|
404
|
+
parser.graph.should be_empty
|
405
|
+
end.should raise_error(RDF::ReaderError)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
def parse(input, options)
|
413
|
+
@debug = []
|
414
|
+
graph = RDF::Graph.new
|
415
|
+
RDF::RDFXML::Reader.new(input, options.merge(:debug => @debug)).each do |statement|
|
416
|
+
graph << statement
|
417
|
+
end
|
418
|
+
graph
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|