Skip to content

Optimize performance for SPARQL backend #4

Description

@LesterLyu

Owlready2 sends queries as soon as something is modified:

organization = cids.Organization()  # This sends a query
organization.hasName = 'some name'   # This sends a query
organizatiion.address = ...    # This sends a query

This could slow down performance when using SPARQL backend.

Proposed optimizations

Option 1

  • Combine consecutive INSERT DATA queries into one.
    • Debounce the insertions, i.e. 5ms, or send the query as soon as other types of queries are requested.
    • Involves multi-threading. A separate thread to schedule the query.

Option 2

  • Change the logic of when queries are sent. (Can be turned off)
    • Introduce a save() method for individuals:
    default_world.set_autosave(false)  # Turn off real time modification
    organization = cids.Organization()
    organization.hasName = 'some name'
    organizatiion.address = ...  
    organizatiion.save()   # This sends some optimized queries.

Option 3

  • Implement Option1 and Option 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions