thepeergroup / aspen

Aspen is a markup language for turning text into graph data (via Cypher for Neo4j).
https://aspen-lang.org
MIT License
62 stars 7 forks source link

Feature request: Predicate lists #23

Open cristianvasquez opened 3 years ago

cristianvasquez commented 3 years ago

Hello,

Great work with Aspen, thank you very much!. I will start experimenting with it :)

I have a suggestion, which is to borrow the 'predicate lists' feature from the turtle syntax (https://www.w3.org/TR/turtle/#sec-intro)

This allows to not repeat the starting nodes each time, by using the ';' character

So if you have


default Person, name
default_attribute Employer, company_name
reciprocal knows, is friends with

# Write out the narrative data
(Matt) [is friends with] (Brianna).
(Eliza) [knows] (Brianna).
(Matt) [is friends with] (Eliza).

(Matt) [works for] (Employer, UMass Boston).

This can be prettified to:


default Person, name
default_attribute Employer, company_name
reciprocal knows, is friends with

# Write out the narrative data
(Matt)  [is friends with] (Brianna) ;
    [is friends with] (Eliza) ;
    [works for] (Employer, UMass Boston) .

(Eliza) [knows] (Brianna).
beechnut commented 3 years ago

This is a great idea, @cristianvasquez! Definitely open to a PR, since I'm not sure when I'd be able to get to this.

To be in line with Aspen's goal of having natural-ish syntax, I'd like to see both commas and semicolons allowed as predicate list separators, and allowing a final bare "and", so people could write:

(Liz) [knows] (Jack), [supervises] (Jenna), and [supervises] (Tracy).

Perhaps this is scope creep, but maybe this would be a good foundation for predicate lists with inner lists! Like English grammar, commas would separate inner lists, and semicolons would separate predicate lists.

(Liz) [knows] (Jack); [supervises] (Jenna), (Tracy), and (Frank); and [works with] (Pete).