Using Neo4j Java API with Python Flask application - how? - flask

I have a Flask application that uses Neo4j and is written in Python. Now, I need to use Neo4j's Java API for traversal and other purposes. What would be a starting point to make this work?
Thanks.

You won't be able to do this from Python. The traversal API and core API are Java-only, and must execute on the machine where Neo4j is running.
This means you either have to be using an embedded Neo4j deployment (which you aren't), or you need to create a custom procedure/function/kernel extension in Java that will use those APIs and be callable in Cypher queries that you make remotely via the Python Neo4j driver.

Related

What is the best way to use web3.js on the backend side?

I am trying to create a web wallet application using "#solana/web3.js" for study purposes.
The backend side is using PHP (Laravel).
Which of the following is the best option on how to call web3.js on the backend side?
Call it from PHP using the exec function like "node xxxxx.js
Call node.js from PHP via curl, etc.
Using web3.js from PHP is not a good idea (backend should be implemented in node.js)
None of the above (Please tell me how to do that.)
Maybe #4, look into ethereum's JSON RPC that web3.js wraps and call the endpoints directly from back-end.
Your best bet will be to use a PHP package that can interact with Solana. There's a currently-deprecated-but-maybe-coming-back package that you can use at https://github.com/tighten/solana-php-sdk

How to export a pyspark mlib machine learning model and deploy as a web service?

I have a linear regression model build using spark mlib. Now i want to export the model and use the model via a web service.
I was looking into PMML was not able to find a proper source as how can I use it. Do I need to install any specific PMML library or how can it be done.
The same model i tried exporting as a pickle file using joblib and deployed it as a web service via flask. I want to do something similar for the model developed in Spark mlib.
Can anyone please help me out or point me to correct source?
For a simple REST web service using PMML you could have a look at https://github.com/openscoring/openscoring. It uses JAVA though. For Python+Flask I have no idea but PMML is nothing more than a XML file which needs to be evaluated. So you could try to write your own Python logic to do it. I've also found this https://github.com/maxkferg/pmml-scoring-engine but it doesn't have much stars.
It is noted though that PMML is quite limited in its usage. Not all models are supported e.g. ALS. Another approach is to deploy a PySpark application via its binaries. I blogged about this here. We deployed it using Cloud Foundry but you can use the buildpack to deploy it on Heroku as well if you need a public endpoint. Hope this helps.

Having RESTful service in RCP application

We have an existing eclipse RCP application that works as a standalone product. At a high level, this product is used to configure a image specification using its UI and we can export a sample Image based on these configuration.
Now we are developing another web application that has several modules and one module of it is to develop something that our eclipse RCP application does.
Just to provide a QUICK integration of the RCP application for demo purpose, I plan to run the RCP application separately in the server machine and expose its static functionality as a RESTful webservice. So the module shall make a RESTful call to the RCP application.
Now just to begin with I tried to embed a jetty server for hosting the REST service during the start of RCP application like below
But the thing is after the Jetty server is started I am not able to access the TestWebService using the path i configured. So I am confused if this is the right approach to have a RESTful service inside a RCP application. Please note that iam able to hit the server with http://localhost:1002, but not the service.
Following is the console log when i hit on http://localhost:1002/hello/test:
It's a really weird architecture you're experimenting with.
I mean to write an RCP-application which listens on a port and offers REST services on it; this could lead to further obstacles.
Instead I would seperate it into two software artifacts: an RCP-app and a web-application (.war).
You could extract a business-logic jar (It can be an OSGi plug-in if necessary) contaning your image manipulation logic.
Then include this plug-in/.jar as a dependency in the webapp and offer out it's functionalities thru a Web-container (Tomcat, GlassFish, etc.)
So your other (third) application will connect to the Web-services offered by this .war file.
opt.1) If you need a single running instance (because of database or other shared resource) then your RCP-app will have to use this REST service too.
opt.2) If not then simple compile the .jar/plug-in containing the business-logic into your RCP-app.

Apache Solr with C++ Application

I have a builder C++ application. I need to know how to use Solr with my C++ Application.
Solr is written in Java and runs as a standalone full-text search server within a servlet container such as Apache Tomcat or Jetty.
I need solr for indexing and search.
is there any way to use Solr with my C++ application?
Thank you!
You'll interact with Solr through HTTP, so using libcurl or POCO to make the request and then parse the resulting XML or JSON is a possible (and easy) solution.
The only client I've seen mentioned is SolrCPP, although I don't think that is maintained or available in any decent form any longer (It's the only one mentioned on the Integrating Solr list).

Build API for Django with Foxx or use ArangoDB Python driver?

I would like to use ArangoDB in Django, but I don't know which of the following options is better: using the ArangoDB Python driver or building a new API with Foxx. I think that the ArangoDB Python driver is not based on Foxx and I don't know the pros and cons of building a new API from scratch, even if it is made easier by Foxx. In addition, I'm afraid that using javascript in the interface between Foxx and the backend could make things slower. Would it be faster if I used Guacamole ODM together with Ruby on Rails?
Better option for your case is to use ArangoDB Python driver.
Here is couple of reasons:
easy-to-start - just install driver and move on with development
some similarity to Django ORM API
have some documentation
all your business logic will be in place and in Python which should be great advantage
And here is why Foxx is not the best option for your case:
you have to build your own API which means:
bunch of code in JavaScript
some documentation to describe API
additional logic level (in Foxx and in Django project) which increase tangling in your project
it probably not increase performance because you still retrieve your data using HTTP
Foxx is good option when you build Single page APP using ArangoDB as data layer. Also probably Foxx will be great for building hight-level API's with Foxx as preprocessed/aggregated data provider.
I made a python ArangoDB driver (https://github.com/saeschdivara/ArangoPy)
and I created on top of that kind of a bridge for Django (https://github.com/saeschdivara/ArangoDjango). So you can use kind of an orm for ArangoDB and still use the Django Restframework to create your API.