
    4Ysh                     8    d dl Z d dlmZmZmZ d dlmZmZ ddZy)    N)URIRefGraphLiteral)VOIDRDFc                    t        j                  t              }t        j                  t              }| j                  t        j
                        D ]-  \  }}||   j                  |       ||   j                  |       / d}t               }	t               }
t               }t        j                  t              }t        j                  t              }t        j                  t              }t        j                  t              }t        j                  t              }t        j                  t              }| D ]  \  }}}|dz  }|	j                  |       |j                  |       |
j                  |       ||v rB||   D ]:  }||xx   dz  cc<   |s||   j                  |       ||   j                  |       < ||xx   dz  cc<   |s||   j                  |       ||   j                  |        |st        d      }|s
t               }|j                  |t        j
                  t        j                  f       |j                  |t        j                  t        |      f       |j                  |t        j                  t        t        |            f       |j                  |t        j                   t        t        |
            f       |j                  |t        j"                  t        t        |	            f       |j                  |t        j$                  t        t        |            f       t'        |      D ]  \  }}t        |d|z  z         }|j                  |t        j(                  |f       |j                  |t        j
                  t        j                  f       |j                  |t        j                  t        ||         f       |j                  |t        j                  t        d      f       |j                  |t        d   |f       |j                  |t        j*                  t        t        ||               f       |j                  |t        j"                  t        t        ||               f       |sP|j                  |t        j$                  t        t        ||               f       |j                  |t        j                   t        t        ||               f        t'        |      D ]  \  }}t        |d|z  z         }|j                  |t        j,                  |f       |j                  |t        j
                  t        j                  f       |j                  |t        j                  t        ||         f       |j                  |t        j$                  t        d      f       |j                  |t        j.                  |f       |sd}t               }||   D ]&  }||v r|dz  }||   D ]  }|j                  |        ( |j                  |t        j*                  t        |      f       |j                  |t        j                  t        t        |            f       |j                  |t        j"                  t        t        ||               f       |j                  |t        j                   t        t        ||               f        ||fS )am  
    Returns a new graph with a VoID description of the passed dataset

    For more info on Vocabulary of Interlinked Datasets (VoID), see:
    http://vocab.deri.ie/void

    This only makes two passes through the triples (once to detect the types
    of things)

    The tradeoff is that lots of temporary structures are built up in memory
    meaning lots of memory may be consumed :)
    I imagine at least a few copies of your original graph.

    the distinctForPartitions parameter controls whether
    distinctSubjects/objects are tracked for each class/propertyPartition
    this requires more memory again

    r      zhttp://example.org/Datasetz_class%dclassz_property%d)collectionsdefaultdictsetsubject_objectsr   typeaddintr   r   r   Datasettriplesr   classeslendistinctObjectsdistinctSubjects
properties	enumerateclassPartitionentitiespropertyPartitionproperty)gdatasetresdistinctForPartitionstypeMapr   ecr   subjectsobjectsr   
classCount	propCount
classPropsclassObjectspropSubjectspropObjectsspoipartr   propClassess                            k/var/www/sten-cake5-migrate2.hellocrow.space/lexinfo-master/env/lib/python3.12/site-packages/rdflib/void.pygenerateVoIDr4      sm   ( %%c*G%%c*G!!#((+ 1
q
q GuHeGJ((-J'',I((-J**3/L**3/L))#.K #1a1QqA <QZ )1"( O''*qM%%a(	) 	! Nq!O"'#* 56gGGWchh-. GGWdllGG$456GGWdllGCL$9:;GGWd**GCL,ABCGGWd++WS]-CDEGGWdoows:'?@A'" Q1g
Q./$--t45sxx./t||WZ]%;<=t||WQZ01tG}a()t}}gc'!*o&>?@t,,gc'!*o.FGH GGT4??GC
14F,GHIGGT4//\!_9M1NOPQ" *% P1g 112$00$78sxx./t||WYq\%:;<t
34t}}a() H%K!!_ '<MH  'AOOA&'' GGT4=='(*;<=GGT4<<[1A)BCDGGT400'#l1o:N2OPQGGT4//[^9L1MNO1P4 <    )NNT)	r   rdflibr   r   r   rdflib.namespacer   r   r4    r5   r3   <module>r9      s     ) ) &vr5   