sweetrdf / rdfInterface

MIT License
6 stars 2 forks source link

TermsTest.php: if literal has lang set, it has to return rdf:langString as datatype #17

Closed k00ni closed 3 years ago

k00ni commented 3 years ago

A test is not in line with https://github.com/sweetrdf/rdfInterface/issues/12#issuecomment-802059207:

$l[1] = self::$df::literal('1', 'eng');

The test expects $l[1]->getDatatype() to return xsd:string

$this->assertEquals(RDF::XSD_STRING, $l[1]->getDatatype());

but has to expect rdf:langString:

$this->assertEquals('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString', $l[1]->getDatatype());

Based on:

A literal in an RDF graph consists of two or three elements: [...] if and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, a non-empty language tag as defined by [BCP47]. The language tag must be well-formed according to section 2.2.9 of [BCP47].

Source: https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal

k00ni commented 3 years ago

What do you think @zozlak?

zozlak commented 3 years ago

You are right, just it's an outdated version of the test.

The up to date one is in https://github.com/sweetrdf/rdfInterfaceTests/blob/master/src/rdfInterface/tests/TermsTest.php#L136

(to solve some problems with dependencies being set to sweetrdf/rdf-interface: dev-{branch} I moved tests to a separate repo and separate composer library)

k00ni commented 3 years ago

OK.

zozlak commented 3 years ago

Important note - while there was a lot of development and changes in the rdfInterface (and libraries around it) in the last two weeks, my work caught me up and I need to focus on something else in the upcoming weeks. RdfInterface 0.8.1 and corresponding quickRdf 0.6.1 and simpleRdf 0.5.1 should stay as they are for at least month.

My next focus will be to write an NQuadsStar parser and serializer, so I can check how/if rdfInterface (and quickRdf/simpleRdf) deals with RDFstar. Which should also keep me occupied for even longer and will prevent me from introducing changes to the rdfInterface :-)