Java driver question

Hello I'm using neo4j desktop 1.5.7, Graph DBMS 5.3.0 and neo4j-java-driver-5.6.0.jar

I reference Overview (Neo4j Java Driver 5.6 API) <- 5.6.0

I want to read my node(Person)

My code is

    private void printPeople(String initial)
    {
        try (Session session = driver.session())
        {
            Result result = session.run(
                    "MATCH (a:Person) WHERE a.name STARTS WITH $x RETURN a.name AS name",
                    parameters("x", initial));
            while (result.hasNext())
            {
                Record record = result.next();
                System.out.println(record.get("name").asString());
            }
        }
    }

but it return only "a.name"

What I want to do is print out all the Person nodes in the neo4j desktop GDB.

The code returns the name property because that is what is returned in your cypher statement passed to the run method. You can return the entire node by returning ‘a’ instead of ‘a.name’. Returning the node will allow you to get the node’s ‘id’, its labels, and its properties. If you are interested in just the properties, you can also get just those by returning ‘properties(a)’. This will give you a map of the properties.

The other change you have to make is extracting the node from the result. You can add the following after you get the ‘record’

Node node = record.get(“a”).asNode();

Node has methods to get its Id, properties, and labels.

I heartily thank you.
Where can I find the relevant documents?

I also saved rdf xml using n10s.rdf.import.fetch on neo4j desktop. My file is as follows.

xmlns:test="http://www.test/2023#"
<test:Cat rdf:ID="_2300">
<test:Name.aliasName>Tom</test:Name.aliasName>

As a result, I checked the uri item in Node properties for http://www.test/2023#_2300.
Is uri also a property?

Sorry, I have not worked with RDF.

For Java, there are a few references that should help:

Thank you!
How can i find this? ```
Node node = record.get(“a”).asNode();

What do you want to find?

Example or document to getting properties using Map.
Like

            while (result.hasNext())
            {
                Record record = result.next();
                Map<String,Object> row = record.get("a").asMap();
                System.out.println(row);
            }

I don't like using the iterator. I prefer using the 'stream' or 'list' method to extract multiple records from a query. If I know there can be only one result, then I use 'single' to extract the one record. Below is your example using the 'list' method to extract the records from the result. The lambda expression is used to transform each record. In this case, a map of the node's properties

    private void printPeople(String initial)
    {
        try (Session session = driver.session())
        {
            Result result = session.run(
                    "MATCH (a:Person) WHERE a.name STARTS WITH $x RETURN a",
                    parameters("x", initial));
            
             List<Map<String, Object>> listOfPeople = result.list(r->r.get("a").asMap());
             listOfPeople.forEach(System.out::println);
        }
    }