|
From: Richard C. <ri...@cy...> - 2006-02-28 23:57:27
|
Fix is in CVS.
On 26 Feb 2006, at 22:01, Richard Cyganiak wrote:
> Hi,
>
> The N3 parser has a bug that causes broken triples in cases like this:
>
> <foo>
> :bar "bar";
> :baz "baz";
> .
>
> The last statement (<foo> :baz "baz") is terminated by a semicolon
> *and* a dot. This is legal in N3, and in fact quite common because
> that way you can't mix up the end-of-line punctuation.
>
> RAP's parser doesn't recognize this, sees a third triple with a
> null predicate and object, and generates two notices.
>
> Here's a test case for /test/unit/Syntax/n3Parser_test.php that
> catches the bug:
>
> function testLoneSemicolon() {
> $n3 = '<a> <b> <c> ; .';
> $parser = &new N3Parser();
> $model = &$parser->parse2model($n3, false);
> $this->assertEqual(1, $model->size());
> $this->assertNoErrors();
> }
>
> Here's the fix for /api/syntax/N3Parser.php . I've added two lines
> to the getPovs method, it's the comment line and the one after.
>
> function getPovs($list) {
> $povs = array();
> while (in_array(';', $list)) {
> $r=$this->posns($list,';');
> $pos=array_slice($r,0,2);
> $r = $this->getSpan($list, $pos[0], $pos[1]);
> $pov=$r[0];
> $list=$r[1];
>
> // skip lone semicolons, e.g. "<a> <b> <c> ; ."
> if (count($pov) == 1) continue;
>
> $povs[]=array_slice($pov,1);
> }
>
> Best,
> Richard
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the
> live webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Rdfapi-php-interest mailing list
> Rdf...@li...
> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest
>
|