jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/387660 )
Change subject: Add new test case to demonstrate bug in JSON-LD output
......................................................................
Add new test case to demonstrate bug in JSON-LD output
This documents a bug found by Smalyshev, caused by appending new values
to an existing statement, so it can be fixed in a follow-up patch.
The NTuples/RDF/Turtle output is correct. The JSON-LD output is invalid.
Change-Id: I74cfd972a47698456232a74dea2e988f02d85b50
---
A tests/data/AlternatingValues.jsonld
A tests/data/AlternatingValues.nt
A tests/data/AlternatingValues.rdf
A tests/data/AlternatingValues.ttl
M tests/phpunit/RdfWriterTestBase.php
5 files changed, 74 insertions(+), 0 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/data/AlternatingValues.jsonld
b/tests/data/AlternatingValues.jsonld
new file mode 100644
index 0000000..3654234
--- /dev/null
+++ b/tests/data/AlternatingValues.jsonld
@@ -0,0 +1,29 @@
+{
+ "@id": "wikibase:Dump",
+ "owl:foo": {
+ "@id": "owl:A",
+ "0": {
+ "@id": "owl:B"
+ },
+ "1": {
+ "@id": "owl:C"
+ }
+ },
+ "owl:bar": {
+ "@type": "xsd:decimal",
+ "@value": "5",
+ "0": {
+ "@type": "xsd:decimal",
+ "@value": "6"
+ },
+ "1": {
+ "@type": "xsd:decimal",
+ "@value": "7"
+ }
+ },
+ "@context": {
+ "wikibase": "http://wikiba.se/ontology-beta#",
+ "owl": "http://www.w3.org/2002/07/owl#",
+ "xsd": "http://www.w3.org/2001/XMLSchema#"
+ }
+}
\ No newline at end of file
diff --git a/tests/data/AlternatingValues.nt b/tests/data/AlternatingValues.nt
new file mode 100644
index 0000000..916590b
--- /dev/null
+++ b/tests/data/AlternatingValues.nt
@@ -0,0 +1,6 @@
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#foo>
<http://www.w3.org/2002/07/owl#A> .
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#bar>
"5"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#foo>
<http://www.w3.org/2002/07/owl#B> .
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#bar>
"6"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#foo>
<http://www.w3.org/2002/07/owl#C> .
+<http://wikiba.se/ontology-beta#Dump> <http://www.w3.org/2002/07/owl#bar>
"7"^^<http://www.w3.org/2001/XMLSchema#decimal> .
diff --git a/tests/data/AlternatingValues.rdf b/tests/data/AlternatingValues.rdf
new file mode 100644
index 0000000..63d5ccb
--- /dev/null
+++ b/tests/data/AlternatingValues.rdf
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:wikibase="http://wikiba.se/ontology-beta#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
+ <rdf:Description rdf:about="http://wikiba.se/ontology-beta#Dump">
+ <owl:foo rdf:resource="http://www.w3.org/2002/07/owl#A"/>
+ <owl:bar
rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">5</owl:bar>
+ <owl:foo rdf:resource="http://www.w3.org/2002/07/owl#B"/>
+ <owl:bar
rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">6</owl:bar>
+ <owl:foo rdf:resource="http://www.w3.org/2002/07/owl#C"/>
+ <owl:bar
rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">7</owl:bar>
+ </rdf:Description>
+</rdf:RDF>
diff --git a/tests/data/AlternatingValues.ttl b/tests/data/AlternatingValues.ttl
new file mode 100644
index 0000000..a5ca670
--- /dev/null
+++ b/tests/data/AlternatingValues.ttl
@@ -0,0 +1,11 @@
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+@prefix wikibase: <http://wikiba.se/ontology-beta#> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+
+wikibase:Dump owl:foo owl:A ;
+ owl:bar "5"^^xsd:decimal ;
+ owl:foo owl:B ;
+ owl:bar "6"^^xsd:decimal ;
+ owl:foo owl:C ;
+ owl:bar "7"^^xsd:decimal .
diff --git a/tests/phpunit/RdfWriterTestBase.php
b/tests/phpunit/RdfWriterTestBase.php
index 54f1877..7d1bb58 100644
--- a/tests/phpunit/RdfWriterTestBase.php
+++ b/tests/phpunit/RdfWriterTestBase.php
@@ -355,6 +355,23 @@
$this->assertOutputLines( 'DumpHeader', $rdf );
}
+ public function testAlternatingValues() {
+ $writer = $this->newWriter();
+ $writer->prefix( 'wikibase', 'http://wikiba.se/ontology-beta#'
);
+ $writer->prefix( 'owl', 'http://www.w3.org/2002/07/owl#' );
+ $writer->start();
+ $writer->about( 'wikibase', 'Dump' )
+ ->say( 'owl', 'foo' )->is( 'owl', 'A' )
+ ->say( 'owl', 'bar' )->value( '5', 'xsd', 'decimal' )
+ ->say( 'owl', 'foo' )->is( 'owl', 'B' )
+ ->say( 'owl', 'bar' )->value( '6', 'xsd', 'decimal' )
+ ->say( 'owl', 'foo' )->is( 'owl', 'C' )
+ ->say( 'owl', 'bar' )->value( '7', 'xsd', 'decimal'
);
+ $writer->finish();
+ $rdf = $writer->drain();
+ $this->assertOutputLines( 'AlternatingValues', $rdf );
+ }
+
/**
* @param string $datasetName
* @param string[]|string $actual
--
To view, visit https://gerrit.wikimedia.org/r/387660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I74cfd972a47698456232a74dea2e988f02d85b50
Gerrit-PatchSet: 2
Gerrit-Project: purtle
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits