Skip to main content

SARI Sparql Parser

A parser for SPARQL queries and updates.

Note: This parser is very experimental and may not function very reliably.

Installation

install using pip

pip install sari-sparql-parser

Usage

Parse a SPARQL query:

from sariSparqlParser import parser

query = """PREFIX crm: <http://www.cidoc-crm.org/cidoc/crm>
    SELECT ?subject ?identifier WHERE {
        ?subject crm:P1_is_identified_by ?identifier .
        ?identifier a ?type .
        VALUES (?type) {
            (crm:E41_Appellation)
            (crm:E42_Identifier)
        }
    }
"""
p = parser()
p.parseQuery(query)

This will output:

{
    'prefixes': {'crm': 'http://www.cidoc-crm.org/cidoc/crm'},
    'select': ['subject', 'identifier'],
    'where': [{
        's': {'type': rdflib.term.Variable, 'value': 'subject'},
        'p': {'type': rdflib.term.URIRef, 'value': 'http://www.cidoc-crm.org/cidoc/crmP1_is_identified_by'},
        'o': {'type': rdflib.term.Variable, 'value': 'identifier'}
    },
    {
        's': {'type': rdflib.term.Variable, 'value': 'identifier'},
        'p': {'type': rdflib.term.URIRef, 'value': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'},
        'o': {'type': rdflib.term.Variable, 'value': 'type'}
    }],
    'values': [{
        'type': {'type': rdflib.term.URIRef, 'value': 'http://www.cidoc-crm.org/cidoc/crmE41_Appellation'}
    },
    {
        'type': {'type': rdflib.term.URIRef,'value': 'http://www.cidoc-crm.org/cidoc/crmE42_Identifier'}
    }]
}

Release files for sari-sparql-parser 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sari-sparql-parser 0.0.6
File Size Uploaded
sari-sparql-parser-0.0.6.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sari-sparql-parser 0.0.6
File Interpreter ABI Platform
sari_sparql_parser-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / sari-sparql-parser-0.0.6.tar.gz

Download URL sari-sparql-parser-0.0.6.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
220a39b63f9dbbb68a039cff6303237385d311744802c4fd2ab9c1c46eda3332
BLAKE2b-256 checksum
How to use checksums
823d1e06f3459032185681ab0193e4432c15786e3ba7575ae95d0819dbaf72e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Release files / sari_sparql_parser-0.0.6-py3-none-any.whl

Download URL sari_sparql_parser-0.0.6-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be5018136fd809d848adef2e6b341fb53956f83e3e5ed549520ed895d879f4dd
BLAKE2b-256 checksum
How to use checksums
c5a5d9512ef728c38e1c180666bbda744d8e0f0dfe5ffc575b562057f65b33ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page