diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3e9a06..0ac8b1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Run tests run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v1.1.2 + uses: coverallsapp/github-action@v2 if: "matrix.ruby == '3.0'" with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/etc/earl-nquads.ttl b/etc/earl-nquads.ttl index 4b9bb91..d3c8628 100644 --- a/etc/earl-nquads.ttl +++ b/etc/earl-nquads.ttl @@ -919,7 +919,7 @@ [ a earl:Assertion; earl:assertedBy ; earl:subject ; - earl:test ; + earl:test ; earl:result [ a earl:TestResult; earl:outcome earl:passed; diff --git a/etc/earl.ttl b/etc/earl.ttl index a38c560..2dd7f5b 100644 --- a/etc/earl.ttl +++ b/etc/earl.ttl @@ -1072,7 +1072,7 @@ [ a earl:Assertion; earl:assertedBy ; earl:subject ; - earl:test ; + earl:test ; earl:result [ a earl:TestResult; earl:outcome earl:passed; @@ -1082,7 +1082,7 @@ [ a earl:Assertion; earl:assertedBy ; earl:subject ; - earl:test ; + earl:test ; earl:result [ a earl:TestResult; earl:outcome earl:passed; @@ -1192,7 +1192,7 @@ [ a earl:Assertion; earl:assertedBy ; earl:subject ; - earl:test ; + earl:test ; earl:result [ a earl:TestResult; earl:outcome earl:passed; @@ -1212,7 +1212,7 @@ [ a earl:Assertion; earl:assertedBy ; earl:subject ; - earl:test ; + earl:test ; earl:result [ a earl:TestResult; earl:outcome earl:passed; diff --git a/etc/trig.bnf b/etc/trig.bnf index 197f048..7441d2f 100644 --- a/etc/trig.bnf +++ b/etc/trig.bnf @@ -1,97 +1,97 @@ -[1g] trigDoc ::= ( directive | block )* -[2g] block ::= triplesOrGraph - | wrappedGraph - | triples2 - | GRAPH labelOrSubject wrappedGraph -[3g] triplesOrGraph ::= labelOrSubject ( wrappedGraph | predicateObjectList '.' ) - | quotedTriple predicateObjectList '.' -[4g] triples2 ::= blankNodePropertyList predicateObjectList? '.' - | collection predicateObjectList '.' -[5g] wrappedGraph ::= '{' triplesBlock? '}' -[6g] triplesBlock ::= triples ( '.' triplesBlock? )? -[7g] labelOrSubject ::= ( iri | BlankNode ) -[3] directive ::= prefixID | base | sparqlPrefix | sparqlBase -[4] prefixID ::= PREFIX PNAME_NS IRIREF "."? -[5] base ::= BASE IRIREF "."? -[5s] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF -[6s] sparqlBase ::= "BASE" IRIREF -[6] triples ::= subject predicateObjectList - | blankNodePropertyList predicateObjectList? -[7] predicateObjectList ::= verb objectList (';' (verb objectList)? )* -[8] objectList ::= object annotation? ( "," object annotation? )* -[9] verb ::= predicate | "a" -[10] subject ::= iri | blank | quotedTriple -[11] predicate ::= iri -[12] object ::= iri | blank | blankNodePropertyList | literal | quotedTriple -[13] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral -[14] blank ::= BlankNode | collection -[15] blankNodePropertyList ::= "[" predicateObjectList "]" -[16] collection ::= "(" object* ")" -[17] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE -[128s] RDFLiteral ::= String ( LANGTAG | ( "^^" iri ) )? -[133s] BooleanLiteral ::= "true" | "false" -[18] String ::= STRING_LITERAL_QUOTE - | STRING_LITERAL_SINGLE_QUOTE - | STRING_LITERAL_LONG_SINGLE_QUOTE - | STRING_LITERAL_LONG_QUOTE -[135s] iri ::= IRIREF | PrefixedName -[136s] PrefixedName ::= PNAME_LN | PNAME_NS -[137s] BlankNode ::= BLANK_NODE_LABEL | ANON -[27] quotedTriple ::= "<<" qtSubject predicate qtObject ">>" -[28] qtSubject ::= iri | BlankNode | quotedTriple -[29] qtObject ::= iri | BlankNode | literal | quotedTriple -[30] annotation ::= '{|' predicateObjectList '|}' +trigDoc ::= ( directive | block )* +block ::= triplesOrGraph + | wrappedGraph + | triples2 + | GRAPH labelOrSubject wrappedGraph +triplesOrGraph ::= labelOrSubject ( wrappedGraph | predicateObjectList '.' ) + | quotedTriple predicateObjectList '.' +triples2 ::= blankNodePropertyList predicateObjectList? '.' + | collection predicateObjectList '.' +wrappedGraph ::= '{' triplesBlock? '}' +triplesBlock ::= triples ( '.' triplesBlock? )? +labelOrSubject ::= ( iri | BlankNode ) +directive ::= prefixID | base | sparqlPrefix | sparqlBase +prefixID ::= PREFIX PNAME_NS IRIREF "."? +base ::= BASE IRIREF "."? +sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF +sparqlBase ::= "BASE" IRIREF +triples ::= subject predicateObjectList + | blankNodePropertyList predicateObjectList? +predicateObjectList ::= verb objectList (';' (verb objectList)? )* +objectList ::= object annotation? ( "," object annotation? )* +verb ::= predicate | "a" +subject ::= iri | blank | quotedTriple +predicate ::= iri +object ::= iri | blank | blankNodePropertyList | literal | quotedTriple +literal ::= RDFLiteral | NumericLiteral | BooleanLiteral +blank ::= BlankNode | collection +blankNodePropertyList ::= "[" predicateObjectList "]" +collection ::= "(" object* ")" +NumericLiteral ::= INTEGER | DECIMAL | DOUBLE +RDFLiteral ::= String ( LANG_DIR | ( "^^" iri ) )? +BooleanLiteral ::= "true" | "false" +String ::= STRING_LITERAL_QUOTE + | STRING_LITERAL_SINGLE_QUOTE + | STRING_LITERAL_LONG_SINGLE_QUOTE + | STRING_LITERAL_LONG_QUOTE +iri ::= IRIREF | PrefixedName +PrefixedName ::= PNAME_LN | PNAME_NS +BlankNode ::= BLANK_NODE_LABEL | ANON +quotedTriple ::= "<<" qtSubject predicate qtObject ">>" +qtSubject ::= iri | BlankNode | quotedTriple +qtObject ::= iri | BlankNode | literal | quotedTriple +annotation ::= '{|' predicateObjectList '|}' @terminals -[1t] GRAPH ::= [Gg][Rr][Aa][Pp][Hh] -[19] IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>' -[139s] PNAME_NS ::= PN_PREFIX? ":" -[140s] PNAME_LN ::= PNAME_NS PN_LOCAL -[141s] BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? -[144s] LANGTAG ::= "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* -[20] INTEGER ::= [+-]? [0-9]+ -[21] DECIMAL ::= [+-]? ( ([0-9])* '.' ([0-9])+ ) -[22] DOUBLE ::= [+-]? ( [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT ) -[154s] EXPONENT ::= [eE] [+-]? [0-9]+ -[23] STRING_LITERAL_QUOTE ::= '"' ( [^#x22#x5C#xA#xD] | ECHAR | UCHAR )* '"' -[24] STRING_LITERAL_SINGLE_QUOTE ::= "'" ( [^#x27#x5C#xA#xD] | ECHAR | UCHAR )* "'" -[25] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" -[26] STRING_LITERAL_LONG_QUOTE ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' -[27] UCHAR ::= ( "\u" HEX HEX HEX HEX ) - | ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX ) -[159s] ECHAR ::= "\" [tbnrf\"'] -[160s] NIL ::= "(" WS* ")" -[161s] WS ::= #x20 | #x9 | #xD | #xA -[162s] ANON ::= "[" WS* "]" -[163s] PN_CHARS_BASE ::= [A-Z] - | [a-z] - | [#x00C0-#x00D6] - | [#x00D8-#x00F6] - | [#x00F8-#x02FF] - | [#x0370-#x037D] - | [#x037F-#x1FFF] - | [#x200C-#x200D] - | [#x2070-#x218F] - | [#x2C00-#x2FEF] - | [#x3001-#xD7FF] - | [#xF900-#xFDCF] - | [#xFDF0-#xFFFD] - | [#x10000-#xEFFFF] -[164s] PN_CHARS_U ::= PN_CHARS_BASE - | '_' -[166s] PN_CHARS ::= PN_CHARS_U - | "-" - | [0-9] - | #x00B7 - | [#x0300-#x036F] - | [#x203F-#x2040] -[167s] PN_PREFIX ::= PN_CHARS_BASE ( ( PN_CHARS | "." )* PN_CHARS )? -[168s] PN_LOCAL ::= ( PN_CHARS_U | ':' | [0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) ) ? -[169s] PLX ::= PERCENT - | PN_LOCAL_ESC -[170s] PERCENT ::= '%' HEX HEX -[171s] HEX ::= [0-9] | [A-F] | [a-f] -[172s] PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) -[28t] PREFIX ::= "@"?[Pp][Rr][Ee][Ff][Ii][Xx] -[29t] BASE ::= "@"?[Bb][Aa][Ss][Ee] +RAPH ::= [Gg][Rr][Aa][Pp][Hh] +RIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>' +PNAME_NS ::= PN_PREFIX? ":" +PNAME_LN ::= PNAME_NS PN_LOCAL +BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)? +LANG_DIR ::= "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* ('--' [a-zA-Z]+)?` +INTEGER ::= [+-]? [0-9]+ +DECIMAL ::= [+-]? ( ([0-9])* '.' ([0-9])+ ) +DOUBLE ::= [+-]? ( [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT ) +EXPONENT ::= [eE] [+-]? [0-9]+ +STRING_LITERAL_QUOTE ::= '"' ( [^#x22#x5C#xA#xD] | ECHAR | UCHAR )* '"' +STRING_LITERAL_SINGLE_QUOTE ::= "'" ( [^#x27#x5C#xA#xD] | ECHAR | UCHAR )* "'" +STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" ( ( "'" | "''" )? ( [^'\] | ECHAR | UCHAR ) )* "'''" +STRING_LITERAL_LONG_QUOTE ::= '"""' ( ( '"' | '""' )? ( [^"\] | ECHAR | UCHAR ) )* '"""' +UCHAR ::= ( "\u" HEX HEX HEX HEX ) + | ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX ) +ECHAR ::= "\" [tbnrf\"'] +NIL ::= "(" WS* ")" +WS ::= #x20 | #x9 | #xD | #xA +ANON ::= "[" WS* "]" +PN_CHARS_BASE ::= [A-Z] + | [a-z] + | [#x00C0-#x00D6] + | [#x00D8-#x00F6] + | [#x00F8-#x02FF] + | [#x0370-#x037D] + | [#x037F-#x1FFF] + | [#x200C-#x200D] + | [#x2070-#x218F] + | [#x2C00-#x2FEF] + | [#x3001-#xD7FF] + | [#xF900-#xFDCF] + | [#xFDF0-#xFFFD] + | [#x10000-#xEFFFF] +PN_CHARS_U ::= PN_CHARS_BASE + | '_' +PN_CHARS ::= PN_CHARS_U + | "-" + | [0-9] + | #x00B7 + | [#x0300-#x036F] + | [#x203F-#x2040] +PN_PREFIX ::= PN_CHARS_BASE ( ( PN_CHARS | "." )* PN_CHARS )? +PN_LOCAL ::= ( PN_CHARS_U | ':' | [0-9] | PLX ) ( ( PN_CHARS | '.' | ':' | PLX )* ( PN_CHARS | ':' | PLX ) ) ? +PLX ::= PERCENT + | PN_LOCAL_ESC +PERCENT ::= '%' HEX HEX +HEX ::= [0-9] | [A-F] | [a-f] +PN_LOCAL_ESC ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' ) +PREFIX ::= "@"?[Pp][Rr][Ee][Ff][Ii][Xx] +BASE ::= "@"?[Bb][Aa][Ss][Ee] diff --git a/lib/rdf/trig/reader.rb b/lib/rdf/trig/reader.rb index 4af5b4e..97b8ece 100644 --- a/lib/rdf/trig/reader.rb +++ b/lib/rdf/trig/reader.rb @@ -36,7 +36,7 @@ class Reader < RDF::Turtle::Reader terminal(:GRAPH, /graph/i) terminal(:PREFIX, PREFIX) terminal(:BASE, BASE) - terminal(:LANGTAG, LANGTAG) + terminal(:LANG_DIR, LANG_DIR) ## # Iterates the given block for each RDF statement in the input. diff --git a/spec/star_spec.rb b/spec/star_spec.rb index 64c09dd..547f4a4 100644 --- a/spec/star_spec.rb +++ b/spec/star_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe RDF::TriG::Reader do - # W3C Turtle Test suite from http://w3c.github.io/rdf-tests/turtle/manifest.ttl - describe "rdfstar turtle tests" do + # W3C Turtle Test suite from http://w3c.github.io/rdf-tests/rdf/rdf11/rdf-trig/manifest.ttl + describe "rdfstar TriG tests" do require 'suite_helper' %w(nt/syntax turtle/syntax turtle/eval trig/syntax trig/eval).each do |man| @@ -15,7 +15,7 @@ t.logger.info t.inspect t.logger.info "source:\n#{t.input}" - reader = RDF::TriG::Reader.new(t.input, + reader = RDF::Reader.for(t.action).new(t.input, base_uri: t.base, canonicalize: false, validate: true, diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb index 161326a..c1ce5cd 100644 --- a/spec/suite_helper.rb +++ b/spec/suite_helper.rb @@ -6,10 +6,10 @@ # For now, override RDF::Utils::File.open_file to look for the file locally before attempting to retrieve it module RDF::Util module File - REMOTE_PATH = "http://w3c.github.io/rdf-tests/trig/" - LOCAL_PATH = ::File.expand_path("../w3c-rdf/trig", __FILE__) + '/' - REMOTE_PATH_NQ = "http://w3c.github.io/rdf-tests/nquads/" - LOCAL_PATH_NQ = ::File.expand_path("../w3c-rdf/nquads", __FILE__) + '/' + REMOTE_PATH = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-trig/" + LOCAL_PATH = ::File.expand_path("../w3c-rdf-tests/rdf/rdf11/rdf-trig", __FILE__) + '/' + REMOTE_PATH_NQ = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-n-quads/" + LOCAL_PATH_NQ = ::File.expand_path("../w3c-rdf/rdf/rdf11/rdf-n-quads", __FILE__) + '/' REMOTE_PATH_STAR = "https://w3c.github.io/rdf-star/" LOCAL_PATH_STAR = ::File.expand_path("../w3c-rdf-star/", __FILE__) + '/' @@ -140,8 +140,8 @@ def self.open_file(filename_or_url, **options, &block) module Fixtures module SuiteTest - BASE = "http://w3c.github.io/rdf-tests/trig/" - NQBASE = "http://w3c.github.io/rdf-tests/nquads/" + BASE = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-trig/" + NQBASE = "https://w3c.github.io/rdf-tests/rdf/rdf11/rdf-n-quads/" FRAME = JSON.parse(%q({ "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", diff --git a/spec/w3c-rdf-tests b/spec/w3c-rdf-tests new file mode 120000 index 0000000..562eb32 --- /dev/null +++ b/spec/w3c-rdf-tests @@ -0,0 +1 @@ +../../w3c-rdf-tests \ No newline at end of file