Skip to content

Commit

Permalink
Merge pull request #6 from sweetrdf/feature/util-allow-rdfxml
Browse files Browse the repository at this point in the history
Extend Util.php to accept rdfxml in getParser and getSerializer
  • Loading branch information
zozlak authored Apr 3, 2024
2 parents 20315b6 + 7fed738 commit 82a1efa
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/quickRdfIo/Util.php
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ static public function getSerializer(string $formatOrFilename): iSerializer {
'application/n-quads' => new NQuadsSerializer(),
'xml',
'rdf',
'rdfxml', // EasyRdf is using it in Format::guessFormat
'application/rdf+xml',
'text/rdf',
'application/xml',
@@ -135,6 +136,7 @@ static public function getParser(string $formatOrFilename,
'application/n-quads' => new NQuadsParser($dataFactory, false, NQuadsParser::MODE_QUADS_STAR),
'xml',
'rdf',
'rdfxml', // EasyRdf is using it in Format::guessFormat
'application/rdf+xml',
'text/rdf',
'application/xml',
10 changes: 10 additions & 0 deletions tests/UtilTest.php
Original file line number Diff line number Diff line change
@@ -44,6 +44,16 @@ static public function setUpBeforeClass(): void {
self::$dfSimple = new \simpleRdf\DataFactory();
}

public function testGetParser(): void {
$parser = Util::getParser('rdfxml', self::$dfQuick);
$this->assertTrue($parser instanceof RdfXmlParser);
}

public function testGetSerializer(): void {
$serializer = Util::getSerializer('rdfxml');
$this->assertTrue($serializer instanceof RdfXmlSerializer);
}

public function testParse(): void {
$url = 'https://www.w3.org/2000/10/rdf-tests/RDF-Model-Syntax_1.0/ms_7.2_1.rdf';
$client = new \GuzzleHttp\Client();

0 comments on commit 82a1efa

Please sign in to comment.