Code Monkey home page Code Monkey logo

chronos's Introduction

  • 👋 Hi, I’m @MartinHaeusler (Martin Häusler)!
  • 👀 I’m interested in server-side programming, all things Java & Kotlin, game programming, 3D modeling and more.
  • 📫 How to reach me: drop me a message via e-mail ([email protected])

chronos's People

Contributors

martinhaeusler 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  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar

chronos's Issues

Delete as you go

Out of curiosity, I wanted to see how Tupl was being used by Chronos. I noticed in a few places that delete actions over a range of records first store the keys into a collection, and then perform a second pass over them. This comment caught my attention too:

// in this case, we have to do a linear scan of both the key-time and the time-key index, remember
// the keys to delete, and then delete them afterwards. In Tuple, there is no "delete as you go" mode
// of operation for cursors, i.e. the cursor equivalent of "iterator.remove()" is missing.

Tupl Cursors do support this -- you just call store(null) on the current entry. The key remains in the same place until you move it. This more of a Tupl question than anything else. I'm wondering how can the documentation be improved so that this feature isn't overlooked?

Issues in chunkDbGraph() and writeDump()

1)Getting below exception, when chunkDbGraph is used. Snippets below:

File file = new File("D:/Vel/ESSE/Work/eWorks/GrapDB/DB/TestTUPL.txt");
ChronoGraph graph = ChronoGraph.FACTORY.create().chunkDbGraph(file).build();
graph.tx().open();

Exception:
Exception in thread "main" java.lang.IllegalArgumentException: The given string is no valid Chronos Version: '0.5.4'!
at org.chronos.common.version.ChronosVersion.parse(ChronosVersion.java:28)
at org.chronos.common.version.ChronosVersion.getCurrentVersion(ChronosVersion.java:50)
at org.chronos.chronodb.internal.impl.engines.chunkdb.ChunkedChronoDB.updateBuildVersionInDatabase(ChunkedChronoDB.java:120)
at org.chronos.chronodb.internal.impl.engines.base.AbstractChronoDB.postConstruct(AbstractChronoDB.java:73)
at org.chronos.chronodb.internal.impl.builder.database.ChronoDBFactoryImpl.create(ChronoDBFactoryImpl.java:48)
at org.chronos.chronodb.internal.impl.builder.database.AbstractChronoDBFinalizableBuilder.build(AbstractChronoDBFinalizableBuilder.java:62)
at org.chronos.chronograph.internal.impl.builder.graph.AbstractChronoGraphFinalizableBuilder.build(AbstractChronoGraphFinalizableBuilder.java:61)

2). The below exception occurred when tried to create dump. snippet below:

// create the dump file
File dumpFile = new File("D:/Vel/ESSE/Work/eWorks/GrapDB/DB/Test.chronodump");

// write the dump
graph.writeDump(dumpFile);

ERROR 2017-03-22 09:00:50,940 [main] org.chronos.chronodb.internal.impl.dump.ChronoDBDumpUtil: Failed to write Chronos DB Dump!
java.lang.IllegalArgumentException: The given string is no valid Chronos Version: '0.5.4'!

OwnedTransientEStore::isSet for multiple different container references

OwnedTransientEStore::isSet is currently implemented like this:

@Override
public boolean isSet(final InternalEObject object, final EStructuralFeature feature) {
    this.assertIsOwner(object);
    checkNotNull(feature, "Precondition violation - argument 'feature' must not be NULL!");
    // special case: a feature is always "set" if it is the container feature and eContainer != null
    if (feature instanceof EReference) {
        EReference eReference = (EReference) feature;
        if (eReference.isContainer()) {
            return this.getContainer(object) != null;
        }
    }
    if (feature.isMany()) {
        // for many-valued features, "being set" is defined as "not being empty"
        return this.getListOfValuesFor(feature).isEmpty() == false;
    }
    return this.contents.containsKey(feature);
}

@Override
public InternalEObject getContainer(final InternalEObject object) {
    this.assertIsOwner(object);
    return this.eContainer;
}

I think the special treatment of container references in OwnedTransientEStore::isSet misses the
case where feature is a containment reference, but not the only one.
A simple example would be two EClasses Order and OrderItem, with Order having two many-valued containment references to OrderItem, items (for items that have been added to the order) and consideredItems (for items that haven't been added to the order yet). If an OrderItem was contained by an Order via consideredItems, that would erroneously cause the modeled inverse of items to be considered set. (This example is taken from EMF: Eclipse Modeling Framework, p. 265.)

Failing unit test for reproducing:

package org.chronos.chronosphere.test.emf.estore.impl;

import org.chronos.chronosphere.test.emf.estore.base.EStoreTest;
import org.eclipse.emf.ecore.*;
import org.junit.Test;

import java.util.List;

import static org.junit.Assert.*;

public class IssueBasicEStoreTest extends EStoreTest {

	@Test
	@SuppressWarnings("unchecked")
	public void multipleMultiplicityManyContainmentsWithMultiplicityOneOppositeRefWorks() {

		this.createEPackageMultipleMultiplicityManyContainmentsWithMultiplicityOneOpposite();
		EPackage ePackage = this.getEPackageByNsURI("http://www.example.com/model");

		EClass myClass = (EClass) ePackage.getEClassifier("MyEClass");
		EClass yourClass = (EClass) ePackage.getEClassifier("YourEClass");

		assertNotNull(myClass);
		assertNotNull(yourClass);

		EReference eRefChildren = (EReference) myClass.getEStructuralFeature("children");
		EReference eRefOtherChildren = (EReference) myClass.getEStructuralFeature("otherChildren");
		EReference eRefParent = (EReference) yourClass.getEStructuralFeature("parent");
		EReference eRefOtherParent = (EReference) yourClass.getEStructuralFeature("otherParent");

		assertNotNull(eRefChildren);
		assertNotNull(eRefOtherChildren);
		assertNotNull(eRefParent);
		assertNotNull(eRefOtherParent);

		assertEquals(eRefParent, eRefChildren.getEOpposite());
		assertEquals(eRefChildren, eRefParent.getEOpposite());
		assertEquals(eRefOtherChildren, eRefOtherParent.getEOpposite());

		assertTrue(eRefChildren.isContainment());
		assertTrue(eRefOtherChildren.isContainment());
		assertTrue(eRefParent.isContainer());
		assertTrue(eRefOtherParent.isContainer());

		EObject container = this.createEObject(myClass);
		EObject child = this.createEObject(yourClass);

		// add a child to the container by adding it to the children reference
		((List<EObject>) container.eGet(eRefChildren)).add(child);

		// add a child to the container by setting the container as parent in the child
		child.eSet(eRefParent, container);

		assertTrue(child.eIsSet(eRefParent));
		assertFalse(child.eIsSet(eRefOtherParent));
	}

	private void createEPackageMultipleMultiplicityManyContainmentsWithMultiplicityOneOpposite() {
		EPackage ePackage = this.createNewEPackage("MyEPackage", "http://www.example.com/model", "model");
		ePackage.setName("MyPackage");

		EClass eClass = EcoreFactory.eINSTANCE.createEClass();
		eClass.setName("MyEClass");

		EClass eOtherClass = EcoreFactory.eINSTANCE.createEClass();
		eOtherClass.setName("YourEClass");

		EReference eRefChildren = EcoreFactory.eINSTANCE.createEReference();
		eRefChildren.setName("children");
		eRefChildren.setEType(eOtherClass);
		eRefChildren.setLowerBound(0);
		eRefChildren.setUpperBound(-1);
		eRefChildren.setContainment(true);
		eClass.getEStructuralFeatures().add(eRefChildren);

		EReference eRefOtherChildren = EcoreFactory.eINSTANCE.createEReference();
		eRefOtherChildren.setName("otherChildren");
		eRefOtherChildren.setEType(eOtherClass);
		eRefOtherChildren.setLowerBound(0);
		eRefOtherChildren.setUpperBound(-1);
		eRefOtherChildren.setContainment(true);
		eClass.getEStructuralFeatures().add(eRefOtherChildren);

		EReference eRefParent = EcoreFactory.eINSTANCE.createEReference();
		eRefParent.setName("parent");
		eRefParent.setLowerBound(0);
		eRefParent.setUpperBound(1);
		eRefParent.setEType(eClass);
		eRefParent.setEOpposite(eRefChildren);
		eRefChildren.setEOpposite(eRefParent);
		eOtherClass.getEStructuralFeatures().add(eRefParent);

		EReference eRefOtherParent = EcoreFactory.eINSTANCE.createEReference();
		eRefOtherParent.setName("otherParent");
		eRefOtherParent.setLowerBound(0);
		eRefOtherParent.setUpperBound(1);
		eRefOtherParent.setEType(eClass);
		eRefOtherParent.setEOpposite(eRefOtherChildren);
		eRefOtherChildren.setEOpposite(eRefOtherParent);
		eOtherClass.getEStructuralFeatures().add(eRefOtherParent);

		ePackage.getEClassifiers().add(eClass);
		ePackage.getEClassifiers().add(eOtherClass);
		this.registerEPackages(ePackage);
	}

}

A couple of questions about Chronograph

Hello,

This isn't an issue, but more of an FAQ concerning Chronograph. See below for my questions:

  1. Do I have to use Java or can I use the Gremlin Query Language instead?

  2. Is this the only known-solution for time-based versioned-graph? (if there are others that you know of, can you please share?)

  3. (This is a bit of a longer question) Does this software address the friends of friends/ people you may know concept that you find on social media (via graphs).

eg. A is friends with B - January: March
      B (friends) C - January: June
      C (friends) D - February: July
      C (friends) F - Jan: September
      E (friends) F - March: August

  -> In February: C can be suggested as someone A can befriend (1 position away, via B)
  -> In April: C cannot be suggested as friend of A (1-position away)
  -> In Feb: D can be suggested friend of A (2 positions away)
  -> In April: D cannot be suggested friend of A (2-positions)
  -> February: A befriends C:
    --> February: F (1-position) can be friend to A
    --> February: E (2-positions) cannot be suggested to A
    --> April: E (2-positions) can be suggested to be friends with A

Using Chronograph, will I be able to make queries to know when a person could be friends with A, based on the time of the query? (eg. check who can be friend of A in April )

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.