nyx_client.property

Structures for defining custom metadata (properties) for nyx_client.data.Data.

Fields in said structures follow Nyx OpenAPI spec naming.

Attributes

PropertyValue

The value (object) of a property.

Classes

LangLiteral

A metadata property type describing a string with a given language.

StringLiteral

A metadata property type describing a string without a language.

Literal

A metadata property type describing a literal with the given datatype.

Uri

A metadata property type describing a Uri.

Property

A metadata property with a single value.

Module Contents

class nyx_client.property.LangLiteral

A metadata property type describing a string with a given language.

Implicit datatype: rdf:langString

lang: str

2-character language code

value: str

String representation of the value

class nyx_client.property.StringLiteral

A metadata property type describing a string without a language.

Implicit datatype: rdf:string

value: str

String representation of the value

class nyx_client.property.Literal

A metadata property type describing a literal with the given datatype.

Implicit datatype: rdfs:Literal

dataType: str

XSD data type without its namespace prefix.

The following types (from XSD namespace) are currently supported:

dateTime, time, date, boolean, integer, decimal, float, double, nonPositiveInteger, negativeInteger, nonNegativeInteger, positiveInteger, long, unsignedLong, int, unsignedInt, short, unsignedShort, byte, unsignedByte, base64Binary, anyURI

value: str

String representation of the value

class nyx_client.property.Uri

A metadata property type describing a Uri.

uri: str

String representation of the URI

nyx_client.property.PropertyValue

The value (object) of a property.

class nyx_client.property.Property

A metadata property with a single value.

Multiple instances are used to represent a key (predicate) with multiple values.

key: str

The key (predicate) of the property. Must be an IRI.

value: PropertyValue

The value (object) of the property.

One of LangLiteral, StringLiteral, Literal or Uri

as_dict()

Returns the object as a dictionary.

Returns:

A dictionary of the Property that matches layout expected by the API.

Return type:

dict[str, Any]

classmethod from_dict(data)

Returns a new property instance constructed from the given dictionary.

This is expected to be in the same format as generated by as_dict() (or returned nu the API).

Parameters:

data (dict[str, Any])

Return type:

Property

classmethod lang_string(key, value, lang)

Shorthand for creating a language-specific string property.

See LangLiteral for more details.

Parameters:
Return type:

Property

classmethod string(key, value)

Shorthand for creating a string property (without language).

See StringLiteral for more details.

Parameters:
Return type:

Property

classmethod literal(key, value, data_type)

Shorthand for creating a property with a specific data type.

See Literal for more details.

Parameters:
Return type:

Property

classmethod uri(key, uri)

Shorthand for creating a URI property.

See Uri for more details.

Parameters:
Return type:

Property