Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node attribute bracket syntax #112

Merged
merged 8 commits into from Apr 13, 2022
Merged

Conversation

j6k4m8
Copy link
Member

@j6k4m8 j6k4m8 commented Apr 13, 2022

Adds support for "bracket" syntax for node attributes. An attribute like XYZ(ABC) or ABC DEF used to be disallowed because of illegal characters in the attribute name, particularly when using the "dot-attribute" notation:

# broken:
A -> B
A.ABC DEF > 10

The new syntax uses bracket-attribute notation to "escape" these names:

# working:
import dotmotif
from dotmotif.executors.NeuPrintExecutor import NeuPrintExecutor

HOSTNAME = "neuprint.janelia.org"
DATASET = "hemibrain:v1.2.1"
TOKEN = "[YOUR TOKEN HERE]"

motif = dotmotif.Motif("""
A -> B
A['AVLP(R)'] = True
""")

E = NeuPrintExecutor(HOSTNAME, DATASET, TOKEN)

E.find(motif, limit=2)

Fixes #111.

@j6k4m8 j6k4m8 self-assigned this Apr 13, 2022
@j6k4m8 j6k4m8 added parser cypher Neo4jExecutor Issues having to do with the Neo4jExecutor NeuPrintExecutor labels Apr 13, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #112 (0ec9954) into master (6f30f24) will decrease coverage by 0.11%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   88.44%   88.32%   -0.12%     
==========================================
  Files          25       25              
  Lines        1843     1868      +25     
==========================================
+ Hits         1630     1650      +20     
- Misses        213      218       +5     
Impacted Files Coverage Δ
dotmotif/executors/test_dm_cypher.py 100.00% <ø> (ø)
setup.py 0.00% <0.00%> (ø)
dotmotif/executors/Neo4jExecutor.py 68.51% <58.33%> (-0.82%) ⬇️
dotmotif/__init__.py 95.34% <100.00%> (ø)
dotmotif/parsers/v2/test_v2_parser.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f30f24...0ec9954. Read the comment docs.

@j6k4m8 j6k4m8 merged commit ec6f653 into master Apr 13, 2022
@j6k4m8 j6k4m8 deleted the add-node-attribute-bracket-syntax branch April 13, 2022 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cypher Neo4jExecutor Issues having to do with the Neo4jExecutor NeuPrintExecutor parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering By Properties w/ Invalid Characters in the Name
2 participants