franz.openrdf.model package¶
Module contents¶
-
class
franz.openrdf.model.
BNode
(id=None)[source]¶ Bases:
franz.openrdf.model.value.Resource
A blank node.
-
getValue
()¶
-
-
class
franz.openrdf.model.
Literal
(label, datatype=None, language=None)[source]¶ Bases:
franz.openrdf.model.value.Value
Implementation of the Literal class.
-
datatype
¶ The URI representing the datatype for this literal, if there is one
-
label
¶ The label/value for this Literal
-
language
¶ The language for this Literal
-
-
class
franz.openrdf.model.
Statement
(subject, predicate, object, context=None, id=None)[source]¶ Bases:
object
Wraps a triple or a quad. Might also contain an id.
-
__init__
(subject, predicate, object, context=None, id=None)[source]¶ Create a statement.
Each component can be either a Value object or a string in N-Triples format. Strings will be parsed lazily the first time a component is accessed. Accessors will always return Value objects.
Parameters: - subject (URI|BNode|str) – Subject component - URI, blank node or a string in N-Triples format.
- predicate – Predicate component. Either a URI or a string in N-Triples format.
:type predicate URI|str :param object: Subject component. Either a Value or a string
in N-Triples format.Parameters: - context (URI|str) – Graph component (optional). Can be a URI or a string in N-Triples format.
- id (int|str) – Statement id (optional).
-
context
¶
-
getContext
()[source]¶ Get the graph (the fourth, optional element of the statement).
Returns: Graph URI. Return type: URI
-
getObject
()[source]¶ Get the object (the third element of the statement).
Returns: Object. Return type: Value
-
getPredicate
()[source]¶ Get the predicate (the second element of the statement).
Returns: Predicate. Return type: URI
-
getSubject
()[source]¶ Get the subject (the first element of the statement).
Returns: Subject. Return type: Value
-
getTripleID
()[source]¶ Get the statement id.
Note that this field might not present, depending on the way in which the statement has been created.
Returns: A numerical id. Return type: int
-
id
¶
-
object
¶
-
predicate
¶
-
subject
¶
-
-
class
franz.openrdf.model.
URI
(uri=None, namespace=None, localname=None)[source]¶ Bases:
franz.openrdf.model.value.Resource
Lightweight implementation of the class ‘URI’.
-
getURI
()[source]¶ Return the URI (string) for ‘self’. This method is typically overloaded by subclasses, which may use lazy evaluation to retrieve the string.
-
localname
¶
-
namespace
¶
-
toNTriples
()[source]¶ Return an NTriples representation of a resource, in this case, wrap it in angle brackets.
-
uri
¶ Return the URI (string) for ‘self’. This method is typically overloaded by subclasses, which may use lazy evaluation to retrieve the string.
-
value
¶
-
-
class
franz.openrdf.model.
Value
[source]¶ Bases:
object
Top class in the org.openrdf.model interfaces.
-
class
franz.openrdf.model.
ValueFactory
(store)[source]¶ Bases:
object
A factory for creating URIs, blank nodes, literals and statements.
-
BLANK_NODE_AMOUNT
= 10¶
-
createRange
(lowerBound, upperBound)[source]¶ Create a compound literal representing a range from ‘lowerBound’ to ‘upperBound’
-
namespace
(prefix)[source]¶ Create an object that allows for simple creation of URIs in given namespace. Attribute lookups on the returned object will produce URIs with the attribute name as localname.
Parameters: prefix (str) – Prefix prepended to URIs created by the returned object. Returns: An object that can be used to create URIs.
-
object_position_term_to_openrdf_term
(term, predicate=None)[source]¶ If ‘term’ is a string, integer, float, etc, convert it to a Literal term. Otherwise, if its a Value, just pass it through.
-