Skip to content
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

Issue/52 whitespace before langtag #56

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Parser/Turtle.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ protected function parseQuotedLiteral()
{
$label = $this->parseQuotedString();

$this->skipWSC();

// Check for presence of a language tag or datatype
$c = $this->peek();

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/turtle/gh52-sweetrdf-whitespace-langtag.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<http://example.org/#a> <http://www.w3.org/2000/01/rdf-schema#label> "Test"@en .
<http://example.org/#a> <http://www.w3.org/2000/01/rdf-schema#label> "Test"^^<http://www.w3.org/2001/XMLSchema#string> .
9 changes: 9 additions & 0 deletions test/fixtures/turtle/gh52-sweetrdf-whitespace-langtag.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://example.org/#> .

# Allow whitespace between literal and language tag
:a rdfs:label "Test" @en .

# Allow whitespace between literal and datatype IRI
:a rdfs:label "Test" ^^xs:string .
13 changes: 12 additions & 1 deletion tests/EasyRdf/Parser/TurtleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,9 @@ public function testIssue140()
}

/**
* Allow usage of dot in middle of name
*
* @see https://github.com/sweetrdf/easyrdf/issues/51
* Notice this is an issue reported in the sweetrdf/easyrdf fork
*/
public function testIssue51()
{
Expand All @@ -597,4 +598,14 @@ public function testIssue51Bad()
);
$this->parseTurtle('turtle/gh51-sweetrdf-dot-in-name-bad.ttl');
}

/**
* Allow whitespace(s) between quoted string literal and langtag or datatype
*
* @see https://github.com/sweetrdf/easyrdf/issues/52
*/
public function testIssue52()
{
$this->turtleTestCase('gh52-sweetrdf-whitespace-langtag');
}
}
Loading