§
    kÃ¿a)  ã                   ót   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 dgZ
 G d	„ de¦  «        Zd
S )aü  
This is a rdflib plugin for parsing NQuad files into Conjunctive
graphs that can be used and queried. The store that backs the graph
*must* be able to handle contexts.

>>> from rdflib import ConjunctiveGraph, URIRef, Namespace
>>> g = ConjunctiveGraph()
>>> data = open("test/nquads.rdflib/example.nquads", "rb")
>>> g.parse(data, format="nquads") # doctest:+ELLIPSIS
<Graph identifier=... (<class 'rdflib.graph.Graph'>)>
>>> assert len(g.store) == 449
>>> # There should be 16 separate contexts
>>> assert len([x for x in g.store.contexts()]) == 16
>>> # is the name of entity E10009 "Arco Publications"?
>>> #   (in graph http://bibliographica.org/entity/E10009)
>>> # Looking for:
>>> # <http://bibliographica.org/entity/E10009>
>>> #   <http://xmlns.com/foaf/0.1/name>
>>> #   "Arco Publications"
>>> #   <http://bibliographica.org/entity/E10009>
>>> s = URIRef("http://bibliographica.org/entity/E10009")
>>> FOAF = Namespace("http://xmlns.com/foaf/0.1/")
>>> assert(g.value(s, FOAF.name).eq("Arco Publications"))
é    )Ú	getreader)ÚConjunctiveGraph)ÚW3CNTriplesParser)Ú
ParseError)Úr_tail)Úr_wspaceÚNQuadsParserc                   ó   — e Zd Zdd„Zdd„ZdS )r	   Nc                 ó   — |j         j        s
J d¦   «         ‚t          |j         |j        ¬¦  «        | _        |                     ¦   «         }|s,|                     ¦   «         } t          d¦  «        |¦  «        }t          |d¦  «        st          d¦  «        ‚|| _
        d| _        	 |                      ¦   «         x| _        }| j        €n?	 |                      |¦  «         n'# t          $ r}t          d	|›d
|›�¦  «        ‚d}~ww xY wŒb| j        S )aÚ  
        Parse inputsource as an N-Quads file.

        :type inputsource: `rdflib.parser.InputSource`
        :param inputsource: the source of N-Quads-formatted data
        :type sink: `rdflib.graph.Graph`
        :param sink: where to send parsed triples
        :type bnode_context: `dict`, optional
        :param bnode_context: a dict mapping blank node identifiers to `~rdflib.term.BNode` instances.
                              See `.NTriplesParser.parse`
        z1NQuadsParser must be given a context aware store.)ÚstoreÚ
identifierzutf-8Úreadz)Item to parse must be a file-like object.Ú TNzInvalid line (z):
)r   Úcontext_awarer   r   ÚsinkÚgetCharacterStreamÚgetByteStreamr   Úhasattrr   ÚfileÚbufferÚreadlineÚlineÚ	parseline)ÚselfÚinputsourcer   Úbnode_contextÚkwargsÚsourceÚ_NQuadsParser__lineÚmsgs           ú?/usr/lib/python3/dist-packages/rdflib/plugins/parsers/nquads.pyÚparsezNQuadsParser.parse(   sA  € ð ŒzÔ'ð 	
ð 	
ØBñ	
ô 	
ð 	
õ %¨4¬:À$Ä/ÐRÑRÔRˆŒ	à×/Ò/Ñ1Ô1ˆØð 	0Ø ×.Ò.Ñ0Ô0ˆFØ'•Y˜wÑ'Ô'¨Ñ/Ô/ˆFå�v˜vÑ&Ô&ð 	JÝÐHÑIÔIÐIàˆŒ	ØˆŒð	KØ!%§¢¡¤Ð0ˆDŒI˜ØŒyÐ ØðKØ—’˜}Ñ-Ô-Ð-Ð-øÝð Kð Kð KÝ �j¸S¸S¸SÀ&À&Ð!IÑJÔJÐJøøøøðKøøøð	Kð ŒyÐs   ÃC! Ã!
DÃ+D Ä Dc                 óÂ  — |                       t          ¦  «         | j        r| j                             d¦  «        rd S |                      |¦  «        }|                       t          ¦  «         |                      ¦   «         }|                       t          ¦  «         |                      |¦  «        }|                       t          ¦  «         |                      ¦   «         p |                      |¦  «        p| j	        j
        }|                       t          ¦  «         | j        rt          d¦  «        ‚| j	                             |¦  «                             |||f¦  «         d S )Nú#zTrailing garbage)Úeatr   r   Ú
startswithÚsubjectÚ	predicateÚobjectÚurirefÚnodeidr   r   r   r   Úget_contextÚadd)r   r   r'   r(   ÚobjÚcontexts         r!   r   zNQuadsParser.parselineN   s'  € Ø�Š•ÑÔÐØ”	ð 	˜dœi×2Ò2°CÑ9Ô9ð 	ØˆFà—,’,˜}Ñ-Ô-ˆØ�Š•ÑÔÐà—N’NÑ$Ô$ˆ	Ø�Š•ÑÔÐà�kŠk˜-Ñ(Ô(ˆØ�Š•ÑÔÐà—+’+‘-”-ÐU 4§;¢;¨}Ñ#=Ô#=ÐUÀÄÔAUˆØ�Š•ÑÔÐàŒ9ð 	1ÝÐ/Ñ0Ô0Ð0ð 	Œ	×Ò˜gÑ&Ô&×*Ò*¨G°YÀÐ+DÑEÔEÐEÐEÐEó    )N)Ú__name__Ú
__module__Ú__qualname__r"   r   © r0   r!   r	   r	   '   sC   € € € € € ð$ð $ð $ð $ðLFð Fð Fð Fð Fð Fr0   N)Ú__doc__Úcodecsr   Úrdflibr   Úrdflib.plugins.parsers.ntriplesr   r   r   r   Ú__all__r	   r4   r0   r!   ú<module>r:      sÆ   ððð ð2 Ð Ð Ð Ð Ð à #Ð #Ð #Ð #Ð #Ð #ð >Ð =Ð =Ð =Ð =Ð =Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4àÐ
€ð<Fð <Fð <Fð <Fð <FÐ$ñ <Fô <Fð <Fð <Fð <Fr0   