summaryrefslogtreecommitdiff
path: root/rdflib/plugins/sparql/results/graph.py
blob: bfd03c00c005c4480b7d3d0f26e069df87cac227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

from typing import IO, Optional

from rdflib.graph import Graph
from rdflib.query import Result, ResultParser


class GraphResultParser(ResultParser):
    # type error: Signature of "parse" incompatible with supertype "ResultParser"
    def parse(self, source: IO, content_type: Optional[str]) -> Result:  # type: ignore[override]
        res = Result("CONSTRUCT")  # hmm - or describe?type_)
        res.graph = Graph()
        res.graph.parse(source, format=content_type)

        return res