Strip quoting angle in lone IRIRef terms

This commit is contained in:
kortschak 2014-07-29 08:33:35 +09:30
parent 7ce3a10d57
commit 410202f3e0
2 changed files with 98 additions and 95 deletions

View file

@ -85,6 +85,9 @@ func unEscape(r []rune, isQuoted, isEscaped bool) string {
if isQuoted { if isQuoted {
r = r[1 : len(r)-1] r = r[1 : len(r)-1]
} }
if len(r) >= 2 && r[0] == '<' && r[len(r)-1] == '>' {
return string(r[1 : len(r)-1])
}
if !isEscaped { if !isEscaped {
return string(r) return string(r)
} }

View file

@ -125,9 +125,9 @@ var testNTriples = []struct {
message: "handle simple case with comments", message: "handle simple case with comments",
input: "<http://example/s> <http://example/p> <http://example/o> . # comment", input: "<http://example/s> <http://example/p> <http://example/o> . # comment",
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example/s>", Subject: "http://example/s",
Predicate: "<http://example/p>", Predicate: "http://example/p",
Object: "<http://example/o>", Object: "http://example/o",
Provenance: "", Provenance: "",
}, },
}, },
@ -135,8 +135,8 @@ var testNTriples = []struct {
message: "handle simple case with comments", message: "handle simple case with comments",
input: "<http://example/s> <http://example/p> _:o . # comment", input: "<http://example/s> <http://example/p> _:o . # comment",
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example/s>", Subject: "http://example/s",
Predicate: "<http://example/p>", Predicate: "http://example/p",
Object: "_:o", Object: "_:o",
Provenance: "", Provenance: "",
}, },
@ -145,8 +145,8 @@ var testNTriples = []struct {
message: "handle simple case with comments", message: "handle simple case with comments",
input: "<http://example/s> <http://example/p> \"o\" . # comment", input: "<http://example/s> <http://example/p> \"o\" . # comment",
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example/s>", Subject: "http://example/s",
Predicate: "<http://example/p>", Predicate: "http://example/p",
Object: "o", Object: "o",
Provenance: "", Provenance: "",
}, },
@ -155,8 +155,8 @@ var testNTriples = []struct {
message: "handle simple case with comments", message: "handle simple case with comments",
input: "<http://example/s> <http://example/p> \"o\"^^<http://example/dt> . # comment", input: "<http://example/s> <http://example/p> \"o\"^^<http://example/dt> . # comment",
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example/s>", Subject: "http://example/s",
Predicate: "<http://example/p>", Predicate: "http://example/p",
Object: `"o"^^<http://example/dt>`, Object: `"o"^^<http://example/dt>`,
Provenance: "", Provenance: "",
}, },
@ -165,8 +165,8 @@ var testNTriples = []struct {
message: "handle simple case with comments", message: "handle simple case with comments",
input: "<http://example/s> <http://example/p> \"o\"@en . # comment", input: "<http://example/s> <http://example/p> \"o\"@en . # comment",
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example/s>", Subject: "http://example/s",
Predicate: "<http://example/p>", Predicate: "http://example/p",
Object: `"o"@en`, Object: `"o"@en`,
Provenance: ""}, Provenance: ""},
}, },
@ -179,8 +179,8 @@ var testNTriples = []struct {
input: `_:100000 </film/performance/actor> </en/larry_fine_1902> . # example from 30movies`, input: `_:100000 </film/performance/actor> </en/larry_fine_1902> . # example from 30movies`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:100000", Subject: "_:100000",
Predicate: "</film/performance/actor>", Predicate: "/film/performance/actor",
Object: "</en/larry_fine_1902>", Object: "/en/larry_fine_1902",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -191,7 +191,7 @@ var testNTriples = []struct {
input: `_:10011 </film/performance/character> "Tomás de Torquemada" . # example from 30movies with unicode`, input: `_:10011 </film/performance/character> "Tomás de Torquemada" . # example from 30movies with unicode`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:10011", Subject: "_:10011",
Predicate: "</film/performance/character>", Predicate: "/film/performance/character",
Object: "Tomás de Torquemada", Object: "Tomás de Torquemada",
Provenance: "", Provenance: "",
}, },
@ -203,9 +203,9 @@ var testNTriples = []struct {
message: "parse triple with commment", message: "parse triple with commment",
input: `<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> . # comments here`, input: `<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> . # comments here`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://one.example/subject1>", Subject: "http://one.example/subject1",
Predicate: "<http://one.example/predicate1>", Predicate: "http://one.example/predicate1",
Object: "<http://one.example/object1>", Object: "http://one.example/object1",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -215,7 +215,7 @@ var testNTriples = []struct {
input: `_:subject1 <http://an.example/predicate1> "object1" .`, input: `_:subject1 <http://an.example/predicate1> "object1" .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:subject1", Subject: "_:subject1",
Predicate: "<http://an.example/predicate1>", Predicate: "http://an.example/predicate1",
Object: "object1", Object: "object1",
Provenance: "", Provenance: "",
}, },
@ -226,7 +226,7 @@ var testNTriples = []struct {
input: `_:subject2 <http://an.example/predicate2> "object2" .`, input: `_:subject2 <http://an.example/predicate2> "object2" .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:subject2", Subject: "_:subject2",
Predicate: "<http://an.example/predicate2>", Predicate: "http://an.example/predicate2",
Object: "object2", Object: "object2",
Provenance: "", Provenance: "",
}, },
@ -238,9 +238,9 @@ var testNTriples = []struct {
message: "parse triple with three IRIREFs", message: "parse triple with three IRIREFs",
input: `<http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> .`, input: `<http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/#spiderman>", Subject: "http://example.org/#spiderman",
Predicate: "<http://www.perceive.net/schemas/relationship/enemyOf>", Predicate: "http://www.perceive.net/schemas/relationship/enemyOf",
Object: "<http://example.org/#green-goblin>", Object: "http://example.org/#green-goblin",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -252,7 +252,7 @@ var testNTriples = []struct {
input: `_:alice <http://xmlns.com/foaf/0.1/knows> _:bob .`, input: `_:alice <http://xmlns.com/foaf/0.1/knows> _:bob .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:alice", Subject: "_:alice",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "_:bob", Object: "_:bob",
Provenance: "", Provenance: "",
}, },
@ -263,7 +263,7 @@ var testNTriples = []struct {
input: `_:bob <http://xmlns.com/foaf/0.1/knows> _:alice .`, input: `_:bob <http://xmlns.com/foaf/0.1/knows> _:alice .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:bob", Subject: "_:bob",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "_:alice", Object: "_:alice",
Provenance: "", Provenance: "",
}, },
@ -275,10 +275,10 @@ var testNTriples = []struct {
message: "parse quad with commment", message: "parse quad with commment",
input: `<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> <http://example.org/graph3> . # comments here`, input: `<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> <http://example.org/graph3> . # comments here`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://one.example/subject1>", Subject: "http://one.example/subject1",
Predicate: "<http://one.example/predicate1>", Predicate: "http://one.example/predicate1",
Object: "<http://one.example/object1>", Object: "http://one.example/object1",
Provenance: "<http://example.org/graph3>", Provenance: "http://example.org/graph3",
}, },
err: nil, err: nil,
}, },
@ -287,9 +287,9 @@ var testNTriples = []struct {
input: `_:subject1 <http://an.example/predicate1> "object1" <http://example.org/graph1> .`, input: `_:subject1 <http://an.example/predicate1> "object1" <http://example.org/graph1> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:subject1", Subject: "_:subject1",
Predicate: "<http://an.example/predicate1>", Predicate: "http://an.example/predicate1",
Object: "object1", Object: "object1",
Provenance: "<http://example.org/graph1>", Provenance: "http://example.org/graph1",
}, },
err: nil, err: nil,
}, },
@ -298,9 +298,9 @@ var testNTriples = []struct {
input: `_:subject2 <http://an.example/predicate2> "object2" <http://example.org/graph5> .`, input: `_:subject2 <http://an.example/predicate2> "object2" <http://example.org/graph5> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:subject2", Subject: "_:subject2",
Predicate: "<http://an.example/predicate2>", Predicate: "http://an.example/predicate2",
Object: "object2", Object: "object2",
Provenance: "<http://example.org/graph5>", Provenance: "http://example.org/graph5",
}, },
err: nil, err: nil,
}, },
@ -310,10 +310,10 @@ var testNTriples = []struct {
message: "parse quad with all IRIREF parts", message: "parse quad with all IRIREF parts",
input: `<http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> <http://example.org/graphs/spiderman> .`, input: `<http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> <http://example.org/graphs/spiderman> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/#spiderman>", Subject: "http://example.org/#spiderman",
Predicate: "<http://www.perceive.net/schemas/relationship/enemyOf>", Predicate: "http://www.perceive.net/schemas/relationship/enemyOf",
Object: "<http://example.org/#green-goblin>", Object: "http://example.org/#green-goblin",
Provenance: "<http://example.org/graphs/spiderman>", Provenance: "http://example.org/graphs/spiderman",
}, },
err: nil, err: nil,
}, },
@ -324,9 +324,9 @@ var testNTriples = []struct {
input: `_:alice <http://xmlns.com/foaf/0.1/knows> _:bob <http://example.org/graphs/john> .`, input: `_:alice <http://xmlns.com/foaf/0.1/knows> _:bob <http://example.org/graphs/john> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:alice", Subject: "_:alice",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "_:bob", Object: "_:bob",
Provenance: "<http://example.org/graphs/john>", Provenance: "http://example.org/graphs/john",
}, },
err: nil, err: nil,
}, },
@ -335,9 +335,9 @@ var testNTriples = []struct {
input: `_:bob <http://xmlns.com/foaf/0.1/knows> _:alice <http://example.org/graphs/james> .`, input: `_:bob <http://xmlns.com/foaf/0.1/knows> _:alice <http://example.org/graphs/james> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "_:bob", Subject: "_:bob",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "_:alice", Object: "_:alice",
Provenance: "<http://example.org/graphs/james>", Provenance: "http://example.org/graphs/james",
}, },
err: nil, err: nil,
}, },
@ -347,9 +347,9 @@ var testNTriples = []struct {
message: "parse triple with all IRIREF parts", message: "parse triple with all IRIREF parts",
input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .`, input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", Predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
Object: "<http://xmlns.com/foaf/0.1/Person>", Object: "http://xmlns.com/foaf/0.1/Person",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -358,9 +358,9 @@ var testNTriples = []struct {
message: "parse triple with all IRIREF parts", message: "parse triple with all IRIREF parts",
input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/knows> <http://example.org/alice#me> .`, input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/knows> <http://example.org/alice#me> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "<http://example.org/alice#me>", Object: "http://example.org/alice#me",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -369,8 +369,8 @@ var testNTriples = []struct {
message: "parse triple with IRIREF schema on literal object", message: "parse triple with IRIREF schema on literal object",
input: `<http://example.org/bob#me> <http://schema.org/birthDate> "1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date> .`, input: `<http://example.org/bob#me> <http://schema.org/birthDate> "1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://schema.org/birthDate>", Predicate: "http://schema.org/birthDate",
Object: `"1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date>`, Object: `"1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date>`,
Provenance: "", Provenance: "",
}, },
@ -380,9 +380,9 @@ var testNTriples = []struct {
message: "parse commented IRIREF in triple", message: "parse commented IRIREF in triple",
input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/topic_interest> <http://www.wikidata.org/entity/Q12418> .`, input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/topic_interest> <http://www.wikidata.org/entity/Q12418> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://xmlns.com/foaf/0.1/topic_interest>", Predicate: "http://xmlns.com/foaf/0.1/topic_interest",
Object: "<http://www.wikidata.org/entity/Q12418>", Object: "http://www.wikidata.org/entity/Q12418",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -391,8 +391,8 @@ var testNTriples = []struct {
message: "parse triple with literal subject", message: "parse triple with literal subject",
input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/title> "Mona Lisa" .`, input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/title> "Mona Lisa" .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://www.wikidata.org/entity/Q12418>", Subject: "http://www.wikidata.org/entity/Q12418",
Predicate: "<http://purl.org/dc/terms/title>", Predicate: "http://purl.org/dc/terms/title",
Object: "Mona Lisa", Object: "Mona Lisa",
Provenance: "", Provenance: "",
}, },
@ -402,9 +402,9 @@ var testNTriples = []struct {
message: "parse triple with all IRIREF parts (1)", message: "parse triple with all IRIREF parts (1)",
input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/creator> <http://dbpedia.org/resource/Leonardo_da_Vinci> .`, input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/creator> <http://dbpedia.org/resource/Leonardo_da_Vinci> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://www.wikidata.org/entity/Q12418>", Subject: "http://www.wikidata.org/entity/Q12418",
Predicate: "<http://purl.org/dc/terms/creator>", Predicate: "http://purl.org/dc/terms/creator",
Object: "<http://dbpedia.org/resource/Leonardo_da_Vinci>", Object: "http://dbpedia.org/resource/Leonardo_da_Vinci",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -413,9 +413,9 @@ var testNTriples = []struct {
message: "parse triple with all IRIREF parts (2)", message: "parse triple with all IRIREF parts (2)",
input: `<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619> <http://purl.org/dc/terms/subject> <http://www.wikidata.org/entity/Q12418> .`, input: `<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619> <http://purl.org/dc/terms/subject> <http://www.wikidata.org/entity/Q12418> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619>", Subject: "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
Predicate: "<http://purl.org/dc/terms/subject>", Predicate: "http://purl.org/dc/terms/subject",
Object: "<http://www.wikidata.org/entity/Q12418>", Object: "http://www.wikidata.org/entity/Q12418",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -426,10 +426,10 @@ var testNTriples = []struct {
message: "parse commented IRIREF in quad (1)", message: "parse commented IRIREF in quad (1)",
input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/bob> .`, input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://example.org/bob> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", Predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
Object: "<http://xmlns.com/foaf/0.1/Person>", Object: "http://xmlns.com/foaf/0.1/Person",
Provenance: "<http://example.org/bob>", Provenance: "http://example.org/bob",
}, },
err: nil, err: nil,
}, },
@ -437,10 +437,10 @@ var testNTriples = []struct {
message: "parse quad with all IRIREF parts", message: "parse quad with all IRIREF parts",
input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/knows> <http://example.org/alice#me> <http://example.org/bob> .`, input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/knows> <http://example.org/alice#me> <http://example.org/bob> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://xmlns.com/foaf/0.1/knows>", Predicate: "http://xmlns.com/foaf/0.1/knows",
Object: "<http://example.org/alice#me>", Object: "http://example.org/alice#me",
Provenance: "<http://example.org/bob>", Provenance: "http://example.org/bob",
}, },
err: nil, err: nil,
}, },
@ -448,10 +448,10 @@ var testNTriples = []struct {
message: "parse quad with IRIREF schema on literal object", message: "parse quad with IRIREF schema on literal object",
input: `<http://example.org/bob#me> <http://schema.org/birthDate> "1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date> <http://example.org/bob> .`, input: `<http://example.org/bob#me> <http://schema.org/birthDate> "1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date> <http://example.org/bob> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://schema.org/birthDate>", Predicate: "http://schema.org/birthDate",
Object: `"1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date>`, Object: `"1990-07-04"^^<http://www.w3.org/2001/XMLSchema#date>`,
Provenance: "<http://example.org/bob>", Provenance: "http://example.org/bob",
}, },
err: nil, err: nil,
}, },
@ -459,10 +459,10 @@ var testNTriples = []struct {
message: "parse commented IRIREF in quad (2)", message: "parse commented IRIREF in quad (2)",
input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/topic_interest> <http://www.wikidata.org/entity/Q12418> <http://example.org/bob> .`, input: `<http://example.org/bob#me> <http://xmlns.com/foaf/0.1/topic_interest> <http://www.wikidata.org/entity/Q12418> <http://example.org/bob> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://xmlns.com/foaf/0.1/topic_interest>", Predicate: "http://xmlns.com/foaf/0.1/topic_interest",
Object: "<http://www.wikidata.org/entity/Q12418>", Object: "http://www.wikidata.org/entity/Q12418",
Provenance: "<http://example.org/bob>", Provenance: "http://example.org/bob",
}, },
err: nil, err: nil,
}, },
@ -470,10 +470,10 @@ var testNTriples = []struct {
message: "parse literal object and colon qualified label in quad", message: "parse literal object and colon qualified label in quad",
input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/title> "Mona Lisa" <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`, input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/title> "Mona Lisa" <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://www.wikidata.org/entity/Q12418>", Subject: "http://www.wikidata.org/entity/Q12418",
Predicate: "<http://purl.org/dc/terms/title>", Predicate: "http://purl.org/dc/terms/title",
Object: "Mona Lisa", Object: "Mona Lisa",
Provenance: "<https://www.wikidata.org/wiki/Special:EntityData/Q12418>", Provenance: "https://www.wikidata.org/wiki/Special:EntityData/Q12418",
}, },
err: nil, err: nil,
}, },
@ -481,10 +481,10 @@ var testNTriples = []struct {
message: "parse all IRIREF parts with colon qualified label in quad (1)", message: "parse all IRIREF parts with colon qualified label in quad (1)",
input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/creator> <http://dbpedia.org/resource/Leonardo_da_Vinci> <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`, input: `<http://www.wikidata.org/entity/Q12418> <http://purl.org/dc/terms/creator> <http://dbpedia.org/resource/Leonardo_da_Vinci> <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://www.wikidata.org/entity/Q12418>", Subject: "http://www.wikidata.org/entity/Q12418",
Predicate: "<http://purl.org/dc/terms/creator>", Predicate: "http://purl.org/dc/terms/creator",
Object: "<http://dbpedia.org/resource/Leonardo_da_Vinci>", Object: "http://dbpedia.org/resource/Leonardo_da_Vinci",
Provenance: "<https://www.wikidata.org/wiki/Special:EntityData/Q12418>", Provenance: "https://www.wikidata.org/wiki/Special:EntityData/Q12418",
}, },
err: nil, err: nil,
}, },
@ -492,10 +492,10 @@ var testNTriples = []struct {
message: "parse all IRIREF parts with colon qualified label in quad (2)", message: "parse all IRIREF parts with colon qualified label in quad (2)",
input: `<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619> <http://purl.org/dc/terms/subject> <http://www.wikidata.org/entity/Q12418> <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`, input: `<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619> <http://purl.org/dc/terms/subject> <http://www.wikidata.org/entity/Q12418> <https://www.wikidata.org/wiki/Special:EntityData/Q12418> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619>", Subject: "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
Predicate: "<http://purl.org/dc/terms/subject>", Predicate: "http://purl.org/dc/terms/subject",
Object: "<http://www.wikidata.org/entity/Q12418>", Object: "http://www.wikidata.org/entity/Q12418",
Provenance: "<https://www.wikidata.org/wiki/Special:EntityData/Q12418>", Provenance: "https://www.wikidata.org/wiki/Special:EntityData/Q12418",
}, },
err: nil, err: nil,
}, },
@ -503,9 +503,9 @@ var testNTriples = []struct {
message: "parse all IRIREF parts (quad section - 1)", message: "parse all IRIREF parts (quad section - 1)",
input: `<http://example.org/bob> <http://purl.org/dc/terms/publisher> <http://example.org> .`, input: `<http://example.org/bob> <http://purl.org/dc/terms/publisher> <http://example.org> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob>", Subject: "http://example.org/bob",
Predicate: "<http://purl.org/dc/terms/publisher>", Predicate: "http://purl.org/dc/terms/publisher",
Object: "<http://example.org>", Object: "http://example.org",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -514,9 +514,9 @@ var testNTriples = []struct {
message: "parse all IRIREF parts (quad section - 2)", message: "parse all IRIREF parts (quad section - 2)",
input: `<http://example.org/bob> <http://purl.org/dc/terms/rights> <http://creativecommons.org/licenses/by/3.0/> .`, input: `<http://example.org/bob> <http://purl.org/dc/terms/rights> <http://creativecommons.org/licenses/by/3.0/> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob>", Subject: "http://example.org/bob",
Predicate: "<http://purl.org/dc/terms/rights>", Predicate: "http://purl.org/dc/terms/rights",
Object: "<http://creativecommons.org/licenses/by/3.0/>", Object: "http://creativecommons.org/licenses/by/3.0/",
Provenance: "", Provenance: "",
}, },
err: nil, err: nil,
@ -551,8 +551,8 @@ var testNTriples = []struct {
message: "parse incomplete quad (1)", message: "parse incomplete quad (1)",
input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> .`, input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", Predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
Object: "", Object: "",
Provenance: "", Provenance: "",
}, },
@ -562,8 +562,8 @@ var testNTriples = []struct {
message: "parse incomplete quad (2)", message: "parse incomplete quad (2)",
input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> .`, input: `<http://example.org/bob#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> .`,
expect: &quad.Quad{ expect: &quad.Quad{
Subject: "<http://example.org/bob#me>", Subject: "http://example.org/bob#me",
Predicate: "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", Predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
Object: "", Object: "",
Provenance: "", Provenance: "",
}, },