Package rdflib :: Module util
[show private | hide private]
[frames | no frames]

Module rdflib.util

Function Summary
  check_context(c)
  check_object(o)
Test that o is a valid object identifier.
  check_pattern((s, p, o))
  check_predicate(p)
Test that p is a valid predicate identifier.
  check_statement((s, p, o))
  check_subject(s)
Test that s is a valid subject identifier.
  date_time(t, local_time_zone)
http://www.w3.org/TR/NOTE-datetime ex: 1997-07-16T19:20:30Z
  first(seq)
  from_n3(s, default, backend)
Creates the Identifier corresponding to the given n3 string.
  graph_to_dot(graph, dot)
Turns graph into dot (graphviz graph drawing format) using pydot.
  more_than(sequence, number)
Returns 1 if sequence has more items than number and 0 if not.
  parse_date_time(val)
always returns seconds in UTC
  term(str, default)
See also from_n3
  uniq(sequence, strip)
removes duplicate strings from the sequence.

Function Details

check_object(o)

Test that o is a valid object identifier.

check_predicate(p)

Test that p is a valid predicate identifier.

check_subject(s)

Test that s is a valid subject identifier.

date_time(t=None, local_time_zone=False)

http://www.w3.org/TR/NOTE-datetime ex: 1997-07-16T19:20:30Z
>>> date_time(1126482850)
'2005-09-11T23:54:10Z'
>>> date_time(1126482850, local_time_zone=True)
'2005-09-11T19:54:10-04:00'
>>> date_time(1)
'1970-01-01T00:00:01Z'
>>> date_time(0)
'1970-01-01T00:00:00Z'

from_n3(s, default=None, backend=None)

Creates the Identifier corresponding to the given n3 string. WARNING: untested, may contain bugs. TODO: add test cases.

graph_to_dot(graph, dot)

Turns graph into dot (graphviz graph drawing format) using pydot.

more_than(sequence, number)

Returns 1 if sequence has more items than number and 0 if not.

parse_date_time(val)

always returns seconds in UTC

# tests are written like this to make any errors easier to understand >>> parse_date_time('2005-09-11T23:54:10Z') - 1126482850.0 0.0
>>> parse_date_time('2005-09-11T16:54:10-07:00') - 1126482850.0
0.0
>>> parse_date_time('1970-01-01T00:00:01Z') - 1.0
0.0
>>> parse_date_time('1970-01-01T00:00:00Z') - 0.0
0.0

>>> parse_date_time("2005-09-05T10:42:00") - 1125916920.0
0.0

term(str, default=None)

See also from_n3

uniq(sequence, strip=0)

removes duplicate strings from the sequence.

Generated by Epydoc 2.1 on Mon Oct 23 14:11:20 2006 http://epydoc.sf.net