Skip to main content

SPARQL-parse

SPARQL-parse helps you get attribute/component of a SPARQL query or query it easily.

#Initial a SPARQL object 
sparql_query='SELECT DISTINCT ?uri WHERE { ?x <http://dbpedia.org/property/international> <http://dbpedia.org/resource/Muslim_Brotherhood> . ?x <http://dbpedia.org/ontology/religion> ?uri  . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/PoliticalParty>}'
a=SPARQL(sparql_query)
#Get the "former part" of a SPARQL(former part means the string before "WHERE" in SPARQL)
a.former
Out[1]: 'SELECT DISTINCT ?uri'
#Get the "where part" of a SPARQL(where part means the part which store triple)
a.where
Out[2]: 'WHERE {?x <http://dbpedia.org/property/international> <http://dbpedia.org/resource/Muslim_Brotherhood> . ?x <http://dbpedia.org/ontology/religion> ?uri . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/PoliticalParty>}'
#Get a abbreviation version of SPARQL(e.g. <http://dbpedia.org/property/international> -> dbp:international)
a.abbr_sparql
Out[3]: 'SELECT DISTINCT ?uri WHERE {?x dbp:international dbr:Muslim_Brotherhood . ?x dbo:religion ?uri . ?x rdf:type dbo:PoliticalParty}'
#Get all link in a SPARQL
a.link
Out[4]: 
['<http://dbpedia.org/property/international>',
 '<http://dbpedia.org/resource/Muslim_Brotherhood>',
 '<http://dbpedia.org/ontology/religion>',
 '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>',
 '<http://dbpedia.org/ontology/PoliticalParty>',
 'rdf:type']
#Generalize SPARQL to get a template
a.template
Out[5]: 'SELECT DISTINCT ?uri WHERE {?x <E/R> <E/R> . ?x <E/R> ?uri . ?x <E/R> <E/R>}'
#Get query type(ASK,COUNT,SELECT)
a.intent
Out[6]: 'SELECT'
#Get triple number in "WHERE PART"
a.triple_num
Out[7]: 3
#Where is the variable we ask(aka the variable that represented answer)
a.firstVar
Out[8]: '?uri'
#All variable appear in SPARQL
a.all_var
Out[9]: ['?uri', '?x']
#Query this SPARQL(automatically get you ip_address, to use this feature please first deploy a Virtuoso local endpoint on you PC)
a.query()
Out[10]: 
['http://dbpedia.org/resource/Sunni_Islam',
 'http://dbpedia.org/resource/Islam']

Metadata

Release files for SPARQL-parser 0.0.2

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

Source distribution (sdist)

Source distribution for SPARQL-parser 0.0.2
File Size Uploaded
SPARQL-parser-0.0.2.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SPARQL-parser 0.0.2
File Interpreter ABI Platform
SPARQL_parser-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / SPARQL-parser-0.0.2.tar.gz

Download URL SPARQL-parser-0.0.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b0110d40cddab497380f489e2d2023c5431447778654add339850224126d8100
BLAKE2b-256 checksum
How to use checksums
9be045fc385ccb7dd70270c3b79c741587b1f688800c682b24d476e2560c05c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.6

Release files / SPARQL_parser-0.0.2-py3-none-any.whl

Download URL SPARQL_parser-0.0.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c97e80e12f192c802ea6b39ea199090731a98279a4670f688b64eb7ab93519d3
BLAKE2b-256 checksum
How to use checksums
caaf0adf621b8c43898d701ab6835171cbec5242012d8dad8dec92f33e0e4ce8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.2 This release

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