Object query language for dictionary-like data
Project description
object-ql
An Object Query Language, for the Gramps Project and other objects.
This project is designed to be a drop-in replacement for https://github.com/DavidMStraub/gramps-ql
Rather than having to build, and learn, a new query language, the idea is to build on top of Python, the native language of the Gramps Project. And, rather than having to convert the Gramps raw data into objects, then dicts, and then back again to objects (when needed), this query system can operate directly on the objects.
Each object can be identified by its lower-case class type, eg person
, note
, family
, etc.
Examples:
Find the person with a particular gramps_id:
person.gramps_id == 'person001'
Find all of the people with notes:
person.get_note_list()
Find all of the people with notes that mention 'vote':
any([('vote' in str(get_note(handle).text)) for handle in person.get_note_list()])
Usage
If you don't know what the type is, you can use obj
, like:
"23" in obj.gramps_id
You can use standard dot notation to reference any object. Refer to Gramps Primary Objects for the structure of Gramps objects.
You can also use the SimpleAccess
methods that make access to some data much easier. The SimpleAccess is available as sa
, as shown below.
Select all of the people that have are married to a person named "Donna":
sa.first_name(sa.spouse(person)) == "Donna"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file object_ql-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: object_ql-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9f2b428a2025b440ad22025180cf5016a501459e04aaf8383e4edaf4fee26a3 |
|
MD5 | b4d2a5bb9c0ae75eebdbebe878fad0e0 |
|
BLAKE2b-256 | 06eda7ec979c570b4830e17c80c437efd3624f10ee403d94fbfd19c4fad79e9a |