title: Graph-structured databases and Php
body: <p>I want to use a graph database using php. Can you point out some resources on where to get started? Is there any example code / tutorial out there? Or are there any other methods of storing data that relate to each other in totally random/abstract situations? </p>
  
  <p>-</p>
  
  <p>Very abstract example of the relations needed: John relates to Mary, both relate to School, John is Tall, Mary is Short, John has Blue Eyes, Mary has Green Eyes, query I want is which people are related to 'Short people that have Green Eyes and go to School' -> answer John</p>
  
  <p>-</p>
  
  <p>Another example: </p>
  
  <pre><code>    TrackA -&gt; ArtistA
             -&gt; ArtistB
  
             -&gt; AlbumA -----&gt; [ label ]
             -&gt; AlbumB -----&gt; [   A   ]
  
             -&gt; TrackA:Remix
             -&gt; Genre:House
  
             -&gt; [ Album ] -----&gt; [ label ]
     TrackB  -&gt; [   C   ]        [   B   ]
  </code></pre>
  
  <p>Example queries: </p>
  
  <p>Which Genre is TrackB closer to? answer: House - because it's related to Album C, which is related to TrackA and is related to Genre:House</p>
  
  <p>Get all Genre:House related albums of Label A : result: AlbumA, AlbumB - because they both have TrackA which is related to Genre:House</p>
  
  <p>-</p>
  
  <p>It is possible in MySQL but it would require a fixed set of attributes/columns for each item and a complex non-flexible query, instead I need every attribute to be an item by itself and instead of 'belonging' to something, to be 'related' to something.</p>