Literals

struct CowlLiteral : public CowlAnnotValue

Represents a Literal in the OWL 2 specification.

Public Functions

CowlLiteral *cowl_literal(CowlDatatype *dt, CowlString *value, CowlString *lang)

Returns a retained literal.

Parameters
  • dt – [optional] The datatype.

  • value – The value.

  • lang – [optional] The language tag.

Returns

Retained literal, or NULL on error.

CowlLiteral *cowl_literal_from_string(UString dt, UString value, UString lang)

Returns a retained literal given the string representations of its components.

Parameters
  • dt – [optional] The datatype.

  • value – The value.

  • lang – [optional] The language tag.

Returns

Retained literal, or NULL on error.

void cowl_literal_release(CowlLiteral *literal)

Releases the specified literal.

Parameters

literal – The literal.

CowlDatatype *cowl_literal_get_datatype(CowlLiteral *literal)

Gets the datatype.

Parameters

literal – The literal.

Returns

The datatype.

CowlString *cowl_literal_get_value(CowlLiteral *literal)

Gets the value.

Parameters

literal – The literal.

Returns

The value.

CowlString *cowl_literal_get_lang(CowlLiteral *literal)

Gets the language tag.

Parameters

literal – The literal.

Returns

The language tag.

CowlString *cowl_literal_to_string(CowlLiteral *literal)

Returns the string representation of the specified literal.

Note

The returned string is retained, so you are responsible for releasing it.

Parameters

literal – The literal.

Returns

String representation, or NULL on error.

bool cowl_literal_equals(CowlLiteral *lhs, CowlLiteral *rhs)

Equality function.

Parameters
  • lhs – LHS of the equality relation.

  • rhs – RHS of the equality relation.

Returns

True if the equality relation holds, false otherwise.

ulib_uint cowl_literal_hash(CowlLiteral *literal)

Hash function.

Parameters

literal – The literal.

Returns

The hash value.

bool cowl_literal_iterate_primitives(CowlLiteral *literal, CowlPrimitiveFlags flags, CowlIterator *iter)

Iterates over the primitives referenced by the specified literal.

Parameters
  • literal – The literal.

  • flags – Iteration flags.

  • iter – The iterator.

Returns

True if the iteration was completed, false if it was stopped.

Public Static Functions

static inline CowlLiteral *cowl_literal_retain(CowlLiteral *literal)

Retains the specified literal.

Parameters

literal – The literal.

Returns

Retained literal.

cowl_literal_from_static(DT, VALUE, LANG)

Returns a retained literal given the static string representations of its components.

Parameters
  • DT – [char const[], optional] The datatype.

  • VALUE – [char const[]] The value.

  • LANG – [char const[], optional] The language tag.

Returns

[CowlLiteral *] Retained literal, or NULL on error.