Logic Graph Language

Logic Graph Language

After examining everything available for game developers from the world of predicate logic and graph theory, I was disappointed to see so little interest on the subject; mainly from the games industry. I’m rolling my own minimalistic graph data format and query language, with bits of logic. If all goes well this will be in our next big game.

Format is mainly inspired on haskell, but taking advantage of the concept that every expression is a relationship or entity definition or query. The final test should be that the language can describe itself.

=======================
Logic Statements
=======================

+ dog type_of animal
+ cat type_of animal

+ doggy is_a dog
+ doggy . color brown
+ doggy . name 'Doggy San'
? ( * is_a dog ) . color gray

+ kitty is_a cat
+ kitty . age 2
+ kitty . lives 3.2
+ kitty . per_capita 3
+ kitty . nick Kitty Puss

+ ben is_a human
+ ben owns doggy
+ ben owns doggy . since 4.3
+ ben owns kitty . from orphanage

- snow_lion
- dog
- doggy is_a dog

=======================
Logic Queries
=======================

? kitty is_a dog
false

? kitty . age (> 1)
true

? ben * animal . since (> 2)

? ben . *

? ben owns type_of animal . since (> 2)

? ben owns doggy . *

? * type_of animal
dog
cat

? ben owns *
doggy
kitty

? ben * doggy
owns

? * owns doggy
ben

? ben * *
is human
owns doggy

=======================
In C# Linq IEnumerable
=======================

foreach ( var owned in LGL.Query( "ben owns *") ) {
Debug.Log( owned );
}