Giter Club home page Giter Club logo

datanucleus-neo4j's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

datanucleus-neo4j's Issues

Support managed relations

When a relation is updated from one side we need to make sure that the other side is kept consistent (so that the L2 cache is updated accordingly), otherwise tests can fail due to the other side thinking that a field has a particular value when, in fact, it was removed.

Creates new Object instead of setting it to another Object.

Hi!
A new Object is created whenever I try to set it to an object property. Let someone reproduce this. Is it the default behavior?

public class ProductClass implements Serializable {
    ...
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    long id;
    @Persistent
    private String name = null;
   ...
}


public class Product implements Serializable {
...
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
long id;
@Persistent
private String name = null;
@Persistent(defaultFetchGroup = "true")
private ProductClass productClass = null;
...
}

Persisting the Product like this;

Product prod = new Product();
prod.setName('productName');
prod.setProductClass(prodClass);

PersistenceManager pm = JDOUtil.PERSISTENCE_MANAGER_FACTORY.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
pm.makePersistent(prod);
Object id = pm.getObjectId(prod);
tx.commit();
} finally {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }

Instead of setting the ProductClass to the Product, new ProductClass is produced.

Support persistence of "attributed relation" class as a Relationship

If we have an M-N relation and we want to store some properties on the relation we create an intermediate model class, with the source and target objects present as well as the properties we want to store. Currently this will be stored as a Node, with Relationship to source Node, and Relationship to target Node. Would be a nice alternative to be able to persist objects of this type as a Relationship between Node for source and Node for target.

Would only apply to POJO that has 2 relation fields (source and target, and no other), and these objects cannot be null. The majority of SVN trunk already uses PropertyContainer instead of Node, and Neo4jUtils has a convenience method to detect if a class is marked as "attributed relation".

Ineqeulity Filter method, .ne() gives QueryExecutionException.

Hi.
I tried to execute a code like this, and I got a stack trace.

JDOPersistenceManager jdopm = (JDOPersistenceManager) pm;
QProductClass cand = QProductClass.candidate();
JDOQLTypedQuery<Product> tq = jdopm.newJDOQLTypedQuery(Product.class);
List<Product> prods = tq.filter(cand.name.ne(value)).executeList();

The stacktrace;

Jan 03, 2018 8:01:14 PM com.hop.tub.servlets.TuListDataServlet doPost
SEVERE: null
org.neo4j.graphdb.QueryExecutionException: Unknown operation '!=' (you probably meant to use '<>',   which is the operator for inequality testing) (line 1, column 95 (offset: 94))
"START this=node:DN_TYPES(class="com.hop.tub.neo4j.jdo.model.Product") WHERE (this.name != "ampiclox") RETURN this"
                                                                                       ^
at org.neo4j.kernel.impl.query.QueryExecutionKernelException.asUserException(QueryExecutionKernelException.java:35)
3at org.neo4j.kernel.impl.factory.ClassicCoreSPI.executeQuery(ClassicCoreSPI.java:84)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacade.execute(GraphDatabaseFacade.java:369)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacade.execute(GraphDatabaseFacade.java:359)
at org.datanucleus.store.neo4j.Neo4jUtils.executeCypherQuery(Neo4jUtils.java:319)

I am able to use equality and starts-with methods .eq()and .startsWith() respectively, but .ne() gives Exception.

I think this line explains the problem with the plugin.

org.neo4j.graphdb.QueryExecutionException: Unknown operation '!=' (you probably meant to use '<>',   which is the operator for inequality testing) (line 1, column 95 (offset: 94))

Use "table name" as the property value on the index (instead of class name)

When we create a Node we currently put it into the index for the class in question, as

db.index().forNodes("DN_TYPES").add(node, "class", className);

If the table name is specified we likely should do

db.index().forNodes("DN_TYPES").add(node, "class", tableName);

Note that, to find the object in a polymorphic query, if the class has persistable superclasses then we also put it with that class too, so would need to use the table name of the superclass in that case also

Support for Neo4j HA connectivity

But what Java calls are needed to achieve this? The Neo4j "manual" isn't a "good read" for such things. If anyone knows then please contribute such information

Handle querying of objects that have no property for a field that is null

Current SVN trunk will persist any null field by just omitting the property. This matches Neo4j advice about how to handle null property values.

This will obviously cause problems with any query that makes explicit mention of the field, and will get an exception about Node xxx not having the property. We should update any query that is comparing against a particular value to check if the property exists and if comparing with null to check if it doesn't exist.

Move to latest 3.1.3 release of neo4j libraries

the latest release of neo4j is 3.1.3.

if I use the datanucleus conector in my code, I cannot use the neo4j tools to view the same data, because datanucleus-neo4j uses an older (incompatible) version of the libraries.

  1. create DB via datanucleus-neo4j
  2. view data using neo4j 3.1.3
  3. attempt to reconnect using datanucleus-neo4j

Support for missing (non-String) columns in Neo4j database.

Hi!
I have already asked this question on StackOverflow here. I think it will be beneficial to support missing (non-String) columns in Neo4j database. Because of this lack I have to discard the whole database whenever I want to add new non-String column to my model.

Cater for Cypher count() returning empty iterator if no nodes

Neo4j "count" queries are totally illogical. If you have no Node(s) for the cypher query and do something like
START T=node:DN_TYPES(class="org.jpox.samples.annotations.models.company.Person") RETURN count(T)
then this just returns an empty result set (iter.hasNext() == false). Need to cater for this nonsense.

CompoundIdentity is not supported

version: 5.1.0-m1
test case: https://github.com/dhakehurst/test-jdo, SimpleTest.CompoundIdentity()

Error from stacktrace indicates a badly formed CYPHER statement

"START pc=node:DN_TYPES(class="mydomain.model.CompoundItem") WHERE (pc.id = "item1" and pc.owner = cont1) RETURN pc"

maybe missing quotes around the "cont1".

I think that the problem might be the if statement at line 193 of Neo4jUtils.
it tests if the storedValue is an instance of a String, and inserts quotes if so, else no quotes.
However, in the case of the compound PK, the PK is stored as a String (I think).

So an additional test to catch the PK case needs to be added.
Am not sure how to test for the PK case, happy to provide a patch if I can get some advice.

JDO @Join relationships not persisted

I have two classes, as below.

When I store (makePersistent) an instance of the container,
the items do not get persisted.

This works fine with datanucleus-rdbms

@PersistenceCapable
class Container {
@PrimaryKey
@Persistent
public String getIdentity() {...}

@Persistent(defaultFetchGroup = "true")
@Join
public List<Item> getItems() {...}

}

@PersistenceCapable
class Item {
@PrimaryKey
@Persistent
public String getIdentity() {...}
}

Multiple Primary Keys fail

version: 5.1.0-m1
test: https://github.com/dhakehurst/test-jdo, SimpleTest.MultiplePrimaryKeys()

JDO allows for multiple primary key fields.
The documentation/tutorial for datanucleus-neo4j indicates we can have multiple primary keys.

but when using multiple primary keys, we get an exception (see below).

java.lang.NoSuchMethodError: mydomain.model.MultiKey_PK.setId1(Ljava/lang/Long;)V
at mydomain.model.MultiKey.dnCopyKeyFieldsToObjectId(MultiKey.java)
at org.datanucleus.identity.IdentityManagerImpl.getApplicationId(IdentityManagerImpl.java:461)
at org.datanucleus.ExecutionContextImpl.newObjectId(ExecutionContextImpl.java:3705)
at org.datanucleus.state.StateManagerImpl.setIdentity(StateManagerImpl.java:2305)
at org.datanucleus.state.StateManagerImpl.initialiseForPersistentNew(StateManagerImpl.java:482)
at org.datanucleus.state.StateManagerImpl.initialiseForPersistentNew(StateManagerImpl.java:122)
at org.datanucleus.state.ObjectProviderFactoryImpl.newForPersistentNew(ObjectProviderFactoryImpl.java:218)
at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2013)
at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1857)
at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1712)
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:712)
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:738)
at org.datanucleus.test.SimpleTest.MultiplePrimaryKeys(SimpleTest.java:201)

Support for Filter method String.contains().

Hi!
We already have the following Filter methods,
.eq() => equals to
.ne() => not equal to
.startsWith() => begins with
.matches() => exact value

Can we have method to search for string which contains a string value?
For instance, if a string like Appletogether, searching for toget is true.

I have not seen the method for that.

Support native Cypher queries

Allow the user to do

pm.newQuery("cypher", "MATCH (m:Movie {title:"The Matrix"})<-[:ACTS_IN]-(actor) WHERE actor.name =~ '.*s$' RETURN actor.name ;");

or

em.createNativeQuery("MATCH (m:Movie {title:"The Matrix"})<-[:ACTS_IN]-(actor) WHERE actor.name =~ '.*s$' RETURN actor.name ;");

LazyLoadQueryResult Exception if result is empty when calling size()/isEmpty()

List<? extends Persistable> result = jdoQuery.executeList(); //or jdoQuery.execute();

if this returns a LazyLoadQueryResult, with no items in the result,

calling, result.size(), result.isEmpty(), etc.
results in an Exception, see stacktrace below.

The problem might be in "LazyLoadQueryResult.getNextObject()" which calls 'next' without protecting it with a call to 'hasNext'

java.util.NoSuchElementException: next on empty iterator
at scala.collection.Iterator$$anon$2.next(Iterator.scala:39)
at scala.collection.Iterator$$anon$2.next(Iterator.scala:37)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator$$anonfun$next$1.apply(ResultIterator.scala:71)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator$$anonfun$next$1.apply(ResultIterator.scala:70)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator$$anonfun$failIfThrows$1.apply(ResultIterator.scala:93)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator.decoratedCypherException(ResultIterator.scala:102)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator.failIfThrows(ResultIterator.scala:91)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator.next(ResultIterator.scala:70)
at org.neo4j.cypher.internal.compiler.v3_0.ClosingIterator.next(ResultIterator.scala:48)
at org.neo4j.cypher.internal.compiler.v3_0.PipeExecutionResult.next(PipeExecutionResult.scala:75)
at org.neo4j.cypher.internal.compiler.v3_0.PipeExecutionResult$$anon$2.next(PipeExecutionResult.scala:68)
at org.neo4j.cypher.internal.compiler.v3_0.PipeExecutionResult$$anon$2.next(PipeExecutionResult.scala:66)
at org.neo4j.cypher.internal.compatibility.ExecutionResultWrapperFor3_0$$anon$1$$anonfun$next$1.apply(CompatibilityFor3_0.scala:240)
at org.neo4j.cypher.internal.compatibility.ExecutionResultWrapperFor3_0$$anon$1$$anonfun$next$1.apply(CompatibilityFor3_0.scala:240)
at org.neo4j.cypher.internal.compatibility.exceptionHandlerFor3_0$.runSafely(CompatibilityFor3_0.scala:117)
at org.neo4j.cypher.internal.compatibility.ExecutionResultWrapperFor3_0$$anon$1.next(CompatibilityFor3_0.scala:239)
at org.neo4j.cypher.internal.compatibility.ExecutionResultWrapperFor3_0$$anon$1.next(CompatibilityFor3_0.scala:233)
at org.neo4j.cypher.internal.javacompat.ExecutionResult.next(ExecutionResult.java:241)
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.getNextObject(LazyLoadQueryResult.java:266)
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.getSizeUsingMethod(LazyLoadQueryResult.java:209)
at org.datanucleus.store.query.AbstractQueryResult.size(AbstractQueryResult.java:357)
at org.datanucleus.store.query.AbstractQueryResult.isEmpty(AbstractQueryResult.java:299)
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.getNextObject(LazyLoadQueryResult.java:266)
at org.datanucleus.store.neo4j.query.LazyLoadQueryResult.getSizeUsingMethod(LazyLoadQueryResult.java:209)
at org.datanucleus.store.query.AbstractQueryResult.size(AbstractQueryResult.java:357)
at org.datanucleus.store.query.AbstractQueryResult.isEmpty(AbstractQueryResult.java:299)

Support backed SCO collections

If we allowed backed SCO collections we would be able to see the collection operations such as add, delete, set etc and so manage the Relationship objects directly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.