def __len__(self, context=None):
        """
        Returns the number of statements in this Graph.
        """
        named_graph = _get_named_graph(context)
        if named_graph is not None:
            return (models.LiteralStatement.objects.filter(context_id=named_graph.id).count()
                    + models.URIStatement.objects.filter(context_id=named_graph.id).count())
        else:
            return (models.URIStatement.objects.values('subject', 'predicate', 'object').distinct().count()
                    + models.LiteralStatement.objects.values('subject', 'predicate', 'object').distinct().count())
def __len__ ( self , context = None ) : named_graph = _get_named_graph ( context ) if named_graph is not None : return ( models . LiteralStatement . objects . filter ( context_id = named_graph . id ) . count ( ) + models . URIStatement . objects . filter ( context_id = named_graph . id ) . count ( ) ) else : return ( models . URIStatement . objects . values ( 'subject' , 'predicate' , 'object' ) . distinct ( ) . count ( ) + models . LiteralStatement . objects . values ( 'subject' , 'predicate' , 'object' ) . distinct ( ) . count ( ) )
Returns the number of statements in this Graph.