Skip to content

Commit

Permalink
README.md: document TriGParser options (closes pietercolpaert#35) (pi…
Browse files Browse the repository at this point in the history
…etercolpaert#40)

* README.md: document TriGParser options (closes pietercolpaert#35)

* README.md: describe blankNodePrefix parser option default value

* README.md: refined explicitQuantifiers part of Parser options

* README.md: small refinements

---------

Co-authored-by: Konrad Abicht <[email protected]>
  • Loading branch information
zozlak and k00ni authored Feb 21, 2024
1 parent 8bebaa0 commit 099f49e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ $parser->parseChunk($chunk);
$parser->end(); //Needs to be called
```

#### Parser options

* `format` input format (case-insensitive)
* if not provided or not matching any options below, then any [Turtle](https://www.w3.org/TR/turtle/), [TriG](https://www.w3.org/TR/trig/), [N-Triples](https://www.w3.org/TR/n-triples/) or [N-Quads](https://www.w3.org/TR/n-quads/) input can be parsed (but NOT the [N3](https://www.w3.org/TeamSubmission/n3/))
* `turtle` - [Turtle](https://www.w3.org/TR/turtle/)
* `trig` - [TriG](https://www.w3.org/TR/trig/)
* contains `triple`, e.g. `triple`, `ntriples`, `N-Triples` - [N-Triples](https://www.w3.org/TR/n-triples/)
* contains `quad`, e.g. `quad`, `nquads`, `N-Quads` - [N-Quads](https://www.w3.org/TR/n-quads/)
* contains `n3`, e.g. `n3` - [N3](https://www.w3.org/TeamSubmission/n3/)
* `blankNodePrefix` (defaults to `b0_`) prefix forced on blank node names, e.g. `TriGWriter(["blankNodePrefix" => 'foo'])` will parse `_:bar` as `_:foobar`.
* `documentIRI` sets the base URI used to resolve relative URIs (not applicable if `format` indicates n-triples or n-quads)
* `lexer` allows usage of own lexer class. A lexer must provide following public methods:
* `tokenize(string $input, bool $finalize = true): array<array{'subject': string, 'predicate': string, 'object': string, 'graph': string}>`
* `tokenizeChunk(string $input): array<array{'subject': string, 'predicate': string, 'object': string, 'graph': string}>`
* `end(): array<array{'subject': string, 'predicate': string, 'object': string, 'graph': string}>`
* `explicitQuantifiers` - [...]

### Utility
```php
use pietercolpaert\hardf\Util;
Expand Down

0 comments on commit 099f49e

Please sign in to comment.