Titan: Know if a new vertex or edge was created - titan

Does titan provide RDBMS trigger kind of thing that will be triggered whenever a new vertex or edge is added to the graph?
How will I know that a new vertex or edge was added to the graph?

Titan does not have a way to deal with that natively. You could, however, use EventGraph which is a graph wrapper over blueprints:
https://github.com/tinkerpop/blueprints/wiki/Event-Implementation
EvenGraph will pop off events to a listener that you write to gather the events.
EDIT: The above answer applies to TinkerPop 2.x and Titan 0.5.x and earlier. In Titan 1.x and TinkerPop 3.x one would rely on EventStrategy or Titan's Transaction Log.

Related

How to add the custom data to Mapbox in Unity?

I want to add the custom data to the Mapbox in Unity.
Unity version: 2020.3.36f1
Scripting Runtime Version: vsCode
Api Compatibility Level: NET4.0
Mapbox SDK version: 2.0.0
The platform I am building to: Android, IOS.
I want to change the colors of the buildings according to the some states of custom data in Mapbox.
However, the custom data is the response from my Api server(NodeJs).
The flow is as like below;
When the scene starts, I send the ids of buildings(Gameobject names in Unity scene) as request parameter to the api server.
The server sends the data of the buildings to Unity.
So, I display the colors of the buildings according to this data in scene.
But, the problem is how to know when the all buildings of the scene are loaded.
Once all buildings are loaded, I can get all names of the buildings.
I used OnUpdated event, but I can't get the names.
I had a similar issue trying to access the terrain elevation data on OnUpdated, but it seems that it is not necessarily available at the time when OnUpdated is dispatched. You would think that when OnUpdated is dispatched, all processes related to the map updating are done, but, apparently, that is not the case.
I solved it in somewhat hacky way by using the OnTileFinished event, which will be dispatched for each loaded tile whenever it is done with it's processing. At least it seems that I can rely on the terrain data (for the given tile) being loaded at that time, so I would guess that the building data (for the given tile) would also be loaded.
It would be nice with some built in event when all tiles are finished, but I haven't been able to find such an event. I initially assumed that the OnUpdated would be such an event - the name sort of suggests it - but it doesn't seem to be so. Maybe it is a bug in the MapBox code - I don't know.
Unfortunately, it seems a bit like MapBox has stopped developing and maintaining the Unity SDK, the latest commit is from February 2020, but maybe they will get back to it at some point.

Entity framework - persisting a graph of POCO entities

In my app I need to retrieve a large graph of entities, make various changes while detached (add entities, make changes, delete entities), then persist the graph back to the database. I've tried STEs but it's starting to over-complicate some aspects of my client tier, so I was hoping to keep things simple (at least on the client side) by using POCOs instead.
When it comes to persisting the changes, I was thinking I could retrieve the graph from the database again, and walk both this graph and the graph from the client tier, looking for differences:-
A deletion is actioned where an entity exists in the database graph but not the client graph. Presumably I can just .Remove() these from the database graph.
New entities are those in the client graph with an ID of 0. Presumably I can just .Add() these to the database graph.
I'm not sure the best way to deal with updates. I don't want to implement an "IsDirty" flag on my entities, and would prefer a more automatic solution. So a) is there a way to compare an entity in the client graph with its database counterpart to see if it has changed, and b) what's the best way of applying/merging the client entity into its database counterpart?
Once all this is done I presumably just call SaveChanges() on the database graph. I would also have to pass this graph back to the client, to ensure it has the latest version (database-generated values such as IDs, timestamps).
Is my solution too simplistic? If it's feasible, how can I deal with updates as outlined above?
Your solution can work but it is not simple thing to implement - especially if you try to do it somehow generic (check answers in this question - somebody offered a code base which should have this already implemented). It also causes a lot of additional traffic to database so it is definitely not a good approach when you expect some heavy load. The simplest solution is what #Gert Arnold mentioned.

Versae's Neo4j python rest client and graph algos access

I'm using versae's neo4j rest client to access a neo4j DB but I stumbled upon a problem trying to figure out how to use the paths algorithms from a node.
In the neo4j documentation it says that there are built-in graph algos in the URL *db/data/node/NODE_ID/paths* but it seems like versae's API doesn't allow access to these algos, as I read in the docs it has access to "extensions" but not to the default built-in algos.
Anyone knows how to access these methods without having to create a server extension just to reimplement it?
piva,
Currently there's no way to access to algos factory from the neo4jrestclient. But I think it's the time to implement this. I hope to release a new version with this feature before the end of the next week.
Regards.

Web frameworks oriented towards graph databases?

I am to build a web app and I have realized that my domain data will be best represented by a graph structure. Which web frameworks out there does the greatest job at integrating with graph databases (neo4j in my case) and thereby gives me the easiest time getting up and running? I am open for all languages (mostly..)
EDIT:
My use case:
I am creating a bug tracker for a university department. It will track all kinds of issues (eg.: the classroom 1-0-24 needs chalk for the whiteboard, the course 'Introduction to programming sucks because of...', The alarm on the door into the library is way too strict, etc.)
I have defined loads of 'Areas of responsibility' (AoR) that are related to each other in terms of 'topically relatedness', 'is a super-AoR', 'is a sub-AoR', 'the responsible team is also responsible for this other AoR' and such. I want to present a graph of these areas of responsibility to the user. This is my wishlist for the graph:
Initially only show a subset of the graph
The user can pan around
As the user pans in one direction, new areas of the graph is revealed.
The user can click on a node to a) read more about that AoR, b) assign the users current Issue to that AoR (or maybe even drag issues to a AoR, just like with friends in Google+)
Currently I am considering using Grails (for the non-graphy parts like security and user management) and raw neo4j for the graph parts (that is, not using the GORM plugin that tries to fit a circle in a square hole)
I have now read about InfoGrid and it sounds quite interesting - especially the view-part (though I don't know how close it will bring me to my UX goal). I'm also worryed that it will not be as productive as Grails for the non-graphy parts.
Neo4j doesn't seem completely lost when it comes to visualisation either:
http://wiki.neo4j.org/content/Visualization_options_for_graphs
The InfoGrid project built its own web framework on top of the InfoGrid graph database -- precisely because existing web frameworks don't match graphs very well.
For example, we have custom tags for traversing (simple and compound) edges, detecting certain topologies, converting node identifiers into URLs etc.
Disagreeing with the other commenter, it would be so much harder (and so much less fun) to use a non-graph-aware web framework. We used to :-(
Any web framework you'll choose, should be absolutely independent on the DB integration. From my experience, the best web framework is the one you know the best.
When choosing web frameworks, it is better to consider different criteria than DB integration, (like: public vs intranet application, statless vs statefull model, number of expected concurrent users, etc).

Entity Framework, Dynamic Data and Versioning

I'm in the process of looking around at options for a back office tool. On the face of it the tool is simple CRUD so I was immediately attracted to Dynamic Data on top of Entity Framework (we're definitely a Microsoft shop!).
The problem is that future requirement is to support versioning. By this I mean :
User performs a series of updates to a series of entities
When they are happy they submit the changes
Changes persisted to the DB along with enough info to support a rollback
Elsewhere we've got handcrafted app that :
Includes a version id that is incremented as each new row inserted - i.e. we don't update we add a new row
A work item table ties together the changes using the version id along with the entity type (table)
So, the question is, how would I achieve a similar end result using entity framework and dynamic data?
If entity framework, etc isn't appropriate - what would you use (.Net)?
Thanks,
Alan
One solution would be to move the logic for the versioning to database triggers. This way you are able to use a standard Dynamic data on top of Entity Framework, and retrofit versioning by running a set of database scripts.
I would like to mention that in the new Dyanmic Data Preview 3 there is a new feature DomainService which supports Roles based security please see David Ebbo's Serssion from MIX09 here Microsoft ASP.NET 4.0 Data Access: Patterns for Success with Web Forms MIX09-T47F