Giter Club home page Giter Club logo

blueprint41's Introduction

Blueprint41
 
✔️ Supports for Neo4j and Memgraph
✔️ Works Visual Studio, Visual Studio Code and Rider
✔️ Develop on Windows, macOS or Linux
 

Blueprint41

NuGet downloads repo size license Quality Gate Status

.NET ORM for Neo4j Graph Database

Simplify database operations through generated data access objects.

Frictionless Development with Intellisense

Intellisense

Neo4j Plugins (Optional)

To learn more, please visit Extension and Plugins.

Documentation

To learn more, please visit Blueprint41 wiki.

Connection

PersistenceProvider.CurrentPersistenceProvider = new Neo4JPersistenceProvider($"bolt://localhost:7687", $"neo4j", $"password");

Automated Deployment of Schema Upgrades

// Datastore defines the latest schema definition
Datastore model = new Datastore();

// Sync database schema with the latest upgrade scripts
model.Execute(true);

Type Safe Creation of Nodes and Relationships

using (Transaction.Begin())
{
    Movie matrix = new Movie()
    {
        Title = "The Matrix",
        Tagline = "Welcome to the Real World",
        Released = new DateTime(1999, 3, 31)
    };

    Person keanu = new Person()
    {
        Name = "Keanu Reeves",
        Born = new DateTime(1964, 9, 2)
    };

    Person lana = new Person()
    {
        Name = "Lana Wachowski",
        Born = new DateTime(1961, 7, 30)
    };

    Person lilly = new Person()
    {
        Name = "Lilly Wachowski",
        Born = new DateTime(1967, 12, 29)
    };
    
    // Creates relationship via Type-safe generated objects
    movie.Actors.Add(keanu);
    movie.Directors.Add(lana);
    movie.Directors.Add(lilly);
    movie.Genre.Add(Genre.Load(Genre.StaticData.Name.Action));
    movie.Genre.Add(Genre.Load(Genre.StaticData.Name.Sci_Fi));

    // Commits detected changes to database
    Transaction.Commit(); 
}

Type Safe Querying of the Graph

using (Transaction.Begin())
{
    // Get Movies of Keanu(Direct relationship)
    Person keanu = Person.LoadByName("Keanu Reeves");
    EntityCollection<Movie> movies = keanu.ActedIn; // Movies are retrieve here

    // Get Director of Keanu(Spans multiple relationships)
    var query = Transaction.CompiledQuery
    .Match
    (
        Node.Person.Alias(out var director)
            .In.PERSON_DIRECTED_MOVIE.Out.
        Movie
            .Out.PERSON_ACTED_IN_MOVIE.In.
        Person.Alias(out var actor)
    )
    .Where(actor.Name == "Keanu Reeves")
    .Return(director)
    .Compile();

    List<Person> directors = Person.LoadWhere(query);
}

blueprint41's People

Contributors

agentsmith41 avatar ca-link avatar ca-seraph avatar circles-arrows avatar master168 avatar morpheus128 avatar neo-blueprint41 avatar spoonboy41 avatar thearchitect41 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blueprint41's Issues

Optimize deletion of files in the new code generator

Currently it deletes all existing files and then rebuilds the ones that are needed.

To reduce TFS spending time to scan for changes between locally updated files and the TFS server:

  • We like to instead have the existing files scanned and only write changes to files that are actually changed.
  • Then we can scan the folder and remove files and folders that should not be there.

PersistenceProvider.CurrentPersistenceProvider error with database parameter

Hi ,
I am trying to connect to database, when i try to connect with the below code with database parameter it errors. Can you help me to fix it as there was not documentation with this parameter. i used DatabaseName as "test".
I am using neo4j v4.4.15 and blueprint41 v1.0.21, Blueprint41.Neo4jDriver.v4 v1.0.21 and blueprint41-4.0.2.jar file

// using v4
using Blueprint41.Neo4j.Persistence.Driver.v4;

PersistenceProvider.CurrentPersistenceProvider = new Neo4jPersistenceProvider(
            settings.GraphDatabase.ConnectionString,
            settings.GraphDatabase.UserName, settings.GraphDatabase.Password,
            settings.GraphDatabase.DatabaseName);
        var model = new Datastore();
        model.Execute(true); 

I am getting the below exception:

System.AggregateException: One or more errors occurred. (Invalid input ':': expected <init> (line 1, column 1 (offset: 0))
":use test"
 ^)
 ---> Neo4j.Driver.ClientException: Invalid input ':': expected <init> (line 1, column 1 (offset: 0))
":use test"
 ^
   at Neo4j.Driver.Internal.MessageHandling.ResponsePipelineError.EnsureThrownIf(Func`2 predicate)
   at Neo4j.Driver.Internal.MessageHandling.ResponsePipelineError.EnsureThrown()
   at Neo4j.Driver.Internal.Result.ResultCursorBuilder.ConsumeAsync()
   at Neo4j.Driver.Internal.AsyncTransaction.DiscardUnconsumed()
   at Neo4j.Driver.Internal.AsyncTransaction.RollbackAsync()
   at Neo4j.Driver.Internal.AsyncTransaction.RollbackAsync()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Blueprint41.Core.AsyncHelper.WaitEx[T](T task, Boolean recursive)
   at Blueprint41.Core.CustomTask.Wait(Boolean recursive)
   at Blueprint41.Core.CustomTaskScheduler.RunBlocking(Func`1 work, String description)
   at Blueprint41.Neo4j.Persistence.Driver.v4.Neo4jTransaction.RollbackInternal()
   at Blueprint41.Transaction.Rollback()
   at Blueprint41.Transaction.Cleanup()
   at Blueprint41.Core.DisposableScope`1.Dispose()
   at Blueprint41.Neo4j.Persistence.Driver.v4.Neo4jPersistenceProvider.get_Driver()
   at Blueprint41.Neo4j.Persistence.Driver.v4.Neo4jTransaction.Initialize()
   at Blueprint41.Core.DisposableScope`1.Attach()
   at Blueprint41.Transaction.Begin(Boolean readWriteMode, OptimizeFor mode)
   at Blueprint41.Transaction.Begin(Boolean readWriteMode)
   at Blueprint41.DatastoreModel.Execute(Boolean upgradeDatastore, MethodInfo unitTestScript, Predicate`1 predicate, Boolean standAloneScript)
   at Blueprint41.DatastoreModel.Execute(Boolean upgradeDatastore, MethodInfo unitTestScript)
   at Blueprint41.DatastoreModel.Execute(Boolean upgradeDatastore)

Is there a way to write custom neo4j code or execute stored procs using blueprint41?

So far most of the functionality I've needed from an ORM seems to be available in blueprint41 but there are times when certain methods aren't available (or not easily found in the documentation).

Off the top of my head I can't figure out ways to do UNWINDs or
WHERE NOT in a relationship ex:
MATCH (p:person) WHERE NOT (p)-[:executes]-(:transaction) RETURN p

We've been able to manage by finding alternative ways to approach these problems but there are some times when just writing some neo4j would be easier. Is there a way to access the bolt driver itself for times when I have to do this? Are there any plans for updates that allow stored procedures to be added into the datastore?

Solution stopped compiling

Is it possible that there was a breaking change with the last update?

My Generated project stopped compiling today... there were no changes to the model. I noticed it when I tried to build the solution. I also noticed that there was an update to the NuGet package on Feb 20

The error is: CS1503 Argument 1: cannot convert from Blueprint41.Property to Blueprint41.EntityProperty.

Additionally, there are errors saying that Node.EventAction is obsolete.

Finally, there are errors that "EventAction" does not contain a definition for Uid and no accessible extension method 'Uid' accepting a first argument of time 'EventAction' could be found

Both BluePrint41 and Neo4j Driver packages are on the latest version 1.1.0.

Asynchronous API

Can you please tell me the reason for the lack of an asynchronous API for writing and reading, or simply did not have time to implement it?

p.s. only recently started looking towards graph databases and Neo4j in particular and did not find anything more convenient than your project

Custom Logging in v4 Neo4jPersistenceProvider not working

Hi,
I used PersistenceProvider(v4) advancedConfig parameter customLogger property to enable logging but still the information about the transaction and database connection details are not getting logged. Is there a way to enable logging if we use blueprint41? if somethings goes wrong we need the logs to investigate the issue
var config = new AdvancedConfig() { SimpleLogging = false, CustomLogging= s => logger.Error(s) }; PersistenceProvider.CurrentPersistenceProvider = new Neo4jPersistenceProvider( settings.GraphDatabase.ConnectionString, settings.GraphDatabase.UserName, settings.GraphDatabase.Password, advancedConfig: config);

Logging doesn't work

When you initialize your provider with:

            PersistenceProvider.CurrentPersistenceProvider =
                new Neo4JPersistenceProvider(XXX, XXX, XXX , withLogging: true);

The log file never gets created or written to. In Logger.cs this line:

m_LogDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ?? @"C:\", "TransactionLogs");

needs to be

LogDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ?? @"C:\", "TransactionLogs");

So the setter get called successfully and the LogFile property gets set.

Review datastore backing types

Some issues emerged due to backward compatibility with earlier Neo4j version.

Issue: The dotnet "decimal" type is currently stored as a fixed-point "long" in Neo4j.
Solution: Add a feature to switch the behavior so decimals can optionally get stored as floating point numbers

Issue: The dotnet "DateTime" type is currently stored as a epoch "long" in Neo4j.
Solution: Add a feature to switch the behavior so DateTime can optionally get stored as "Neo4j DateTime" numbers

Issue: The dotnet "TimeSpan" type is currently unsupported.
Issue: The dotnet "Point" type is currently unsupported.

Issue: How could we change the default (for DateTime for example) without causing trouble for existing databases?

Cannot create properties on relationships

There doesn't appear to be a way to define properties on a relationship. In the movie example there is a property called 'roles' on the relationship between an actor and a movie.

On your wiki it looks like the 'roles' property has become a new node type instead of a property on the relationship itself. Is there a way to have properties on relationships? Defining an extra node to hold properties on a relationship seems like it could become inefficient by adding an extra step in path traversal.

Error running Getting Started Tutorial

When the program runs to transaction.commit (); throwing wrong:Due to an unexpected state of the neo4j transaction, it seems impossible to insert the Person at this time.

Should Blueprint41.Neo4j.Persistence.Void.Neo4jTransaction.Run be doing something?

Looking at this library to assess it's viability for a neo4j orm. I'm having some difficulty doing the movies example from the wiki. I find in my program.cs when I run Model.Execute(true); I get the error Due to an unexpected state of the neo4j transaction, it seems impossible to insert the Genre at this time

I traced this down to Blueprint41.Neo4j.Persistence.Void.Neo4jNodePersistenceProvider.Insert:171; there is a check to see if the result of a transaction is empty; but it appears that the Blueprint41.Neo4j.Persistence.Void.Neo4jTransaction.Run function doesn't actually do anything other than construct an empty Neo4jRawResult object which would always result an in empty result. Am I doing something wrong here?

Relationship Events are never fired

When trying to tap into events for Relationships I am unable to trigger them.

Relations["MY_RELATIONSHIP"].Events.OnRelationCreate += Events_OnRelationCreated;

Will never trigger. When I look at the source code I cannot see anything calling the "RaiseOnRelationCreate" event or any of the other ones. Is this intentional? Is there a way to get around this in the current version of blueprint41?

Enterprise Only features

I am using the free version of Neo4J and am trying to run through the Getting Started.

When I call model.Execute(true) I'm getting the following error:

DatabaseException: Unable to create Constraint( type='NODE PROPERTY EXISTENCE', schema=(:Person {Uid}) ):
Property existence constraint requires Neo4j Enterprise Edition

Is there a way to disabled the Enterprise features like Node Property Existence constraints?

Any way to query data from multiple nodes and return it all as one row?

For example, in our data structure we have Areas related to our business model which contain many ZipCodes and then each ZIpCode is associated with a City which is associated with a State. I would like to be able to take in a single Area Uid and then return a list of ZipCodes, the City Name it's in, and the state abbreviation.

What I'm looking for it to do something like this:

                var zipQuery = Transaction.CompiledQuery.Match(Node.ZipCode.Alias(out var zipCode)
                    .In.ZIPCODE_LOCATED_IN_CITY.Out.City.Alias(out var city).In.CITY_LOCATED_IN_STATE.Out.State.Alias(out var state))
                    .Match(Node.ContractorServiceArea.Alias(out var serviceArea).Out.INCLUDES_ZIP.In.ZipCode.Alias(out zipCode))
                    .Where(serviceArea.Uid == Parameter.New<string>("serviceAreaUid"))
                    .Return(zipCode.Zip, state.Abbr, city.Name)
                    .Compile();

Which generates the exact cypher I'd like to be able to run, but cannot figure out a way to run this query which might return the correct anonymous data types. I only see the
.LoadWhere()

queries on the created OGM objects.

I also honestly cannot tell the benfits of putting in multiple values in the .Return method either. It always seems like the return values are going to be attempted to be parsed into whatever static method you're running the .LoadWhere from.

Am I missing something or is this just a limitation of blueprint41?

Neo4j V5 Update

Hi,
Do you have any plan to release the new package with supports Neo4J V5, the current plugin is breaking in V5.
Thanks

Cannot find blueprint41 procedures after upgrading to 4.0.*

I've been working on a local database using neo4j 3.5.5 and blueprint41 for a few weeks now and decided to spin up an instance for hosting in AWS using the newer version of 4.0.4. Spent a little while trying to get it configured and eventually found that none of the procedures in the blueprint41 jar file are being loaded. I run the following query to see all the procedures and can see all the apoc ones fine but none of the blueprint41 ones:

CALL dbms.procedures() YIELD name
RETURN head(split(name,".")) as package, count(*), collect(name) as procedures;

To test to make sure it is a difference between the versions I went and ran this query against my local graph while running 3.5.5, I did see the blueprint41 procedures in the list, then I upgraded my local version, confirmed the settings are still in place and the plugin is still available, but am still not seeing any of the blueprint41 procedures.

Is the current plugin not available with newer versions of Neo4j?

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.