Into

Modules

Documentation

classPiiResourceStatement

#include <PiiResourceStatement.h>

A class used by PiiResourceDatabase to store statements about resources.

Description

Each statement is composed of a subject, a predicate and an object, which are stored as strings. The subject always refers to a resource about which the statement is being made. The predicate describes which trait or aspect of the subject is being described, and object specifies the value of the aspect. The value may be either a string literal or a reference to another resource.

Public types

enum
{ InvalidType, LiteralType, ResourceType }

Possible types of the object of the statement.

Constructors and destructor

( )

Create a new statement.

Copy another statement.

Create an invalid statement.

(
  • const char * subject
  • const char * predicate
  • const char * object
  • Type type = LiteralType
  • int id = -1
)

Create a new statement.

(
  • int subject
  • const QString & predicate
  • const QString & object
  • Type type = LiteralType
  • int id = -1
)

Create a new statement.

Public member functions

int
( )

Returns the id number of the statement.

bool

See if this is a valid statement.

( )

Returns the object of the statement.

( )

Assign the contents of other to this.

Returns the predicate of the statement.

void
(
  • int id
)

Set the resource id.

Returns the subject of the statement.

( )

Returns the type of the statement.

Enumeration details

  • enum Type

    Possible types of the object of the statement.

    • InvalidType - the statement is invalid.

    • LiteralType - the object is a string literal.

    • ResourceType - the object is a resource id and references another resource.

Function details

  • PiiResourceStatement

    ( )

    Create a new statement.

  • PiiResourceStatement

    ( )

    Copy another statement.

  • PiiResourceStatement

    ()

    Create an invalid statement.

  • PiiResourceStatement

    (
    • const char * subject
    • const char * predicate
    • const char * object
    • Type type = LiteralType
    • int id = -1
    )

    Create a new statement.

  • PiiResourceStatement

    (
    • int subject
    • const QString & predicate
    • const QString & object
    • Type type = LiteralType
    • int id = -1
    )

    Create a new statement.

    This constructor creates a statement that refers another statement. The subject will be converted to "#subject". The following two statements are equal:

     PiiResourceStatement s1("#123", "pii:connector", "MyConnector");
     PiiResourceStatement s2(123, "pii:connector", "MyConnector");
    
  • ~PiiResourceStatement

    ()
  • int id

    ()

    Returns the id number of the statement.

    PiiResourceDatabase automatically assigns id numbers to inserted statements.

  • bool isValid

    ()

    See if this is a valid statement.

    A statement is valid if and only if both subject and object are non-empty, and the type of the object is not InvalidType. The predicate may be an empty string.

  • QString object

    ()

    Returns the object of the statement.

    The object is either a string literal or a resource identifier, depending on type().

  • PiiResourceStatement & operator=

    ( )

    Assign the contents of other to this.

  • QString predicate

    ()

    Returns the predicate of the statement.

    The predicate is always a string literal.

  • void setId

    (
    • int id
    )

    Set the resource id.

  • QString subject

    ()

    Returns the subject of the statement.

    The subject is always a resource identifier.

  • Type type

    ()

    Returns the type of the statement.

    The type specifies how the object should be interpreted.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.