Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add/modify tests for XSD-typed JSON-LD serialization
Browse files Browse the repository at this point in the history
Modify test "t#0018" in JSON-LD test-suite: Add XSD types to the
expected JSON-LD output.

Add test "t#0020" in JSON-LD test-suite: Add another test with mixed
explicit typing in the input source.
lu-pl committed Aug 14, 2024
1 parent 097e0b1 commit 1c4dc63
Showing 4 changed files with 65 additions and 10 deletions.
35 changes: 25 additions & 10 deletions test/jsonld/test-suite/tests/fromRdf-0018-out.jsonld
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
[
{
"@id": "http://example.com/Subj1",
"http://example.com/prop": [
{ "@value": true },
{ "@value": false },
{ "@value": 1 },
{ "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"},
{ "@value": 0.11 }
]
}
{
"@id": "http://example.com/Subj1",
"http://example.com/prop": [
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": true
},
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": false
},
{
"@type": "http://www.w3.org/2001/XMLSchema#integer",
"@value": 1
},
{
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
"@value": "1.1"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": 0.11
}
]
}
]
5 changes: 5 additions & 0 deletions test/jsonld/test-suite/tests/fromRdf-0020-in.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/Subj1> <http://example.com/prop> "false" .
<http://example.com/Subj1> <http://example.com/prop> "1" .
<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
<http://example.com/Subj1> <http://example.com/prop> "1.1E-1"^^<http://www.w3.org/2001/XMLSchema#double> .
25 changes: 25 additions & 0 deletions test/jsonld/test-suite/tests/fromRdf-0020-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"@id": "http://example.com/Subj1",
"http://example.com/prop": [
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": true
},
{
"@value": "false"
},
{
"@value": "1"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
"@value": "1.1"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": 0.11
}
]
}
]
10 changes: 10 additions & 0 deletions test/jsonld/test-suite/tests/fromRdf-manifest.jsonld
Original file line number Diff line number Diff line change
@@ -145,6 +145,16 @@
},
"input": "fromRdf-0019-in.nq",
"expect": "fromRdf-0019-out.jsonld"
}, {
"@id": "#t0020",
"@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
"name": "Mixed explicit XSD typing",
"purpose": "Explicitly XSD-typed Literals in the input are reflected in the JSON-LD output.",
"option": {
"useNativeTypes": true
},
"input": "fromRdf-0020-in.nq",
"expect": "fromRdf-0020-out.jsonld"
}
]
}

0 comments on commit 1c4dc63

Please sign in to comment.