示例#1
0
def test_convert():
    from clld.lib.rdf import ClldGraph, convert, FORMATS

    g = ClldGraph()
    for from_ in FORMATS:
        for to_ in list(FORMATS.keys()) + [None]:
            convert(g.serialize(format=from_), from_, to_)
示例#2
0
文件: test_lib_rdf.py 项目: clld/clld
def test_convert():
    from clld.lib.rdf import ClldGraph, convert, FORMATS

    g = ClldGraph()
    for from_ in FORMATS:
        for to_ in list(FORMATS.keys()) + [None]:
            convert(g.serialize(format=from_), from_, to_)
示例#3
0
    def test_convert(self):
        from clld.lib.rdf import ClldGraph, convert, FORMATS

        g = ClldGraph()
        for from_ in FORMATS:
            for to_ in FORMATS:
                convert(g.serialize(format=from_), from_, to_)
示例#4
0
    def test_convert(self):
        from clld.lib.rdf import ClldGraph, convert, FORMATS

        g = ClldGraph()
        for from_ in FORMATS:
            for to_ in FORMATS:
                convert(g.serialize(format=from_), from_, to_)
示例#5
0
文件: rdf.py 项目: Woseseltops/clld
 def render(self, ctx, req):
     if req.params.get("sEcho"):
         # triggered from a datatable, thus potentially filtered and sorted
         items = [item.id for item in ctx.get_query(limit=1000)]
     else:
         # triggered without any filter parameters
         items = [row[0] for row in req.db.query(ctx.model.id)]
     return convert(super(RdfIndex, self).render(items, req), "xml", self.rdflibname)
示例#6
0
文件: rdf.py 项目: Woseseltops/clld
 def render(self, ctx, req):
     if req.params.get('sEcho'):
         # triggered from a datatable, thus potentially filtered and sorted
         items = [item.id for item in ctx.get_query(limit=1000)]
     else:
         # triggered without any filter parameters
         items = [row[0] for row in req.db.query(ctx.model.id)]
     return convert(
         super(RdfIndex, self).render(items, req), 'xml', self.rdflibname)
示例#7
0
文件: rdf.py 项目: clld/clld
 def render(self, ctx, req):
     if req.params.get('sEcho'):
         # triggered from a datatable, thus potentially filtered and sorted
         items = ctx.get_query(limit=1000)
     else:
         # triggered without any filter parameters
         items = ctx.rdf_index_query(req.db.query(ctx.db_model()).order_by(ctx.db_model().pk))
     if isinstance(ctx.model.name, property):
         items = [(item.id, None) for item in items.options(load_only('id'))]
     else:
         items = [(item.id, item.name)
                  for item in items.options(load_only('id', 'name'))]
     return convert(super(RdfIndex, self).render(items, req), 'xml', self.rdflibname)
示例#8
0
文件: rdf.py 项目: cevmartinez/clld
 def render(self, ctx, req):
     if req.params.get('sEcho'):
         # triggered from a datatable, thus potentially filtered and sorted
         items = ctx.get_query(limit=1000)
     else:
         # triggered without any filter parameters
         items = req.db.query(ctx.model).order_by(ctx.model.pk)
     if isinstance(ctx.model.name, property):
         items = [(item.id, None) for item in items.options(load_only('id'))]
     else:
         items = [(item.id, item.name)
                  for item in items.options(load_only('id', 'name'))]
     return convert(super(RdfIndex, self).render(items, req), 'xml', self.rdflibname)
示例#9
0
 def render(self, ctx, req):
     return convert(
         super(RdfIndex, self).render(ctx, req), 'xml', self.rdflibname)
示例#10
0
 def render(self, ctx, req):
     return convert(xmlchars(super(Rdf, self).render(ctx, req)), 'xml',
                    self.rdflibname)
示例#11
0
文件: rdf.py 项目: Woseseltops/clld
 def render(self, ctx, req):
     return convert(xmlchars(super(Rdf, self).render(ctx, req)), "xml", self.rdflibname)
示例#12
0
文件: rdf.py 项目: mitcho/clld
 def render(self, ctx, req):
     return convert(super(RdfIndex, self).render(ctx, req), 'xml', self.rdflibname)