In Neo4J, I want to use the bolt protocol.
I installed the 3.1 version of Neo4J.
I my Java project, that already works well with normal HTTP Rest API of Neo4J, I integrate with Maven the needed drivers and achieve to perform request with BOLT.
The problem is everywhere you make a search about bolt they give example like this one :
MATCH (a:Product) return a.name
But I don't want the name, I want all the data of all product, what ever i know or not before what are these columns, like here:
MATCH (a:Product) return * --> here I retrieve only the ids of nodes
I found there https://github.com/neo4j-contrib/neo4j-jdbc/tree/master/neo4j-jdbc-bolt we can "flatten" the result but it seems to not work or I didn't understand how it works:
GraphDatabase.driver( "bolt://localhost:7687/?flatten=-1", AuthTokens.basic( "neo4j", "......." ) );
I put the ?flatten=-1 at the end of my connection address... but that changed nothing.
Anyone can help? Or confirm it's not possible or not working ?
Thanks
Ok I understood my error, I didn’t dig enough in the object returned. So used to have a JSON formatted response, I didn’t see that I have to search in the StatementResult object to find the wanted object with its properties. In fact Eclipse in the “expressions” shows “in fly” only the ids, but inside the object data are there.
Record oneRecord = rs.next();
String src = oneRecord.get("m").get("source");
That way I can reconstruct my object
Related
Greetings to the community! I am using alfresco community edition 6.0.0 and I just faced a very weird problem. I am using the Java API to access my alfresco repository by running CMIS queries. I successfully fetched documents using cmis-strict like shown below:
Example 1)
select * from cmis:document WHERE cmis:name like '%doc%' AND cmis:objectId = 'e318a431-0ff4-4a4a-9537-394d2bd761af' "
Example 2)
SELECT * FROM cmis:document WHERE IN_FOLDER('63958f9c-819f-40f4-bedf-4a2e402f8b9f') AND cmis:name like '%temp%'
which work perfectly, what I would like to do is retrieve files/folders under a specific path (f.e fetch all folders under /app:company_home/app:user_homes)
what I do is running from the node browser of alfresco the following cmis-strict query
SELECT * FROM cmis:folder WHERE CONTAINS('PATH:"//app:company_home/app:user_homes//*"')
but even though there are existing folders under that directory nothing is returned. It seems that the PATH argument is not recognized as it should does, as when i run the query
SELECT * FROM cmis:folder I get back many results that have as parent the
app:company_home/app:user_homes
node
Any idea what may be the problem? Any help would be greatly appreciated, thanks :)
EDIT:
I have also tried to use lucene query like
PATH:"/app:company_home/app:user_homes//*") but no results returned too
Your user homes contains query works for me in both 5.2 and 6.1.1.
I like #Lista's suggestion of checking into your index. If that doesn't bear fruit, you might go get the CMIS object ID of the user homes folder, then use it with the IN_FOLDER clause you've already proven works.
I think both Lucene and CMIS queries (if using CONTAINS) end up on the index (not database), so it's not weird to assume something is off with the index itself. Have you tried rebuilding them? Are your nodes even in index (there's a SOLR admin console you can use to see this)?
https://docs.alfresco.com/6.0/concepts/query-lang-support.html
I wish to display some data from my SQL server into my application.
Let me explain throw an example what have i done until now, and please tell me how should i go on with my work:
(1) I have a database named: 'DB1'
(2) In my database i have table named 'users':
Id, Name, LastName
1 Dave Stone
2 Rose Mary
3 Gray Lone
(3) I created 3 php files: 1/ config.php (sets up my database log in information like password...)
2/ DBConnection.php : `
// Connecting to database
public function connect() {
require_once 'Config.php';
// Connecting to mysql database
$this->conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
// return database handler
return $this->conn;
}
}
?>
3/ GetUsers.php which i dont know how should i write it - this would be the code which will echo whatever i want from the table.
(4) Inside my android studio project i have a MainActivity.java and i want to get all the LastNames of all the users in the database and do whatever with them... like print them into a text box it doesn't really matter (let's say i don't know how many users I have).
I need some one to help me get stages (3)3/ + (4) done / explained.
I think what you mean is a good method to retrieve and set values from app to database, the best and most prominent way is using basic REST services that convert your db values to JSON then you load the json using your api key as authentication, it might sound really stressful but is in fact very easy and flexible to implement, the only way you can directly set and get db values on android is using sqlite (android local inbuilt db)
The best tutorial and major explanation for exactly what you want to achieve is here
http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/
Then this one for further works
http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
It covers how you make a rest service yourself
I'm trying to make custom spring Data query using field from reference as query
parameter. When i performed this query via REST i had no results at all:
I enabled hibernate logs and copy it to H2 console and I got many results:
My Flight and Airport entities are very simple
So what am I doing wrong? I have other simpler methods and they work fine using browser. I tried the same using Query annotation(second method on second screen), but I got same results. (Copied generated sql query to H2 console and received many results but it didn't work via REST).
EDIT
I found the solution. I just removed quotation marks from URL and
it works well :D
Sorry for my inattention.
Regards,
Michal
I found the solution. It was very simple. Basically I just removed quotation marks from URL and it works well :D
Actual method in Repository looks like:
List findFlightsByFromCityAndToCity(#Param("from") String from, #Param("to") String to);
Regards,
Michal
I have written a program that reads a webservice, retrieving user data, and then is supposed to push that data to ActiveDirectory, thus updating the user's title, address, phone numbers, etc.
The problem is that when I perform the search using the Unboundid Connection class the requested attributes are not returned. Below is the search code:
SearchResult result = connection.search( properties.getProperty("ldap.search.baseDN"),
SearchScope.SUB, "(cn=" + userId + ")",
"personalTitle", "department", "company", "manager", "telephoneNumber",
"streetAddress", "I", "st", "postalCode", "c", "pager", "mobile",
"fax", "cn");
The above code locates the desired user and the cn attribute is returned as expected, but the other attributes all fail to return. If I connect to AD using JXplorer using the same connection credentials, I'm able to see all the desired attributes exist, but are simply not being returned.
I have tried substituting SearchRequest.ALL_OPERATIONAL_ATTRIBUTES, SearchRequest.ALL_USER_ATTRIBUTES and SearchRequest.REQUEST_ATTRS_DEFAULT rather than listing the fields explicitly, but with no success.
I have also looked at the 'Schema' object returned from 'connection.getSchema()' and can see that personalTitle should exist:
connection.getSchema().getAttributeType("personalTitle")
The above code returns:
1.2.840.113556.1.2.615 NAME 'personalTitle' SYNTAX '1.3.6.1.4.1.1466.115.121.1.15' SINGLE-VALUE
So maybe this is a user permission issue? Has anyone experienced this and know how to resolve it?
Thanks,
Mike
LDAP search result entries only include attributes that actually have values, so the behavior you are seeing from the UnboundID LDAP SDK is appropriate and correct. Even if you explicitly request a particular attribute, that attribute will only be included in the entry if it has one or more values.
I think that you're confused by JXplorer because it's reading the schema to determine what attributes could possibly be included in the entry based on its object classes and is showing them to you so that you can set values for those attributes in the editor. But that doesn't mean that the entry returned by the server actually includes any information about those attributes.
To verify this, you can use the ldap-debugger tool provided with the LDAP SDK to see the actual LDAP communication that occurs. Just run a command like:
tools/ldap-debugger --hostname {directory-server-address} \
--port {directory-server-port} --listenPort {listen-port}
This will create a very simple LDAP proxy server that decodes all requests and responses that pass through it. To use it, simply point JXplorer at the specified listen-port. You will see that when JXplorer retrieves the entry, the entry returned by the server will only contain attributes that actually have values.
If you want to figure out what all the possible attributes are that you can include in a given entry, then use the LDAPConnection.getSchema method to retrieve the server schema, then Schema.getObjectClass for each of the object classes in the target entry, and finally use the ObjectClassDefinition.getRequiredAttributes and ObjectClassDefinition.getOptionalAttributes methods to see what attribute types must and may be used in entries with that object class.
I am working with a 3rd product called JPOS and it has an XMLPackager whereby I get a string from this packager that contains a record in an XML format such as:
<MACHINE><B000>STRING_VALUE</B000><B002>STRING_VALUE</B002><B003>STRING_VALUE</B003><B004>STRING_VALUE</B004><B007>STRING_VALUE</B007><B011>STRING_VALUE</B011><B012>STRING_VALUE</B012><B013>STRING_VALUE</B013><B015>STRING_VALUE</B015><B018>STRING_VALUE</B018><B028>STRING_VALUE</B028><B032>STRING_VALUE</B032><B035>STRING_VALUE</B035><B037>STRING_VALUE</B037><B039>STRING_VALUE</B039><B041>STRING_VALUE</B041><B043>STRING_VALUE</B043><B048>STRING_VALUE</B048><B049>STRING_VALUE</B049><B058>STRING_VALUE</B058><B061>STRING_VALUE</B061><B063>STRING_VALUE</B063><B127>STRING_VALUE</B127></MACHINE>
I have a SQL server table that contains a column for each of the listed. Not that it matters but I could potentially have thru defined with specific STRING_VALUEs. I'm not sure what is the best way to go about this in Java. My understanding is that SQL Server can take an XML string (not document) and do an insert. Is it best to parse each value and then put into a list that populate each value into? This is the first time I've used an XML file and therefore trying to get some help/direction.
Thanks.
Sorry, one of my colleagues was able to help and provide a quick answer. I'll try it from my Java code and it looks like it should work great. Thanks anyway.
Here is the SP that she created whereby I can pass in my XML string and bit value:
CREATE PROCEDURE [dbo].[sbssp_InsertArchivedMessages]
(
#doc varchar(max),
#fromTo bit
)
AS
BEGIN
DECLARE #idoc int, #lastId int
EXEC sp_xml_preparedocument #idoc OUTPUT, #doc
INSERT INTO [dbo].[tblArchivedMessages]
SELECT * FROM OPENXML(#idoc, '/MACHINE', 2) WITH [dbo].[tblArchivedMessages]
SET #lastId = (SELECT IDENT_CURRENT('tblArchivedMessages'))
UPDATE [dbo].[tblArchivedMessages]
SET FromToMach = #fromTo
WHERE ID = #lastId
END
GO
Regards.