Unverified Commit 7e3b18b4 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman 💥
Browse files

docs: updated documentation in preperation for release.

parent e52986f2
......@@ -68,7 +68,7 @@ To include Ferma in your project of choice include the following Maven dependenc
<dependency>
<groupId>com.syncleus.ferma</groupId>
<artifactId>ferma</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
</dependency>
```
......
......@@ -22,7 +22,7 @@ In untyped mode there is no automatic typing. Whatever class is explicitly indic
instantiated when performing queries. Lets start with a simple example domain.
```java
public class Person extends VertexFrame {
public class Person extends AbstractVertexFrame {
public String getName() {
return getProperty("name");
}
......@@ -36,11 +36,11 @@ public class Person extends VertexFrame {
}
public Knows addKnows(Person friend) {
return addEdge("knows", friend, Knows.class);
return addFramedEdge("knows", friend, Knows.class);
}
}
public class Knows extends EdgeFrame {
public class Knows extends AbstractEdgeFrame {
public void setYears(int years) {
setProperty("years", years);
}
......@@ -55,10 +55,10 @@ And here is how you interact with the framed elements:
```java
public void testUntyped() {
Graph g = new TinkerGraph();
Graph graph = TinkerGraph.open();
// implies untyped mode
FramedGraph fg = new DelegatingFramedGraph(g);
FramedGraph fg = new DelegatingFramedGraph(graph);
Person p1 = fg.addFramedVertex(Person.class);
p1.setName("Jeff");
......@@ -88,25 +88,25 @@ Say we extend the Person class with the Programmer class.
public class Programmer extends Person {
}
```
Using simple mode will save the type of Java class the element was created with for use later:
```java
public void testSimpleTyping() {
Graph g = new TinkerGraph();
Graph graph = TinkerGraph.open();
// implies simple mode
FramedGraph fg = new DelegatingFramedGraph(g, true, false);
FramedGraph fg = new DelegatingFramedGraph(graph, true, false);
Person p1 = fg.addFramedVertex(Programmer.class);
p1.setName("Jeff");
Person p2 = fg.addFramedVertex(Person.class);
p2.setName("Julia");
Person jeff = fg.traverse((g) -> g.V().has("name", "Jeff")).next(Person.class);
Person julia = fg.traverse((g) -> g.V().has("name", "Julia")).next(Person.class);
Assert.assertEquals(Programmer.class, jeff.getClass());
Assert.assertEquals(Person.class, julia.getClass());
}
......@@ -123,28 +123,28 @@ power to determine parent-child relationships at run time.
The same example as above done with annotations would look something like this.
```java
public abstract class Person extends VertexFrame {
public abstract class Person extends AbstractVertexFrame {
@Property("name")
public abstract String getName();
@Property("name")
public abstract void setName(String name);
@Adjacency("knows")
public abstract Iterator<Person>; getKnowsPeople();
@Adjacency(label = "knows")
public abstract List<Person> getKnowsPeople();
@Incidence("knows")
public abstract Iterator<Knows> getKnows();
@Incidence(label = "knows")
public abstract List<Knows> getKnows();
@Incidence("knows")
@Incidence(label = "knows")
public abstract Knows addKnows(Person friend);
public List<Person> getFriendsNamedBill() {
return traverse((v) -> v.out("knows").has("name", "bill").toList(Person.class);
public List<? extends Person> getFriendsNamedBill() {
return this.traverse(input -> input.out("knows").has("name", "bill")).toList(Person.class);
}
}
public abstract class Knows extends EdgeFrame {
public abstract class Knows extends AbstractEdgeFrame {
@Property("years")
public abstract void setYears(int years);
......@@ -155,7 +155,7 @@ public abstract class Knows extends EdgeFrame {
public abstract Person getIn();
@OutVertex
public abstract Person getIn();
public abstract Person getOut();
}
public abstract class Programmer extends Person {
......@@ -169,24 +169,25 @@ construct the byte code for any abstract annotated methods.
```java
public void testAnnotatedTyping() {
Set<Class<?>> types = new HashSet<Class<?>>(Arrays.asList(new Class<?>[]{
Person.class,
Programmer.class,
Knows.class}));
Graph g = new TinkerGraph();
Person.class,
Programmer.class,
Knows.class}));
Graph graph = TinkerGraph.open();
//implies annotated mode
FramedGraph fg = new DelegatingFramedGraph(g, true, types);
FramedGraph fg = new DelegatingFramedGraph(graph, true, types);
Person p1 = fg.addFramedVertex(Programmer.class);
p1.setName("Jeff");
Person jeff = fg.addFramedVertex(Programmer.class);
jeff.setName("Jeff");
Person p2 = fg.addFramedVertex(Person.class);
p2.setName("Julia");
Person julia = fg.addFramedVertex(Person.class);
julia.setName("Julia");
julia.addKnows(jeff);
Person jeff = fg.traverse((g) -> g.V().has("name", "Jeff")).next(Person.class);
Person julia = fg.traverse((g) -> g.V().has("name", "Julia")).next(Person.class);
Person juliaAgain = fg.traverse((g) -> g.V().has("name", "Julia")).next(Person.class);
Person jeffAgain = juliaAgain.getKnowsPeople().get(0);
Assert.assertEquals(Programmer.class, jeff.getClass());
Assert.assertEquals(Person.class, julia.getClass());
Assert.assertTrue(Programmer.class.isAssignableFrom(jeffAgain.getClass()));
Assert.assertTrue(Person.class.isAssignableFrom(juliaAgain.getClass()));
}
```
......@@ -62,6 +62,7 @@ including the following.
Ferma Javadocs:
[latest](http://www.javadoc.io/doc/com.syncleus.ferma/ferma) -
[3.2.0](http://www.javadoc.io/doc/com.syncleus.ferma/ferma/3.2.0) -
[3.1.0](http://www.javadoc.io/doc/com.syncleus.ferma/ferma/3.1.0) -
[3.0.3](http://www.javadoc.io/doc/com.syncleus.ferma/ferma/3.0.3) -
[3.0.2](http://www.javadoc.io/doc/com.syncleus.ferma/ferma/3.0.2) -
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment