Skip to content

Dataset.__len__() not returning expected count #3315

@edmondchuc

Description

@edmondchuc

I would have expected the following to return a size of 4 for the dataset, but it returns 3.

def test_mem_size():
    data = f"""
            <http://example.com/s> <{RDF.type}> <{SKOS.Concept}> <urn:graph:a> .
            <http://example.com/s> <{SKOS.prefLabel}> "Label" <urn:graph:a> .
            <http://example.com/s> <{SKOS.prefLabel}> "Label" <urn:graph:b> .
            <http://example.com/s> <{SKOS.definition}> "Definition" .
        """
    ds = Dataset()
    ds.parse(data=data, format="nquads")
    assert len(ds) == 4

Not confirmed yet but the dataset appears to be calculating the total number of triples instead of quads. When I remove one of the two skos:prefLabel statements, the count is still 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions