Kategorie: sones

It’s about time to import some data into our pre­vi­ously estab­lished object scheme. If you want to do this your­self you want to first run the Crunch­base mir­ror­ing tool and cre­ate your own mir­ror on your hard disk. 

In the next step another small tool needs to be writ­ten. A tool that cre­ates nice clean GQL import scripts for our data. Since every data source is dif­fer­ent there’s not really a way around this step – in the end you’ll need to extract data here and import data here. One pos­si­ble dif­fer­ent solu­tion could be to imple­ment a ded­i­cated importer for the GraphDB – but I’ll leave that for another arti­cle series. Back to our tool: It’s called “First-Import” and it’s only pur­pose is to cre­ate a first small graph out of the mir­rored Crunch­base data and fill the mainly prim­i­tive data attrib­utes. Down­load this tool here.

This is why in this first step we mainly focus on the fol­low­ing object types:

  • Com­pany
  • Finan­cialOr­ga­ni­za­tion
  • Per­son
  • Prod­uct
  • Ser­vi­ce­Provider

Addi­tion­ally all edges to a com­pany object and the com­pe­ti­tion will be imported in this part of the arti­cle series.

So what does the first-import tool do? Simple: 

  1. it dese­ri­al­izes the JSON data into a use­able object – in this case it’s writ­ten in C# and uses .NETs own JavaScript deserializer
  2. it then maps all attrib­utes of that dese­ri­al­ized JSON object to attribute names in our graph data object scheme and it does so by out­putting a sim­ple query
    1. Sim­ple Attribute Types like String and Inte­ger are just sim­ply assigned using the “=” oper­a­tor in the Graph Query Language
    2. 1:1 Ref­er­ences are assigned by assign­ing a REF(…) to the attribute – for exam­ple: INSERT INTO Prod­uct VALUES (Com­pany = REF(Permalink=’companyname’))
    3. 1:n Ref­er­ences are assigned by assign­ing a SETOF(…) to the attribute – because we are not using a bulk import inter­face but the stan­dard GQL REST Inter­face it’s nec­es­sary that the object(s) we’re going to ref­er­ence are already in exis­tence – there­fore we chose to do this 1:n link­ing step after cre­at­ing the objects itself in a sep­a­rate UPDATE step. Know­ing this the UPDATE looks like this: UPDATE Com­pany SET (ADD TO Com­pe­ti­tions SETOF(permalink=’…’,permalink=’…’)) WHERE Perma­link = ’companyname’

For the most part of the work it’s copy-n-paste to get the first-import tool together – it could have been done in a more sophis­ti­cated way (like using reflec­tion on the dese­ri­al­ized JSON objects) but that’s most prob­a­bly part of another article.

When run in the “crunch­base” direc­tory cre­ated by the Crunch­base Mir­ror­ing tool the first-import tool gen­er­ates GQL scripts – 6 of them to be precise:

crunchbase-first-import

gql-scripts-part-4

The last script is named “Step_3” because it’s sup­posed to come after all the others.

These scripts can be eas­ily imported after estab­lish­ing the object scheme. The thing is though – it won’t be that fast. Why is that? We’re cre­at­ing sev­eral thou­sand nodes and the edges between them. To cre­ate such an edge the Query Lan­guage needs to iden­tify the node the edge orig­i­nates and the node the edge should point to. To find these nodes the user is free to spec­ify match­ing cri­te­ria just like in a WHERE clause.

So if you do a UPDATE Com­pany SET (ADD TO Com­pe­ti­tions SETOF(Permalink=’company1’,Permalink=’company2’)) WHERE Perma­link = ’com­pa­ny­name’ the GraphDB needs to access the node iden­ti­fied by the Perma­link Attribute with the value “com­pa­ny­name” and the two nodes with the val­ues “company1” and “company2” to cre­ate the two edges. It will work just like all the scripts are but it won’t be as fast as it could be. What can help to speed up things are indices. Indices are used by the GraphDB to iden­tify and find spe­cific objects. These indices are used mainly in the eval­u­a­tion of a WHERE clause.

The sones GraphDB offers a num­ber of inte­grated indices, one of which is HASHTABLE which we are going to use in this exam­ple. Fur­ther­more every­one inter­ested can imple­ment it’s own index plu­gin – we will have a tuto­r­ial how to do that online in the future – if you’re inter­ested now just ask how we can help you to make it happen!

Back to the indices in our example:

The syn­tax of cre­at­ing an index is quite easy, the only thing you have to do is tell the CREATE INDEX query on which type and attribute the index should be cre­ated and of which index­type the index should be. Since we’re using the Perma­link attribute of the Crunch­base objects as an iden­ti­fier in the exam­ple (it could be any other attribute or group of attrib­utes that iden­tify one par­tic­u­lar object) we want to cre­ate indices on the Perma­link attribute for the full speed-up. This would look like this:

  • CREATE INDEX ON Com­pany (Perma­link) INDEXTYPE HashTable
  • CREATE INDEX ON Finan­cialOr­ga­ni­za­tion (Perma­link) INDEXTYPE HashTable
  • CREATE INDEX ON Per­son (Perma­link) INDEXTYPE HashTable
  • CREATE INDEX ON Ser­vi­ce­Provider (Perma­link) INDEXTYPE HashTable
  • CREATE INDEX ON Prod­uct (Perma­link) INDEXTYPE HashTable

Looks easy, is easy! To take advan­tage of course this index cre­ation should be done before cre­at­ing the first nodes and edges.

After we got that sorted the only thing that’s left is to run the scripts. This will, depend­ing on your machine, take a minute or two.

So after run­ning those scripts what hap­pened is: all Com­pany, Finan­cialOr­ga­ni­za­tion, Per­son, Ser­vi­ce­Provider and Prod­uct objects are cre­ated and filled with prim­i­tive data types

  1. all attrib­utes which are essen­tially ref­er­ences (1:1 or 1:n) to a Com­pany object are being set, these are
    1. Company.Competitions
    2. Product.Company

That’s it for this part – in the next part of the series we will dive deeper into con­nect­ing nodes with edges. There is a ton of things that can be done with the data – stay tuned for the next part.

Since we launched our 1.1 ver­sion yes­ter­day I want to link to the updated cheat sheet so every­one can find and use it:

gqlcheatsheet_1.1
Cheat­sheet v1.1

After the overview and the first use-case intro­duc­tion it’s about time to play with some data objects.

So how can one actu­ally access the data of crunch­base? Easy as pie: Crunch­base offers an easy to use inter­face to get all infor­ma­tion out of their data­base in a fairly struc­tured JSON for­mat. So what we did is to write a tool that actu­ally down­loads all the avail­able data to a local machine so we can play with it as we like in the fol­low­ing steps.

This small tool is called Mir­ror­Crunch­base and can be down­loaded in binary and source­code here. As for all source­code and tools in this series this runs on win­dows and linux (mono). You can use the source­code to get an impres­sion what’s going on there or just the included bina­ries (in bin/Debug) to mir­ror the data of Crunchbase.

To say a few words about what the Mir­ror­Crunch­base tool actu­ally does first a small source code excerpt:

codesnippet_1

So first it gets the list of all objects like the com­pany names and then it retrieves each com­pany object accord­ing to it’s name and stores every­thing in .js files. Easy eh?

When it’s run­ning you get an out­put sim­i­lar to that:

mirror_run_linux

And after the suc­cess­ful com­ple­tion you should end up with a direc­tory structure 

crunchbase_directory_structure

The .js files store basi­cally every infor­ma­tion accord­ing to the data scheme overview pic­ture of part 2.  So what we want to do now is to trans­form this overview into a GQL data scheme we can start to work with. A main con­cept of sones GraphDB is to allow the user to evolve a data scheme over time. That way the user does not have to have the final data scheme before the first cre­ate state­ment. Instead the user can start with a basic data scheme rep­re­sent­ing only stan­dard data types and add com­plex user defined types as migra­tion goes along. That’s a fun­da­men­tally dif­fer­ent approach from what data­base admin­is­tra­tors and users are used to today.

Todays user gen­er­ated data evolves and grows and it’s not pos­si­ble to fore­see in which way attrib­utes need to be added, removed, renamed. Maybe the scheme changes com­pletely. Every­time the neces­sity emerged to change any­thing on a estab­lished and pop­u­lated data scheme it was about time to start a com­plex and costly migra­tion process. To sub­stan­tially reduce or even in some cases elim­i­nate the need for such a com­plex process is a design goal of the sones GraphDB.

In the Crunch­base use-case this results in a fairly straight-forward process to estab­lish and fill the data scheme. First we cre­ate all types with their cor­rect name and add only those attrib­utes which can be filled from the start – like prim­i­tives or direct ref­er­ences. All Lists and Sets of Edges can be added later on.

So these would be the Create-Type State­ments to start with in this use-case:

  • CREATE TYPE Com­pany ATTRIBUTES ( String Alias_List, String BlogFee­dURL,    String BlogURL, String Cat­e­gory, Date­Time Created_At, String Crunch­baseURL, Date­Time Deadpooled_At, String Descrip­tion, String EMailAdress, Date­Time Founded_At, String Home­pageURL, Inte­ger Num­berO­fEm­ploy­ees, String Overview, String Perma­link, String Pho­neNum­ber, String Tags, String Twit­terUser­name, Date­Time Updated_At, Set<Com­pany> Competitions )
  • CREATE TYPE Finan­cialOr­ga­ni­za­tion ATTRIBUTES ( String Alias_List, String BlogFee­dURL, String BlogURL, Date­Time Created_At, String Crunch­baseURL, String Descrip­tion, String EMailAdress, Date­Time Founded_At, String Home­pageURL, String Name, Inte­ger Num­berO­fEm­ploy­ees, String Overview, String Perma­link, String Pho­neNum­ber, String Tags, String Twit­terUser­name, Date­Time Updated_At )
  • CREATE TYPE Prod­uct ATTRIBUTES ( String BlogFee­dURL, String BlogURL, Com­pany Com­pany, Date­Time Created_At, String Crunch­baseURL, Date­Time Deadpooled_At, String Home­pageURL, String Invite­ShareURL, Date­Time Launched_At, String Name, String Overview, String Perma­link, String Stage­Code, String Tags, String Twit­terUser­name, Date­Time Updated_At)
  • CREATE TYPE Exter­nalLink ATTRIBUTES ( String Exter­nalURL, String Title )
  • CREATE TYPE Embed­ded­Video ATTRIBUTES ( String Descrip­tion, String EmbedCode )
  • CREATE TYPE Image ATTRIBUTES ( String Attri­bu­tion, Inte­ger SizeX, Inte­ger SizeY, String ImageURL )
  • CREATE TYPE IPO ATTRIBUTES ( Date­Time Published_At, String StockSym­bol, Dou­ble Val­u­a­tion, String ValuationCurrency )
  • CREATE TYPE Acqui­si­tion ATTRIBUTES ( Date­Time Acquired_At, Com­pany Com­pany, Dou­ble Price, String Price­Cur­rency, String SourceDes­ti­na­tion, String SourceURL, String TermCode )
  • CREATE TYPE Office ATTRIBUTES ( String Address1, String Address2, String City, String Coun­tryCode, String Descrip­tion, Dou­ble Lat­i­tude, Dou­ble Lon­gi­tude, String State­Code, String ZipCode )
  • CREATE TYPE Mile­stone ATTRIBUTES ( String Descrip­tion, String SourceDescrip­tion, String SourceURL, Date­Time Stoned_At )
  • CREATE TYPE Fund ATTRIBUTES ( Date­Time Funded_At, String Name, Dou­ble RaisedAmount, String Raised­Cur­ren­cy­Code, String SourceDescrip­tion, String SourceURL )
  • CREATE TYPE Per­son ATTRIBUTES ( String Affil­i­a­tion­Name, String Alias_List, String Birth­place, String BlogFee­dURL, String BlogURL, Date­Time Birth­day, Date­Time Created_At, String Crunch­baseURL, String First­Name, String Home­pageURL, Image Image, String Last­Name, String Overview, String Perma­link, String Tags, String Twit­terUser­name, Date­Time Updated_At )
  • CREATE TYPE Degree ATTRIBUTES ( String DegreeType, Date­Time Graduated_At, String Insti­tu­tion, String Subject )
  • CREATE TYPE Rela­tion­ship ATTRIBUTES ( Boolean Is_Past, Per­son Per­son, String Title )
  • CREATE TYPE Ser­vi­ce­Provider ATTRIBUTES ( String Alias_List, Date­Time Created_At, String Crunch­baseURL, String EMailAdress, String Home­pageURL, Image Image, String Name, String Overview, String Perma­link, String Pho­neNum­ber, String Tags, Date­Time Updated_At )
  • CREATE TYPE Provider­ship ATTRIBUTES ( Boolean Is_Past, Ser­vi­ce­Provider Provider, String Title )
  • CREATE TYPE Invest­ment ATTRIBUTES ( Com­pany Com­pany, Finan­cialOr­ga­ni­za­tion Finan­cialOr­ga­ni­za­tion, Per­son Person )
  • CREATE TYPE Fund­in­gRound ATTRIBUTES ( Com­pany Com­pany, Date­Time Funded_At, Dou­ble RaisedAmount, String Raised­Cur­ren­cy­Code, String Round­Code, String SourceDescrip­tion, String SourceURL )

You can directly down­load the accord­ing GQL script here. If you use the sone­sEx­am­ple appli­ca­tion from our open source dis­tri­b­u­tion you can cre­ate a sub­folder “scripts” in the binary direc­tory and put the down­loaded script file there. When you’re using the inte­grated Web­Shell, which is by default launched on port 9975 an can be accessed by brows­ing to http://localhost:9975/WebShell you can exe­cute the script using the com­mand “execdb­script” fol­lowed by the file­name of the script.

As you can see it’s quite straight for­ward a copy-paste action from the graph­i­cal scheme. Even ref­er­ences are not rep­re­sented by a dif­fi­cult rela­tional helper, instead if you want to ref­er­ence a com­pany object you can just do that (we actu­ally did that – look for exam­ple at the last line of the gql script above). As a result when you exe­cute the above script you get all the Types nec­es­sary to fill data in in the next step. 

So that’s it for this part – in the next part of this series we will start the ini­tial data import using a small tool which reads the mir­rored data and out­puts gql insert queries.

Where to start: exist­ing data scheme and API

This series already tells in it’s name what the use case is: The “Crunch­Base”.  On their web­site they speak for them­selves to explain what it is: “Crunch­Base is the free data­base of tech­nol­ogy com­pa­nies, peo­ple, and investors that any­one can edit.”. There are many rea­sons why this was cho­sen as a use-case. One impor­tant rea­son is that all data behind the Crunch­Base ser­vice is licensed under Creative-Commons-Attribution (CC-BY) license. So it’s freely avail­able data of high-tech com­pa­nies, peo­ple and investors.

crunchbase_logo

Cur­rently there are more than 40.000 dif­fer­ent com­pa­nies, 51.000 dif­fer­ent peo­ple and 4.200 dif­fer­ent investors in the data­base. The flood of infor­ma­tion is big and the scale of con­nec­tiv­ity even big­ger. The graph rep­re­sented by the nodes could be even big­ger than that but because of the lim­it­ing fac­tors of cur­rent rela­tional data­base tech­nol­ogy it’s not fea­si­ble to try to do that. 

sones GraphDB is com­ing to the res­cue: because it’s opti­mized to han­dle huge datasets of strongly con­nected data. Since the Crunch­Base data could be uses as a start­ing point to drive con­nec­tiv­ity to even greater detail it’s a great use-case to show these migra­tion and handling.

Thank­fully the devel­op­ers at Crunch­Base already made one or two steps into an object ori­ented world by offer­ing an API which answers queries in JSON for­mat. By using this API every­one can access the com­plete data set in a very struc­tured way. That’s both good and bad. Because the used tech­nolo­gies don’t offer a way to rep­re­sent linked objects they had to use what we call “rela­tional helpers”. For exam­ple: A per­son founded a com­pany. (per­son and com­pany being a JSON object). There’s no stan­dard­ized way to model a rela­tion­ship between those two. So what the Crunch­Base devel­op­ers did is they added an unique-Identifier to each object. And they added a new object which is uses as a “rela­tional helper”-object. The only pur­pose of these helper objects is to point towards a unique-identifier of another object type. So in our exam­ple the rela­tion­ship attribute of the per­son object is not point­ing directly to a spe­cific com­pany or rela­tion­ship, but it’s point­ing to the helper object which stores the infor­ma­tion which unique-identifier of which object type is meant by that link.

To visu­al­ize this here’s the data scheme behind the Crunch­Base (+all cur­rently avail­able links):

CrunchbaseRelations

As you can see there are many more “rela­tional helper” dead-ends in the scheme. What an appli­ca­tion had to do up until now is to resolve these dead-ends by going the extra mile. So instead of retriev­ing a per­son and all rela­tion­ships, and with them all data that one would expect, the appli­ca­tion has to split the data into many queries to inter­nally build a struc­ture which essen­tially is a graph.

Another exam­ple would be the com­pany object. Like the name implies all data of a com­pany is stored there. It holds an attribute called invest­ments which isn’t a prim­i­tive data type (like a num­ber or text) but a user defined com­plex data type. This user defined data type is called List<FundingRoundStructure>. So it’s a sim­ple list of Fund­in­gRound­Struc­ture objects.

When we take a look at the Fund­in­gRound­Struc­ture there’s an attribute called com­pany which is made up by the user defined data type Com­pa­nyS­truc­ture. This Com­pa­nyS­truc­ture is one of these dead-ends because there’s just a name and a unique-id. The appli­ca­tion now needs retrieve the right com­pany object with this unique-id to access the com­pany information. 

Sim­ple things told in a sim­ple way: No mat­ter where you start, you always will end up in a dead-end which will force you to start over with the infor­ma­tion you found in that dead-end. It’s not user-friendly nor easy to implement. 

The good news is that there is a way to han­dle this type of data and links between data in a very easy way. The sones GraphDB pro­vides a rich set of fea­tures to make the life of devel­op­ers and users eas­ier. In that con­text: If we would like to know which com­pa­nies also received fund­ing from the same investor like let’s say the com­pany “face­book” the only thing nec­es­sary would be one short query. Beside that those “rela­tional helpers” are redun­dant infor­ma­tion. That means in a graph data­base this infor­ma­tion would be stored in the form of edges but not in any helper objects. 

The rea­son why the devel­op­ers of Crunch­Base had to use these helpers is that JSON and the rela­tional table behind it isn’t able to directly store this infor­ma­tion or to query it directly. To learn more about those rela­tional tables and data­bases try this link.

I want to end this part of the series with a pic­ture of the above rela­tional dia­gram (with­out the arrows and connections). 

Crunchbase

The next part of the series will show how we can access the avail­able infor­ma­tion and how a graph scheme starts to evolve.

If you want to explain how easy it is for a user or devel­oper to use the sones GraphDB to work on exist­ing datasets you do that by show­ing him an exam­ple – a use case. And this is exactly what this short series of arti­cles will do: It’ll show the impor­tant steps and con­cepts, tech­nolo­gies and designs behind the use case and the sones GraphDB.

The sones GraphDB is a DBMS focus­ing on strong con­nected unstruc­tured and semi-structured data. As the name implies these data sets are orga­nized in Nodes and Edges objec­to­ri­ented in a graph data structure.

graph

“a sim­ple graph”

To han­dle these com­plex graph data struc­tures the user is given a pow­er­ful toolset: the graph query lan­guage. It’s a lot like SQL when it comes to com­pre­hen­si­bil­ity – but when it comes to func­tion­al­ity it’s com­pletely designed to help the user do pre­vi­ously tricky or impos­si­ble things with one easy query.

This arti­cles series is going to show how real conventional-relational data is aggre­gated and ported to an easy to under­stand and more flex­i­ble graph datas­truc­ture using the sones GraphDB. And because this is not only about telling but also about doing we will release all nec­es­sary tools and source codes along with this arti­cle. That means: This is a work­shop and a use case in one awe­some arti­cle series. 

The require­ments to fol­low all steps of this series are: You want to have a work­ing sone GraphDB. Because we just released the Open­Source Edi­tion Ver­sion 1.1 you should be fine fol­low­ing the doc­u­men­ta­tion on how to down­load and install it here. Beside that you won’t need pro­gram­ming skills but if you got them you can dive deep into every aspect. Be our guest!

This first arti­cle is titled “Overview” and that’s what you’ll get:

part 1: Overview

part 2: A short intro­duc­tion into the use-case and it’s rela­tional data

part 3: Which data and how does a GQL data scheme start?

part 4: The ini­tial data import

part 5:  Link­ing nodes and edges: What’s con­nected with what and how does the scheme evolve?

part 6: Query­ing the data and how to access it from applications?

24. March 2010
CeBit 2010 Reloaded
Cat: GraphDB demo  Tags:

Because of the high inter­est on our CeBit 2010 demo, here some pic­tures, videos and back­ground information:

Together with UID – a com­pany spe­cial­ized on user inter­face design – we cre­ated a graph data­base demo for the Microsoft Sur­face table. The demo showed the Ger­man Cor­pus based on one mil­lion sen­tences, 812K words and 118K sources and is described in detail here. For the visu­al­iza­tion we used our Visu­al­Graph Tool described here. Each day dur­ing the CeBit we pre­sented it at MSDN Devel­oper Kino.

IMG_0321

Surface_Finger

More Back­ground infor­ma­tion avail­able here, here and here

Alex Popescu, author of the well-known MyNoSQL blog recently wrote about a very (very) basic tag­ging app and its imple­men­ta­tion within the Info­Grid and Neo4j graph data­base systems.

Today we want to pick up the given exam­ple and show you an imple­men­ta­tion using the sones GraphDB and the GraphDB­Sharp API:


using System;
using System.Linq;
using System.Collections.Generic;

using sones.GraphDB;
using sones.GraphDB.Structures;
using sones.GraphDB.API.CSharp;
using sones.GraphDB.API.CSharp.Reflection;
using sones.GraphDB.Connectors.GraphDBREST;
using sones.GraphFS.Connectors.GraphFSCLI;
using sones.GraphDB.Connectors.GraphDBCLI;

namespace TagExample
{

    public class Tag : DBObject {

        // Will inherit an UUID and RevisionID property from DBObject

        [CreateIndex(DBIndexTypes.HashTable)]
        public String Name { get; set; }

        // Backwardedges to the attribute Tags of type Websites
        [BackwardEdge("Tags")]
        public List<Website> TaggedWebsites { get; set; }

        public Tag() { }

    }

    public class Website : DBObject
    {

        // Will inherit an UUID and RevisionID property from DBObject

        [CreateIndex(DBIndexTypes.HashTable)]
        public String Name { get; set; }

        public String URL  { get; set; }

        // Edges to the tags
        public List<Tag> Tags { get; set; }

        public Website() { }

    }

    public class TagExample
    {

        private void CheckResult(QueryResult myQueryResult)
        {
            Console.WriteLine("{0} => {1}",
                myQueryResult.Query,
                myQueryResult.ResultType);
        }

        private void Run()
        {

            // Create a new in-memory database
            var GDB = new GraphDBSharp()
            {
                DatabaseName        = "TagExampleDB",
                Username            = "Dr.Falken",
                Password            = "Joshua"
                // For persistence use:
                //StorageLocation   = "file://TagExampleDB.fs",
                //StorageLocation   = "net.tcp://127.0.0.1:8000",
            };

            GDB.CreateDatabase(true);

            // Create types tag and website using reflection
            GDB.CreateTypes(CheckResult, new Tag(), new Website());

            // Insert tags
            var _good  = new Tag() { Name = "good"  };
            var _funny = new Tag() { Name = "funny" };
            GDB.Insert(CheckResult, _good, _funny);

            // Insert websites and link them to their tags
            var _cnn   = new Website() {
                            Name = "CNN",
                            URL  = "http://cnn.com/",
                            Tags = new List<Tag>() { _good }
                         };

            var _xkcd  = new Website() {
                            Name = "xkcd",
                            URL  = "http://xkcd.com/",
                            Tags = new List<Tag>() { _good, _funny }
                         };

            var _onion = new Website() {
                            Name = "onion",
                            URL  = "http://theonion.com/",
                            Tags = new List<Tag>() { _funny }
                         };

            GDB.Insert(CheckResult, _cnn, _xkcd, _onion);

            // Find out which tags xkcd is tagged with
            var _xkcdtags = GDB.Query("FROM Website w SELECT w.Tags " +
                                      "WHERE w.Name = 'xkcd' DEPTH 1");
            foreach (var _tag in (List<DBObjectReadout>) _xkcdtags["Tags"])
                Console.WriteLine(_tag["Name"]);

            // List tagged sites
            var _taggedsites = GDB.Query("FROM Website w SELECT w.Name, " +
                                         "Count(w.Tags) AS Counter " +
                                         "WHERE Count(w.Tags)>0");
            foreach (var _sites in (List<DBObjectReadout>) _taggedsites[0])
                Console.WriteLine("{0} => {1}", _sites["Name"], _sites["Counter"]);

            // Start a REST service on localhost port 9975
            GDB.StartREST(new Uri("http://localhost:9975"));

            // Start the GraphDB command line interface
            GDB.OpenCLI(typeof(ABasicFSCLICommands),
                        typeof(AAdvancedFSCLICommands),
                        typeof(ABasicDBCLICommands),
                        typeof(AAdvancedDBCLICommands));

            GDB.Shutdown();

        }

        public static void Main(string[] myArgs)
        {
            var w = new TagExample();
            w.Run();
        }

    }

}

 

The cur­rent C# API is already very expres­sive, but other pro­gram­ming lan­guages might be much more ver­bose. To avoid writ­ing a lot of code, you can always use our Graph Query Lan­u­age (GQL) which is an opti­mized Domain-specific lan­guage (DSL) for cre­at­ing and manip­u­lat­ing a graph within our database.


  CREATE TYPES
    Tag EXTENDS DBObject
        ATTRIBUTES (String Name)
        BACKWARDEDGES (Website.Tags TaggedWebsites)
        INDICES (Name),
    Website EXTENDS DBObject
        ATTRIBUTES (String Name, String URL, LIST<Tag> Tags)
        INDICES (Name)

  INSERT INTO Tag VALUES (Name = 'good')
  INSERT INTO Tag VALUES (Name = 'funny')

  INSERT INTO Website VALUES
    (Name = 'CNN',
     URL  = 'http://cnn.com/',
     Tags = SETOF (Name = 'good'))

  INSERT INTO Website VALUES
    (Name = 'xkcd',
     URL  = 'http://xkcd.com/',
     Tags = SETOF (Name = 'good', Name = 'funny'))

  INSERT INTO Website VALUES
    (Name = 'onion',
     URL  = 'http://theonion.com/',
     Tags = SETOF (Name = 'funny'))

  // Find out which tags xkcd is tagged with...
  FROM Website w SELECT w.Tags WHERE w.Name = 'xkcd' DEPTH 1
  // Alternative query...
  FROM Tag     t SELECT t.Name WHERE t.TaggedWebsites.Name = 'xkcd'

  // List tagged sites...
  FROM Website w SELECT w.Name, Count(w.Tags) AS Counter WHERE Count(w.Tags)>0
 

 

You know that with the sones GraphDB you can achieve amaz­ing things by con­nect­ing objects through edges. A graph data struc­ture is based upon this idea and hav­ing the abil­ity to add weight to these edges gives you the abil­ity to cre­ate weighted graphs.

“A graph is a weighted graph if a num­ber (weight) is assigned to each edge. Such weights might rep­re­sent, for exam­ple, costs, lengths or capac­i­ties, etc. depend­ing on the prob­lem.” (Wikipedia)

There’s an exam­ple of a sim­ple weighted graph in the exam­ple sec­tion of this web­site. Have a look at it!

sonesdev

25. January 2010
sones GraphDB Visualization Tool
Cat: Announcement GraphDB  Tags:

We want to show you some­thing today: Not every­body has an idea what to think and do with a graph data struc­ture. Not even talk­ing about a whole graph data­base man­age­ment sys­tem. In fact what every­body needs is some­thing to get “in touch” with those kinds of data representations. 

To make the graphs you are cre­at­ing with the sones GraphDB that much more touch­able we give you a sneak peak at our newest addi­tion of the sone GraphDB toolset: the Visu­al­Graph tool.

This tool con­nects to a run­ning data­base and allows you to run queries on that data­base. The result of those queries is then pre­sented to you in a much more nat­ural and intu­itive way, com­pared to the usual JSON and XML out­puts. Even more: you can play with your queries and your data and see and feel what it’s like to work with a graph.

Expect this tool to be released in the next 1–2 months as open source. Every­one can use it, Every­one can ben­e­fit from it.

Oh. Almost for­got the video:

(Watch it in full screen if you can) 

As of now you can down­load a Quick Ref­er­ence doc­u­ment – or Cheat­sheet as we call it – from this web­site. It’s a com­piled and shorted ver­sion and you can get the long ver­sion here.

cheatsheet 

Down­load here.