The surf.resource.value Module

class surf.resource.value.ResourceValue(values_source, resource, attribute_name)[source]

Bases: list

the surf.resource.value.ResourceValue class is used by the surf.resource.Resource class to lazy load instances of resources.

Note

the class also emulates a list, while in addition providing support for SuRF queries, as defined in the surf.query module.

Note

instances of this class must not be created manually, instead they are automatically generated by SuRF as needed

context(context)[source]

get the context query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

count

L.count(value) -> integer – return number of occurrences of value

desc()[source]

get the desc query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

first

return the first resource or None otherwise.

full(only_direct=False)[source]

get the full query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

get_by(**kwargs)[source]

get the get_by query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

get_first()[source]

return the first resource or None otherwise.

get_one()[source]

return only one resource. If there are more resources available the surf.exc.NoResultFound exception is raised

index

L.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.

limit(value)[source]

get the limit query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

offset(value)[source]

get the offset query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

one

return only one resource. If there are more resources available the surf.exc.NoResultFound exception is raised

order(value=True)[source]

get the order query attribute. Syntactic sugar for surf.resource.Resource.query_attribute() method.

reverse

L.reverse() – reverse IN PLACE

set_dirty(dirty)[source]

mark this resource as dirty. By doing so, SuRF will refresh it’s content as soon as it’s necessary

sort

L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1

to_rdf(value)[source]

return an RDF representation of the resource

Previous topic

The surf.resource Module

Next topic

The surf.resource.result_proxy Module

This Page