Difference between graph database: Neo4j & AllegroGraph - nosql

What is the difference between these two graph databases: Neo4j and AllegroGraph? Which is better for Java Web programming?

If you have no reason to choose RDF + SPARQL (which both products support), Neo4j provides a clean Java API for manipulating a property graph (nodes + relationships + properties on both). For web applications, I wrote up an example using Spring Framework, which also exists in a simplified version as a workshop.
Disclaimer: Obviously I'm on the Neo4j team, and I don't have any in-depth knowledge regarding AllegroGraph.

I chose AllegroGraph over Neo4j because of its support for SPARQL queries. It seemed to me that the Neo4j approach of traversing a graph is less tidy, especially for more complex retrieval operations.
...and no, I have no affiliation with either organisation.

One other consideration is the licenses. AllegroGraph's free edition can be used as long as you have fewer than 50 million triples. See http://www.franz.com/agraph/allegrograph/ag_commercial_edition.lhtml
Neo4j is free as long as your project uses the community edition; only if you modify the Neo4j source you must open-source the modifications. The basic license terms can be found on their home page: http://neo4j.org/

AllegroGraph has a java client library which supports 2 standard java semantic API's: Jena and Sesame. The client source is EPL on github. AG supports sparql, transactions, reasoning, geospatial, temporal, and graph analysis. There are no extra features specifically for web apps, but it would fit into any framework as a library.
(I work for Franz.)

In addition to SPARQL, AllegoGraph allows you to write Prolog rules and queries. For complex query logic, it's much more expressive than SPARQL.
There are some examples in the Java client tutorial: http://www.franz.com/agraph/support/documentation/v4/java-tutorial/java-tutorial-40.html

Related

Migration & Technology Alignment: Sails.js from Wakanda

I am evaluating Sails.js as potentially the most closely aligned alternative for a migration of about four years of development on the Wakanda JS full stack platform. I would appreciate perspectives from the Sails.js community based on the following overview:
AS-IS: WakandaDB, Node.js / SSJS / Node Workers / Shared Workers; Client side: Angular 5 for Web and for Ionic/Cordova hybrid mobile apps.
Wakanda DB and Wakanda API and dataclass / dataclass method architecture and all of its off the shelf capabilities will no longer be in play.
It seems that Sails.js is the most closely aligned to my current technology stack. Does the community agree with this? I understand the community is pretty large, but I do not see evidence of this in terms of books on Amazon (as compared to the Meteor platform for example).
Appreciate perspectives and any references to migration related guides/references.
Kirk
I'm using sails.js professionnaly for four years now.
I worked with version V0.12 and now V1.0.
I've never heard of the Framework Wakanda so i can't tell you if the technology stack match.
All i can say is Sails.JS have strenghs and weaknesses.
I will just give you the cons so you can see if this is a no go for you.
The community is not the most active, a lots of good stuff developed for v0.12 isn't ready for v1.0 after years (i'm thinking of sails-auth and sails-permissions who provide good ACL structure).
He could be to big for small projects but i don't think it's a problem for your needs.
He works great with MongoDB but not that much with other DB system (even if community developed adapters for other DB as postgresql).
And for me the biggest weakness of this framework is his ORM.
This one will play with your nerves, you will have to rewrite some parts like the one who create the criteria of the query from express req and set default limit to your query even if you don't ask it.
I you don't use mongo, don't use the migration script provide by the adapter and build your own with db-migrate.
So i will recommend Sails JS for project with complex API but simple DB structure.
Hope this will help you in your choice ;)

hapi fhir server full turn key implementation

So I have been using Hapi Fhir Server (for several years) as a way to expose proprietary data in my company....aka, implementing IResourceProvider for several resources.
Think "read only" in this world.
Now I am considering accepting writes.
The Hapi Fhir Server has this exert:
JPA Server
The HAPI FHIR RestfulServer module can be used to create a FHIR server
endpoint against an arbitrary data source, which could be a database
of your own design, an existing clinical system, a set of files, or
anything else you come up with.
HAPI also provides a persistence module which can be used to provide a
complete RESTful server implementation, backed by a database of your
choosing. This module uses the JPA 2.0 API to store data in a database
without depending on any specific database technology.
Important Note: This implementation uses a fairly simple table design,
with a single table being used to hold resource bodies (which are
stored as CLOBs, optionally GZipped to save space) and a set of tables
to hold search indexes, tags, history details, etc. This design is
only one of many possible ways of designing a FHIR server so it is
worth considering whether it is appropriate for the problem you are
trying to solve.
http://hapifhir.io/doc_jpa.html
So I did this download (of the jpa server) and got it working against a real db-engine (overriding the default jpa definition).....and I observed the "fairly simple table design". So I am thankful for this simple demo. But looking at the simple, it does concern me for a full blown production setup.
If I wanted to setup a Fhir Server, are there any "non trivial" (where above says "fairly simple table design") ... to implement a robust fhir server...
that supports versioning (history) of the resources, validation of "references (example, if someone uploads an Encounter, it checks the Patient(reference) and the Practitioner(reference) in the Encounter payload......etc, etc?
And that is using a robust nosql database?
Or am I on the hook for implementing a non-trivial nosql database?
Or did I go down the wrong path with JPA?
I'm ok with starting from "scratch" (an empty data-store for my fhir-server)....and if I had to import any data, I understand what that would entail.
Thanks.
Another way to ask this.....is......is there a hapi-fhir way to emulate this library: (please don't regress into holy-war issues between java and dotnet)
But below is more what I would consider a "full turn key" solution. Using NoSql (CosmoDB).
https://github.com/Microsoft/fhir-server
A .NET Core implementation of the FHIR standard.
FHIR Server for Azure is an open-source implementation of the
emerging HL7 Fast Healthcare Interoperability Resources (FHIR)
specification designed for the Microsoft cloud. The FHIR specification
defines how clinical health data can be made interoperable across
systems, and the FHIR Server for Azure helps facilitate that
interoperability in the cloud. The goal of this Microsoft Healthcare
project is to enable developers to rapidly deploy a FHIR service.
With data in the FHIR format, the FHIR Server for Azure enables
developers to quickly ingest and manage FHIR datasets in the cloud,
track and manage data access and normalize data for machine learning
workloads. FHIR Server for Azure is optimized for the Azure ecosystem:
I'm not aware of any implementation of the HAPI server which support a full persistence layer in NoSQL.
HAPI has been around for a while, the persistence layer has evolved quite a bit and seems to be appropriate for many production scenarios, especially when backed by a performant relational database.
The team that maintains HAPI also uses it as the basis for a commercial offering, Smile CDR. Many of the enhancements that went into making Smile CDR production ready are baked into the HAPI open source project. There has also been some discussion on scaling the JPA implementation.
If you're serious about using HAPI in production I'd recommend doing some benchmarks on the demo server you set up that simulate some of your production use-cases to see if it will get you what you want, you may be surprised. You can also contact the folks at Smile CDR as they do consulting and could likely tell you more specifically how to tune an instance to scale for your production priorities.
You can use Firely's implementation of FHIR. The most used repo is the FHIR SDK;
https://github.com/FirelyTeam/firely-net-sdk
But if you want more done for you out of the box you can use their Spark repo. This uses the SDK underneath and ultimately gives you a IAsyncFhirService which you can use for CRUD operations;
https://github.com/FirelyTeam/spark
And to your question; Spark currently only supports Mongo DB as the data persistence layer i.e. there is no entity like mapping done to create a db schema in a relational database. NoSQL I think made sense in this case.
Alternatively, check out the list of FHIR implementations in other languages maintained by HL7 themselves;
https://wiki.hl7.org/Open_Source_FHIR_implementations

What are the differences between Spring Data Neo4j 4 and neo4j-ogm?

I notice SDN4 has the concept of repositories and annotations for cypher queries, but this seems not much more than programming style? Neo4j-OGM seems straight forward, easy to set up, with a really practical and efficient API. I'm wondering why both projects exist. Are there any real differences between the two?
Spring Data Neo4j
http://projects.spring.io/spring-data-neo4j/
Neo4j OGM
https://neo4j.com/docs/ogm-manual/current/introduction/
The idea behind having separate projects is to enable as many developers as possible to integrate their JVM-based applications easily with Neo4j.
The two projects are closely related: Spring Data Neo4j's implementation is actually backed by the Neo4j OGM codebase. The Spring Data Neo4j project extends the capabilities of the OGM by allowing developers to work with familiar concepts - Repositories, Transactions, Templates, Derived Queries and so on.
However for developers who don't want to (or cannot) use the Spring stack, having a separate OGM project means they do not get shut out from using Neo4j.

JPA for Graphdatabases

I thought about using a graph database for my new project. It's
a project with many social relations and many other things which
can easily be represented by a graph.
Graph-Databases are much faster so I started thinking about it.
However, I have a Java Enterprise Web Application and I have been using
(until now) a relational MySQL Database with JPA.
Now my question: Is there already the same JPA functionallity
for Graph-Databases like there is for relational Databases?
I would like to use Neo4j or OrientDB.
DataNucleus JPA provides persistence to Neo4j. Supports basic relationships and an amount of Cypher query capabilities, and there is a tutorial for use with JPA (as well as JDO). Open to contributions to push it further.
OrientDB also provides an amount of support for JPA annotations direct IIRC.

Restlet + mongoDB + Freemarker

We are making a web based application in Java that should be accessible to any device and so we zeroed in for Restlet for our REST based web service need.
For UI we are thinking of Freemarker together with Twitter bootstrap and database will be mongoDB. And guice for dependency injection.
Since I am new to most these technology stack, do you think this is fair choice for a long run. Also, for database mapper framework we decided to use Jongo it seems lightweight. Kundera is an option but it has lots of dependency. What you expert say ?
"Kundera is an option but it has lots of dependency." Not sure what do you mean by this statement? could you please explain it more?
Please take a look at https://github.com/impetus-opensource/Kundera/wiki/Kundera-Mongo-performance for performance using Kundera!
It really depends on your needs
REST Framework :
IHMO you should test at least theses 3 JAX-RS Frameworks : RestEasy / Jersey / Restlet and choose the one according to your needs.
JAX-RS Frameworks
https://stackoverflow.com/questions/1710199/which-is-the-best-java-rest-api-restlet-or-jersey
UI :
I've worked with Jersey + Freemarker through a framework called Webengine from Nuxeo, it was ok.
Nevertheless, you should consider a rich client approach based on Javascript/CSS/HTML (see Backbone.js, Ember.js)
Pros :
With such approach you could expose JSON REST services using a JAX-RS Framework (instead of freemarker/html services) .
Theses services can be consumed by a web application and/or native mobile apps (ios, android).
Cons:
Your team must have advanced javascript skills (this blog can help )
Database :
What kind of data do you need to store ?
MongoDB is document-oriented and flexible enough to cover lots of needs
As you said, Jongo is a lightweight API (500 lines of code + 1 dependency) over mongo-java-driver.
It allows you to query MongoDB as if you were in MongoShell (ie. with plain json/bson queries) and map your object using jackson.
This question is a good example: Mongo DB query in java
Relying on Restlet Framework for your RESTful web API/service backend sounds like a good choice for a multi-devices application. FreeMarker is very powerful and flexible so you should be in good company there as well.
I don't know too much about the other pieces of your stack.