NeoEMF

Licence

NeoEMF: overview

  • Handle large models with task-specific databases

  • Lazy-loading

  • Compliant with the EMF API

    • Easy to integrate in existing applications

    • EMF-Compatible code generation

  • Advanced caching (& prefetching strategies)

  • Efficient XMI importer

NeoEMF: Architecture

neoemf architecture

NeoEMF: datastores

NeoEMF/Graph
  • Efficient model traversal using rich query language

  • Mogwaï framework (OCL to Gremlin translation)

NeoEMF/Map
  • Fast access to atomic operations

  • Designed for EMF-API calls

NeoEMF/Column
  • Transparent model distribution

  • Concurrent read/write

  • Distributed model transformations (ATL-MR)

NeoEMF: project website

neoemf github

NeoEMF: initialize a new resource

JavaPackage.eINSTANCE.init();
PersistenceBackendFactoryRegistry.register(
			BlueprintsURI.SCHEME,
			BlueprintsPersistenceBackendFactory.getInstance()); (1)

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap()
			.put(BlueprintsURI.SCHEME,
					PersistentResourceFactory.getInstance()); (2)

URI uri = BlueprintsURI.createFileURI(new File("<db_path>")); (3)

Resource resource = resourceSet.createResource(uri); (4)
1Register the Persistence Backend Factory.
2Create a ResourceSet and register the PersistentResourceFactory
3Create a new URI to locate a file-based resource.
4Create the resource.

NeoEMF: persist a resource

ImmutableConfig config = new BlueprintsNeo4jConfig().autoSave().cacheSizes().cacheMetaClasses(); (1)

resource.save(config.toMap()); (2)
// Resource saved in a local Neo4j database
resource.getContents() (3)
// [...]
1Create a new option configuration (backend-specific).
2Save the resource.
3Manipulate the resource by accessing the local database

NeoEMF: modify an existing resource

  • Load resource using the same option builder.

  • Navigate its content and perform update operations

  • Save the resource (automatically done with autosave_ option)

ImmutableConfig config = new BlueprintsNeo4jConfig().autoSave().cacheSizes().cacheMetaClasses();

URI uri = BlueprintsURI.createFileURI(new File("<db_path>"));

resourceSet.createResource(uri)
resource.load(Collections.emptyMap());

// Model manipulation operation (complete EMF API support)
MyClass myClass = (MyClass) resource.getContents().get(0);
myClass.setName("NewName");

// Save the modification in the local Neo4j database
resource.save(config.toMap());

Hands-on time!

Let’s import a Java model, save it in Neo4j and MapDB, and query the database.

NeoEMF: summing up

  • Select the NoSQL database adapted to a modeling scenario

  • Transparent EMF integration

  • On-demand loading