|
| | __construct ( $role=parent::DOCUMENT_ROLE, ?BNodeLabeler $labeler=null) |
| |
| | encode ( $val, $indent) |
| | Emit $val as JSON, with $indent extra indentations on each line.
|
| |
| | writeValue ( $literal, $typeBase, $typeLocal=null) |
| |
| | getMimeType () |
| |
| | prefix ( $prefix, $iri) |
| | Registers a prefix.
|
| |
| | getPrefixes () |
| | Returns the prefix map.
|
| |
| | sub () |
| |
| | getRole () |
| |
| | blank ( $label=null) |
| |
| | start () |
| |
| | finish () |
| |
| | drain () |
| |
| | about ( $base, $local=null) |
| |
| | a ( $typeBase, $typeLocal=null) |
| |
| | say ( $base, $local=null) |
| |
| | is ( $base, $local=null) |
| |
| | text ( $text, $language=null) |
| |
| | value ( $value, $typeBase=null, $typeLocal=null) |
| |
|
|
| beginJson () |
| | Write document header.
|
| |
|
| finishJson () |
| | Write document footer.
|
| |
|
| finishDocument () |
| |
| | writeSubject ( $base, $local=null) |
| |
|
| finishSubject () |
| |
| | writePredicate ( $base, $local=null) |
| |
| | writeResource ( $base, $local=null) |
| |
| | writeText ( $text, $language=null) |
| |
| | addTypedValue ( $type, $simpleVal, $expandedVal=null, $forceExpand=false) |
| | Add a typed value for the given predicate.
|
| |
|
| finishPredicate () |
| |
| | newSubWriter ( $role, BNodeLabeler $labeler) |
| |
| | registerShorthand ( $shorthand, $prefix, $local) |
| | Registers a shorthand that can be used instead of a qname, like 'a' can be used instead of 'rdf:type'.
|
| |
| | isShorthand ( $shorthand) |
| | Determines whether $shorthand can be used as a shorthand.
|
| |
| | isPrefix ( $prefix) |
| | Determines whether $shorthand can legally be used as a prefix.
|
| |
| | isValidLanguageCode ( $languageCode) |
| |
| | write ( $w) |
| | Appends string to the output buffer.
|
| |
| | expandShorthand (&$base, &$local) |
| | If $base is a shorthand, $base and $local are updated to hold whatever qname the shorthand was associated with.
|
| |
| | expandQName (&$base, &$local) |
| | If $base is a registered prefix, $base will be replaced by the base IRI associated with that prefix, with $local appended.
|
| |
| | state ( $newState) |
| | Perform a state transition.
|
| |
| | expandSubject (&$base, &$local) |
| | Perform any expansion (shorthand to qname, qname to IRI) desired for subject identifiers.
|
| |
| | expandPredicate (&$base, &$local) |
| | Perform any expansion (shorthand to qname, qname to IRI) desired for predicate identifiers.
|
| |
| | expandResource (&$base, &$local) |
| | Perform any expansion (shorthand to qname, qname to IRI) desired for resource identifiers.
|
| |
| | expandType (&$base, &$local) |
| | Perform any expansion (shorthand to qname, qname to IRI) desired for type identifiers.
|
| |
RdfWriter implementation for generating JSON-LD output.
@license GPL-2.0-or-later
- Author
- C. Scott Ananian
| Wikimedia\Purtle\JsonLdRdfWriter::addTypedValue |
( |
| $type, |
|
|
| $simpleVal, |
|
|
| $expandedVal = null, |
|
|
| $forceExpand = false ) |
|
protected |
Add a typed value for the given predicate.
If possible, adds a default type to the context to avoid having to repeat type information in each value for this predicate. If there is already a default type which conflicts with this one, or if $forceExpand is true, then use the "expanded" value which will explicitly override any default type.
- Parameters
-
| string | $type | The compactified JSON-LD @type for this value, or self::DEFAULT_TYPE to indicate the default JSON-LD type coercion rules should be used. |
| string | int | float | bool | $simpleVal | The "simple" representation for this value, used if the type can be hoisted into the context. |
| array | null | $expandedVal | The "expanded" representation for this value, used if the context @type conflicts with this value; or null to use "@value" for the expanded representation. |
| bool | $forceExpand | If true, don't try to add this type to the context. Defaults to false. |