web/views/rdf.py
changeset 10609 e2d8e81bfe68
parent 10317 b81adb5e32f9
child 10666 7f6b5f023884
equal deleted inserted replaced
10608:7fc548d9dd8e 10609:e2d8e81bfe68
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """base xml and rss views"""
    18 """base xml and rss views"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 _ = unicode
    21 _ = unicode
       
    22 
       
    23 from six.moves import range
    22 
    24 
    23 from yams import xy
    25 from yams import xy
    24 
    26 
    25 from cubicweb.schema import VIRTUAL_RTYPES
    27 from cubicweb.schema import VIRTUAL_RTYPES
    26 from cubicweb.view import EntityView
    28 from cubicweb.view import EntityView
    54         def call(self):
    56         def call(self):
    55             graph = rdflib.Graph()
    57             graph = rdflib.Graph()
    56             graph.bind('cw', CW)
    58             graph.bind('cw', CW)
    57             for prefix, xmlns in xy.XY.prefixes.items():
    59             for prefix, xmlns in xy.XY.prefixes.items():
    58                 graph.bind(prefix, rdflib.Namespace(xmlns))
    60                 graph.bind(prefix, rdflib.Namespace(xmlns))
    59             for i in xrange(self.cw_rset.rowcount):
    61             for i in range(self.cw_rset.rowcount):
    60                 entity = self.cw_rset.complete_entity(i, 0)
    62                 entity = self.cw_rset.complete_entity(i, 0)
    61                 self.entity2graph(graph, entity)
    63                 self.entity2graph(graph, entity)
    62             self.w(graph.serialize(format=self.format))
    64             self.w(graph.serialize(format=self.format))
    63 
    65 
    64         def entity_call(self, entity):
    66         def entity_call(self, entity):