|  |  |  | Rasqal RDF Query Library Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
rasqal_triple; rasqal_triple * rasqal_new_triple (rasqal_literal *subject,rasqal_literal *predicate,rasqal_literal *object); rasqal_triple * rasqal_new_triple_from_triple (rasqal_triple *t); void rasqal_free_triple (rasqal_triple *t); rasqal_literal * rasqal_triple_get_origin (rasqal_triple *t); enum rasqal_triple_parts; int rasqal_triple_print (rasqal_triple *t,FILE *fh); void rasqal_triple_set_origin (rasqal_triple *t,rasqal_literal *l);
An object for a triple pattern or an RDF triple in a query.  It
contains the three parts of an RDF triple - subject, predicate,
object as well as origin for matching triples in some graph (such as
with the SPARQL GRAPH).
typedef struct {
  rasqal_literal* subject;
  rasqal_literal* predicate;
  rasqal_literal* object;
  rasqal_literal* origin;
  unsigned int flags;
} rasqal_triple;
A triple pattern or RDF triple.
This is used as a triple pattern in queries and an RDF triple when generating RDF triples such as with SPARQL CONSTRUCT.
| rasqal_literal * | Triple subject. | 
| rasqal_literal * | Triple predicate. | 
| rasqal_literal * | Triple object. | 
| rasqal_literal * | Triple origin. | 
| Or of enum rasqal_triple_flags bits. | 
rasqal_triple * rasqal_new_triple (rasqal_literal *subject,rasqal_literal *predicate,rasqal_literal *object);
Constructor - create a new rasqal_triple triple or triple pattern. Takes ownership of the literals passed in.
The triple origin can be set with rasqal_triple_set_origin().
| 
 | Triple subject. | 
| 
 | Triple predicate. | 
| 
 | Triple object. | 
| Returns : | a new rasqal_triple or NULL on failure. | 
rasqal_triple *     rasqal_new_triple_from_triple       (rasqal_triple *t);
Copy constructor - create a new rasqal_triple from an existing one.
| 
 | Triple to copy. | 
| Returns : | a new rasqal_triple or NULL on failure. | 
void                rasqal_free_triple                  (rasqal_triple *t);
Destructor - destroy a rasqal_triple object.
| 
 | rasqal_triple object. | 
rasqal_literal *    rasqal_triple_get_origin            (rasqal_triple *t);
Get the origin field of a rasqal_triple.
| 
 | The triple object. | 
| Returns : | The triple origin or NULL. | 
typedef enum {
  RASQAL_TRIPLE_NONE     = 0,
  RASQAL_TRIPLE_SUBJECT  = 1,
  RASQAL_TRIPLE_PREDICATE= 2,
  RASQAL_TRIPLE_OBJECT   = 4,
  RASQAL_TRIPLE_ORIGIN   = 8,
  RASQAL_TRIPLE_GRAPH    = RASQAL_TRIPLE_ORIGIN,
  RASQAL_TRIPLE_SPO      = RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT,
  RASQAL_TRIPLE_SPOG     = RASQAL_TRIPLE_SPO | RASQAL_TRIPLE_GRAPH
} rasqal_triple_parts;
Flags for parts of a triple.
| no parts | |
| Subject present in a triple. | |
| Predicate present in a triple. | |
| Object present in a triple. | |
| Origin/graph present in a triple. | |
| Alias for RASQAL_TRIPLE_ORIGIN | |
| Subject, Predicate and Object present in a triple. | |
| Subject, Predicate, Object, Graph present in a triple. | 
int rasqal_triple_print (rasqal_triple *t,FILE *fh);
Print a Rasqal triple in a debug format.
The print debug format may change in any release.
| 
 | rasqal_triple object. | 
| 
 | The FILE* handle to print to. | 
| Returns : | non-0 on failure | 
void rasqal_triple_set_origin (rasqal_triple *t,rasqal_literal *l);
Set the origin field of a rasqal_triple.
| 
 | The triple object. | 
| 
 | The rasqal_literal object to set as origin. |