-
Notifications
You must be signed in to change notification settings - Fork 12
test: initial support for Verify and DotNetRDF + OSLC IResource #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
303f945
e168c24
eb2ed36
5f3f5cd
39f538d
011586a
3395ce3
381215a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| *.verified.txt text eol=lf working-tree-encoding=UTF-8 | ||
| *.verified.xml text eol=lf working-tree-encoding=UTF-8 | ||
| *.verified.json text eol=lf working-tree-encoding=UTF-8 | ||
| *.verified.ttl text eol=lf working-tree-encoding=UTF-8 | ||
| *.verified.nq text eol=lf working-tree-encoding=UTF-8 | ||
| *.verified.bin binary |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| /tmp/ | ||
|
|
||
| ### | ||
|
|
||
| *.received.* | ||
|
|
||
| ############################################ | ||
|
|
||
| TestResults/** | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. | ||||||||||||||||||||||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | ||||||||||||||||||||||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _:c14n0 <http://purl.org/dc/terms/title> "Test of links"; | ||||||||||||||||||||||
| rdf:object <http://com/somewhere/changeRequest1>; | ||||||||||||||||||||||
| rdf:predicate <http://open-services.net/ns/cm#affectedByDefect>; | ||||||||||||||||||||||
| rdf:subject <http://com/somewhere/changeRequest2>; | ||||||||||||||||||||||
| a rdf:Statement. | ||||||||||||||||||||||
| _:c14n1 <http://purl.org/dc/terms/title> "Test of links"; | ||||||||||||||||||||||
| rdf:object <http://com/somewhere/changeRequest2>; | ||||||||||||||||||||||
| rdf:predicate <http://open-services.net/ns/cm#affectedByDefect>; | ||||||||||||||||||||||
| rdf:subject <http://com/somewhere/changeRequest1>; | ||||||||||||||||||||||
| a rdf:Statement. | ||||||||||||||||||||||
| <http://com/somewhere/changeRequest1> <http://open-services.net/ns/cm#affectedByDefect> <http://com/somewhere/changeRequest2>; | ||||||||||||||||||||||
| <http://open-services.net/ns/cm#fixed> true; | ||||||||||||||||||||||
| <http://open-services.net/ns/cm#severity> "Unclassified"; | ||||||||||||||||||||||
| a <http://open-services.net/ns/cm#ChangeRequest>. | ||||||||||||||||||||||
| <http://com/somewhere/changeRequest2> <http://open-services.net/ns/cm#affectedByDefect> <http://com/somewhere/changeRequest1>; | ||||||||||||||||||||||
| <http://open-services.net/ns/cm#fixed> false; | ||||||||||||||||||||||
| <http://open-services.net/ns/cm#severity> "Unclassified"; | ||||||||||||||||||||||
| a <http://open-services.net/ns/cm#ChangeRequest>. | ||||||||||||||||||||||
| <http://com/somewhere/changerequests> rdfs:member <http://com/somewhere/changeRequest1>, | ||||||||||||||||||||||
| <http://com/somewhere/changeRequest2>. | ||||||||||||||||||||||
| <http://com/somewhere/changerequests?page=20> <http://open-services.net/ns/core#nextPage> <http://com/somewhere/changerequests?page=21>; | ||||||||||||||||||||||
| <http://open-services.net/ns/core#totalCount> "2"; | ||||||||||||||||||||||
| a <http://open-services.net/ns/core#ResponseInfo>. | ||||||||||||||||||||||
|
Comment on lines
+23
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify totalCount data type against OSLC specification. The collection and pagination structure are correct, but line 26 has Please verify whether the serializer is correctly outputting type information for numeric properties. Check the OSLC Core specification for the expected data type of If the spec requires -<http://com/somewhere/changerequests?page=20> <http://open-services.net/ns/core#nextPage> <http://com/somewhere/changerequests?page=21>;
- <http://open-services.net/ns/core#totalCount> "2";
- a <http://open-services.net/ns/core#ResponseInfo>.
+<http://com/somewhere/changerequests?page=20> <http://open-services.net/ns/core#nextPage> <http://com/somewhere/changerequests?page=21>;
+ <http://open-services.net/ns/core#totalCount> "2"^^xsd:integer;
+ a <http://open-services.net/ns/core#ResponseInfo>.🌐 Web query: 💡 Result: Yes — OSLC Core defines oslc:totalCount as an integer (zero-or-one, optional). Its value SHOULD be non‑negative and, for query responses, SHOULD represent the total number of matching results. [1][2] Sources:
Fix totalCount serialization to include xsd:integer type annotation. Line 26 has -<http://com/somewhere/changerequests?page=20> <http://open-services.net/ns/core#nextPage> <http://com/somewhere/changerequests?page=21>;
- <http://open-services.net/ns/core#totalCount> "2";
+<http://com/somewhere/changerequests?page=20> <http://open-services.net/ns/core#nextPage> <http://com/somewhere/changerequests?page=21>;
+ <http://open-services.net/ns/core#totalCount> "2"^^xsd:integer;📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. | ||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||
|
|
||
| _:c14n0 <http://purl.org/dc/terms/title> "Test of links"; | ||
| rdf:object <http://com/somewhere/changeRequest2>; | ||
| rdf:predicate <http://open-services.net/ns/cm#affectedByDefect>; | ||
| rdf:subject <http://com/somewhere/changeReuest>; | ||
| a rdf:Statement. | ||
| <http://com/somewhere/changeReuest> <http://open-services.net/ns/cm#affectedByDefect> <http://com/somewhere/changeRequest2>; | ||
| <http://open-services.net/ns/cm#fixed> true; | ||
| <http://open-services.net/ns/cm#severity> "Unclassified"; | ||
| a <http://open-services.net/ns/cm#ChangeRequest>. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| using System.Runtime.CompilerServices; | ||
| using EmptyFiles; | ||
| using OSLC4Net.Core.DotNetRdfProvider; | ||
| using OSLC4Net.Core.Model; | ||
| using VDS.RDF; | ||
| using VDS.RDF.Writing; | ||
|
|
||
| namespace OSLC4Net.Core.DotNetRdfProviderTests; | ||
|
|
||
| public static class VerifyInit | ||
| { | ||
| [ModuleInitializer] | ||
| public static void Initialize() | ||
| { | ||
| // or UseSourceFileRelativeDirectory | ||
| Verifier.UseProjectRelativeDirectory("Snapshots"); | ||
|
|
||
| FileExtensions.AddTextExtension("ttl"); | ||
|
|
||
| VerifierSettings.RegisterFileConverter<IGraph>( | ||
| (graph, _) => | ||
| { | ||
| return CanonicalizeAndSerializeGraph(graph); | ||
| }); | ||
| VerifierSettings.RegisterFileConverter<IResource>( | ||
| (resource, _) => | ||
| { | ||
| var graph = DotNetRdfHelper.CreateDotNetRdfGraph([resource]); | ||
| return CanonicalizeAndSerializeGraph(graph); | ||
| }); | ||
| } | ||
|
|
||
| private static ConversionResult CanonicalizeAndSerializeGraph(IGraph graph) | ||
| { | ||
| using var writer = new System.IO.StringWriter(); | ||
| var rdfc = new RdfCanonicalizer(); | ||
| using var graphCollection = new GraphCollection | ||
| { | ||
| { graph, false } | ||
| }; | ||
| using var tripleStore = new TripleStore(graphCollection); | ||
| var canonicalizedRdfDataset = rdfc.Canonicalize(tripleStore); | ||
| var newGraph = canonicalizedRdfDataset.OutputDataset.Graphs.Single(); | ||
| // https://www.w3.org/TR/rdf-canon/ prescribes N-Quads serialization, but let's try Turtle for better readability | ||
| var ttlWriter = new CompressingTurtleWriter(); | ||
| ttlWriter.Save(newGraph, writer); | ||
| return new ConversionResult(null, "ttl", writer.ToString()); | ||
| } | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.