You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2011/06/30 23:46:11 UTC

svn commit: r1141735 - in /incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src: main/scala/org/apache/clerezza/rdf/scala/utils/ test/scala/org/apache/clerezza/rdf/scala/utils/

Author: reto
Date: Thu Jun 30 21:46:11 2011
New Revision: 1141735

URL: http://svn.apache.org/viewvc?rev=1141735&view=rev
Log:
CLEREZZA-510: added ascii arrow syntax to RichGraphNode

Modified:
    incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/AltStyles.scala
    incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala
    incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala
    incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala

Modified: incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/AltStyles.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/AltStyles.scala?rev=1141735&r1=1141734&r2=1141735&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/AltStyles.scala (original)
+++ incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/AltStyles.scala Thu Jun 30 21:46:11 2011
@@ -1,226 +1,227 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.clerezza.rdf.scala.utils
-
-import java.math.BigInteger
-import java.lang.Boolean
-import java.net.{URL, URI}
-import org.apache.clerezza.rdf.ontologies.{XSD, RDF}
-import java.util.Date
-import collection.mutable.{ListBuffer, HashMap}
-import org.apache.clerezza.rdf.utils.{GraphNode, UnionMGraph}
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.rdf.core.impl._
-
-/**
- * Alternative method names for some RichGraphNode methods allowing alternative
- * DSL syntaxes
- */
-class AltStyles {
-
-}
-
-/**
- * import your preferred writing styles into your code
- */
-object EzStyleChoice {
-	implicit val unicode = new EzStyle[EzGraphNodeU](){
-		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeU = new EzGraphNodeU(ref,tc)
-	}
-	implicit val arrow = new EzStyle[EzGraphNodeA](){
-		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeA = new EzGraphNodeA(ref,tc)
-	}
-   implicit val english = new EzStyle[EzGraphNodeEn](){
-		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeEn = new EzGraphNodeEn(ref,tc)
-	}
-
-
-}
-
-
-
-/**
- * Unicode arrow notation for EzGraphNode. Very clean, short and efficient, but unicode values may not
- * be available everywhere yet.
- *
- * Because of operator binding rules all the mathematical operators  bind the strongest. This means that
- * anything outside of these operators should be put into brackets or use dot notation if you wish them to
- * bind more tightly.
- *
- *
- * @prefix graph: should this be an MGraph, since the EzGraphNode is really designed for editing
- *
- */
-class EzGraphNodeU(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
-	//
-	// symbolic notation
-	//
-	// (shorter and more predictable precedence rules, but unicode issues)
-
-	type T_Pred = PredicateU
-	type T_InvP = InversePredicateU
-	type T_EzGN = EzGraphNodeU
-
-	override def make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeU(ref,graph)
-	override def predicate(rel: UriRef) = new PredicateU(rel)
-	override def inverse(rel: UriRef) = new InversePredicateU(rel)
-
-	/**
-	 * relate the subject via the given relation to....
-	 */
-	def ⟝(rel: UriRef) = predicate(rel)
-
-	/**
-	 * relate the subject via the given relation to....
-	 */
-	def ⟝(rel: String) = predicate(new UriRef(rel))
-
-	/**
-	 * relate the subject via the inverse of the given relation to....
-	 */
-	def ⟵(rel: UriRef) = inverse(rel)
-
-	/**
-	 * the subject is a member of the given class
-	 */
-	def ∈(rdfclass: UriRef) = a(rdfclass)
-
-
-	class InversePredicateU(rel: UriRef) extends InversePredicate(rel) {
-		/**
-		 * ...to the following non literal
-		 */
-		def ⟞(subj: NonLiteral) = add(subj)
-
-		/**
-		 * ...to the following resource (given as a string)
-		 */
-		def ⟞(uri: String) = add(new UriRef(uri))
-
-		/**
-		 * ...to the following EzGraphNode
-		 * (useful for opening a new parenthesis and specifying other things in more detail
-		 */
-		def ⟞(sub: EzGraphNodeU)  = addGN(sub)
-	}
-
-	class PredicateU(rel: UriRef) extends Predicate(rel) {
-
-		/**
-		 * ...to the following resource
-		 */
-		def ⟶(obj: Resource) = add(obj)
-
-		/**
-		 * ...to the following list as an RDF List
-		 */
-		def ⟶(list: List[Resource]) = addList(list)
-
-		/**
-		 * Add one relation for each member of the iterable collection
-		 */
-		def ⟶*[T <: Resource](objs: Iterable[T]) = addMany(objs)
-
-		/**
-		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
-		 */
-		def ⟶(sub: EzGraphNode) = addEG(sub)
-
-	}
-
-
-}
-
-/**
- * English language looking Notation for EzGraphNode. This feels gives somewhat awkward
- * english, but the operator binding priorities for ascii named operators is the weakest, which
- * means that one needs very few parenthesis when writing out the code as all other operators bind
- * more tightly.
- */
-class EzGraphNodeEn(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
-
-	type T_Pred = PredicateEn
-	type T_InvP = InversePredicateEn
-	type T_EzGN = EzGraphNodeEn
-
-	override protected def make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeEn(ref,graph)
-	override protected def predicate(rel: UriRef) = new PredicateEn(rel)
-	override protected def inverse(rel: UriRef) = new InversePredicateEn(rel)
-
-	/**
-	 * the subject has the given relation to....
-	 */
-	def has(rel: UriRef) = predicate(rel)
-
-	/**
-	 * the subject has the given relation (specified as string) to....
-	 */
-	def has(rel: String) = predicate(new UriRef(rel))
-
-	/**
-	 * the subject is the inverse relation of ...
-	 */
-	def is(rel: UriRef) = inverse(rel)
-
-	class InversePredicateEn(rel: UriRef) extends InversePredicate(rel) {
-
-
-		/**
-		  * ...the following non literal
-		  */
-		def of(subj: NonLiteral) = add(subj)
-
-		/**
-		  * ...the following resource (as String)
-		  */
-		def of(subj: String) = add(new UriRef(subj))
-
-		/**
-		  * ...the following EzGraphNode - useful for opening a new bracket
-		  */
-		def of(subj: EzGraphNode) = addGN(subj)
-	}
-
-	class PredicateEn(rel: UriRef) extends Predicate(rel) {
-
-
-		/**
-		 * ...to the following resource
-		 */
-		def to(obj: Resource) = add(obj)
-
-		/**
-		 * ...to the following RDF list
-		 */
-		def to(list: List[Resource]) = addList(list)
-
-		/**
-		 * ... each of the members of the iterable collection
-		 */
-		def toEach[T <: Resource](objs: Iterable[T]) = addMany(objs)
-
-		/**
-		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
-		 */
-		def to(sub: EzGraphNode) = addEG(sub)
-
-	}
-
-}
\ No newline at end of file
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements.  See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership.  The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License.  You may obtain a copy of the License at
+// *
+// *    http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied.  See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// */
+//
+//package org.apache.clerezza.rdf.scala.utils
+//
+//import java.math.BigInteger
+//import java.lang.Boolean
+//import java.net.{URL, URI}
+//import org.apache.clerezza.rdf.ontologies.{XSD, RDF}
+//import java.util.Date
+//import collection.mutable.{ListBuffer, HashMap}
+//import org.apache.clerezza.rdf.utils.{GraphNode, UnionMGraph}
+//import org.apache.clerezza.rdf.core._
+//import org.apache.clerezza.rdf.core.impl._
+//
+///**
+// * Alternative method names for some RichGraphNode methods allowing alternative
+// * DSL syntaxes. This works by dynamically converting RichGraphNode, Predicate
+// * and InversePredicate to objects supporting the specific syntax / methods
+// */
+//class AltStyles {
+//
+//}
+//
+///**
+// * import your preferred writing styles into your code
+// */
+//object EzStyleChoice {
+//	implicit val unicode = new EzStyle[EzGraphNodeU](){
+//		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeU = new EzGraphNodeU(ref,tc)
+//	}
+//	implicit val arrow = new EzStyle[EzGraphNodeA](){
+//		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeA = new EzGraphNodeA(ref,tc)
+//	}
+//   implicit val english = new EzStyle[EzGraphNodeEn](){
+//		override def preferred(ref: NonLiteral, tc: TripleCollection): EzGraphNodeEn = new EzGraphNodeEn(ref,tc)
+//	}
+//
+//
+//}
+//
+//
+//
+///**
+// * Unicode arrow notation for EzGraphNode. Very clean, short and efficient, but unicode values may not
+// * be available everywhere yet.
+// *
+// * Because of operator binding rules all the mathematical operators  bind the strongest. This means that
+// * anything outside of these operators should be put into brackets or use dot notation if you wish them to
+// * bind more tightly.
+// *
+// *
+// * @prefix graph: should this be an MGraph, since the EzGraphNode is really designed for editing
+// *
+// */
+//class EzGraphNodeU(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
+//	//
+//	// symbolic notation
+//	//
+//	// (shorter and more predictable precedence rules, but unicode issues)
+//
+//	type T_Pred = PredicateU
+//	type T_InvP = InversePredicateU
+//	type T_EzGN = EzGraphNodeU
+//
+//	override def make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeU(ref,graph)
+//	override def predicate(rel: UriRef) = new PredicateU(rel)
+//	override def inverse(rel: UriRef) = new InversePredicateU(rel)
+//
+//	/**
+//	 * relate the subject via the given relation to....
+//	 */
+//	def ⟝(rel: UriRef) = predicate(rel)
+//
+//	/**
+//	 * relate the subject via the given relation to....
+//	 */
+//	def ⟝(rel: String) = predicate(new UriRef(rel))
+//
+//	/**
+//	 * relate the subject via the inverse of the given relation to....
+//	 */
+//	def ⟵(rel: UriRef) = inverse(rel)
+//
+//	/**
+//	 * the subject is a member of the given class
+//	 */
+//	def ∈(rdfclass: UriRef) = a(rdfclass)
+//
+//
+//	class InversePredicateU(rel: UriRef) extends InversePredicate(rel) {
+//		/**
+//		 * ...to the following non literal
+//		 */
+//		def ⟞(subj: NonLiteral) = add(subj)
+//
+//		/**
+//		 * ...to the following resource (given as a string)
+//		 */
+//		def ⟞(uri: String) = add(new UriRef(uri))
+//
+//		/**
+//		 * ...to the following EzGraphNode
+//		 * (useful for opening a new parenthesis and specifying other things in more detail
+//		 */
+//		def ⟞(sub: EzGraphNodeU)  = addGN(sub)
+//	}
+//
+//	class PredicateU(rel: UriRef) extends Predicate(rel) {
+//
+//		/**
+//		 * ...to the following resource
+//		 */
+//		def ⟶(obj: Resource) = add(obj)
+//
+//		/**
+//		 * ...to the following list as an RDF List
+//		 */
+//		def ⟶(list: List[Resource]) = addList(list)
+//
+//		/**
+//		 * Add one relation for each member of the iterable collection
+//		 */
+//		def ⟶*[T <: Resource](objs: Iterable[T]) = addMany(objs)
+//
+//		/**
+//		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
+//		 */
+//		def ⟶(sub: EzGraphNode) = addEG(sub)
+//
+//	}
+//
+//
+//}
+//
+///**
+// * English language looking Notation for EzGraphNode. This feels gives somewhat awkward
+// * english, but the operator binding priorities for ascii named operators is the weakest, which
+// * means that one needs very few parenthesis when writing out the code as all other operators bind
+// * more tightly.
+// */
+//class EzGraphNodeEn(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
+//
+//	type T_Pred = PredicateEn
+//	type T_InvP = InversePredicateEn
+//	type T_EzGN = EzGraphNodeEn
+//
+//	override protected def make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeEn(ref,graph)
+//	override protected def predicate(rel: UriRef) = new PredicateEn(rel)
+//	override protected def inverse(rel: UriRef) = new InversePredicateEn(rel)
+//
+//	/**
+//	 * the subject has the given relation to....
+//	 */
+//	def has(rel: UriRef) = predicate(rel)
+//
+//	/**
+//	 * the subject has the given relation (specified as string) to....
+//	 */
+//	def has(rel: String) = predicate(new UriRef(rel))
+//
+//	/**
+//	 * the subject is the inverse relation of ...
+//	 */
+//	def is(rel: UriRef) = inverse(rel)
+//
+//	class InversePredicateEn(rel: UriRef) extends InversePredicate(rel) {
+//
+//
+//		/**
+//		  * ...the following non literal
+//		  */
+//		def of(subj: NonLiteral) = add(subj)
+//
+//		/**
+//		  * ...the following resource (as String)
+//		  */
+//		def of(subj: String) = add(new UriRef(subj))
+//
+//		/**
+//		  * ...the following EzGraphNode - useful for opening a new bracket
+//		  */
+//		def of(subj: EzGraphNode) = addGN(subj)
+//	}
+//
+//	class PredicateEn(rel: UriRef) extends Predicate(rel) {
+//
+//
+//		/**
+//		 * ...to the following resource
+//		 */
+//		def to(obj: Resource) = add(obj)
+//
+//		/**
+//		 * ...to the following RDF list
+//		 */
+//		def to(list: List[Resource]) = addList(list)
+//
+//		/**
+//		 * ... each of the members of the iterable collection
+//		 */
+//		def toEach[T <: Resource](objs: Iterable[T]) = addMany(objs)
+//
+//		/**
+//		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
+//		 */
+//		def to(sub: EzGraphNode) = addEG(sub)
+//
+//	}
+//
+//}
\ No newline at end of file

Modified: incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala?rev=1141735&r1=1141734&r2=1141735&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala (original)
+++ incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala Thu Jun 30 21:46:11 2011
@@ -36,13 +36,6 @@ object EzGraph {
 
 }
 
-/**
- * A way to select one's preferred writing style
- */
-abstract class EzStyle[T<:EzGraphNode]() {
-	def preferred(ref: NonLiteral, tc: TripleCollection):T
-}
-
 
 /**
  * EzGraph enhances graph writing. Used together with EzGraphNode, it can make writing rdf graphs in code a lot more
@@ -72,40 +65,40 @@ class EzGraph(val baseTc: MGraph) extend
 	/**
 	 * create a new bnode based EzGraphNode with the preferred writing style
 	 */
-	def bnode[T<: EzGraphNode](implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
-		node(new BNode)(writingStyle)
-	}
-
-	val namedBnodes = new HashMap[String,BNode]
-
-	/**
-	 * create a new named bnode based EzGraphNode with the preferred writing style
-	 */
-	def b_[T<: EzGraphNode](name: String)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow): T = {
-		namedBnodes.get(name) match {
-			case Some(bnode) => writingStyle.preferred(bnode,baseTc)
-			case None => {
-				val bn = new BNode
-				namedBnodes.put(name, bn);
-				writingStyle.preferred(bn,baseTc)
-			}
-		}
-	}
-
-	/**
-	 * create a new url based EzGraphNode with the preferred writing style
-	 */
-	def u[T<: EzGraphNode](url: String)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow): T = {
-		node(new UriRef(url))(writingStyle)
-	}
+//	def bnode[T<: EzGraphNode](implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
+//		node(new BNode)(writingStyle)
+//	}
+//
+//	val namedBnodes = new HashMap[String,BNode]
+//
+//	/**
+//	 * create a new named bnode based EzGraphNode with the preferred writing style
+//	 */
+//	def b_[T<: EzGraphNode](name: String)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow): T = {
+//		namedBnodes.get(name) match {
+//			case Some(bnode) => writingStyle.preferred(bnode,baseTc)
+//			case None => {
+//				val bn = new BNode
+//				namedBnodes.put(name, bn);
+//				writingStyle.preferred(bn,baseTc)
+//			}
+//		}
+//	}
 
-	/**
-	 * create a new Resource based EzGraphNode with the preferred writing style.
-	 * The EzGraphNode will contain the graph that this EzGraph is built on and point to the given subj
-	 */
-	def node[T<: EzGraphNode](subj: NonLiteral)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
-	 	writingStyle.preferred(subj,baseTc)
-	}
+//	/**
+//	 * create a new url based EzGraphNode with the preferred writing style
+//	 */
+//	def u[T<: EzGraphNode](url: String)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow): T = {
+//		node(new UriRef(url))(writingStyle)
+//	}
+//
+//	/**
+//	 * create a new Resource based EzGraphNode with the preferred writing style.
+//	 * The EzGraphNode will contain the graph that this EzGraph is built on and point to the given subj
+//	 */
+//	def node[T<: EzGraphNode](subj: NonLiteral)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
+//	 	writingStyle.preferred(subj,baseTc)
+//	}
 
 	/**
 	 * Add a a relation
@@ -162,77 +155,77 @@ class EzGraph(val baseTc: MGraph) extend
     ending in a colon ‘:’ are right-associative. All other operators are leftassociative.
  </blockquote>
  */
-class EzGraphNodeA(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
-
-	type T_Pred = PredicateA
-	type T_InvP = InversePredicateA
-	type T_EzGN = EzGraphNodeA
-
-	override protected def  make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeA(ref,graph)
-	override protected def  predicate(rel: UriRef) = new PredicateA(rel)
-	override protected def  inverse(rel: UriRef) = new InversePredicateA(rel)
-
-	/**
-	 * relate the subject via the given relation to....
-	 */
-	def --(rel: UriRef) = predicate(rel)
-
-	/**
-	 * relate the subject via the given (expressed as string) relation to....
-	 */
-	def --(rel: String) = predicate(new UriRef(rel))
-
-	/**
-	 * relate the subject via the inverse of the given relation to....
-	 * note: we can't have <-- as that messes up the balance of precedence
-	 */
-	def -<-(rel: UriRef) = inverse(rel)
-
-	class PredicateA(rel: UriRef) extends Predicate(rel) {
-		/**
-		 * ...to the following non resource
-		 */
-		def -->(obj: Resource) = add(obj)
-
-
-		/**
-		 * Adds a relation to a real linked list.
-		 * If you want one relation to each entry use -->> or ⟶*
-		 */
-		def -->(list: List[Resource]) = addList(list)
-
-		/**
-		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
-		 */
-		def -->(sub: EzGraphNode) = addEG(sub)
-
-		/**
-		 * Add one relation for each member of the iterable collection
-		 */
-		def -->>[T <: Resource](uris: Iterable[T]) = addMany(uris)
-
-
-	}
-
-	class InversePredicateA(ref: UriRef) extends InversePredicate(ref) {
-		/**
-		 * ...to the following non literal
-		 */
-		def --(subj: NonLiteral) = add(subj)
-		/**
-		 * ...to the following resource (given as a string)
-		 */
-		def --(subj: String) = add(new UriRef(subj))
-
-		/**
-		 * ...to the following EzGraphNode
-		 * (useful for opening a new parenthesis and specifying other things in more detail
-		 */
-		def --(subj: EzGraphNode) = addGN(subj)
-		// since we can only have inverses from non literals (howto deal with bndoes?)
-	}
+//class EzGraphNodeA(ref: NonLiteral, graph: TripleCollection) extends EzGraphNode(ref, graph) {
+//
+//	type T_Pred = PredicateA
+//	type T_InvP = InversePredicateA
+//	type T_EzGN = EzGraphNodeA
+//
+//	override protected def  make(ref: NonLiteral, graph: TripleCollection) = new EzGraphNodeA(ref,graph)
+//	override protected def  predicate(rel: UriRef) = new PredicateA(rel)
+//	override protected def  inverse(rel: UriRef) = new InversePredicateA(rel)
+//
+//	/**
+//	 * relate the subject via the given relation to....
+//	 */
+//	def --(rel: UriRef) = predicate(rel)
+//
+//	/**
+//	 * relate the subject via the given (expressed as string) relation to....
+//	 */
+//	def --(rel: String) = predicate(new UriRef(rel))
+//
+//	/**
+//	 * relate the subject via the inverse of the given relation to....
+//	 * note: we can't have <-- as that messes up the balance of precedence
+//	 */
+//	def -<-(rel: UriRef) = inverse(rel)
+//
+//	class PredicateA(rel: UriRef) extends Predicate(rel) {
+//		/**
+//		 * ...to the following non resource
+//		 */
+//		def -->(obj: Resource) = add(obj)
+//
+//
+//		/**
+//		 * Adds a relation to a real linked list.
+//		 * If you want one relation to each entry use -->> or ⟶*
+//		 */
+//		//def -->(list: List[Resource]) = addList(list)
+//
+//		/**
+//		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
+//		 */
+//		def -->(sub: EzGraphNode) = addEG(sub)
+//
+//		/**
+//		 * Add one relation for each member of the iterable collection
+//		 */
+//		def -->>[T <: Resource](uris: Iterable[T]) = addMany(uris)
+//
+//
+//	}
+//
+//	class InversePredicateA(ref: UriRef) extends InversePredicate(ref) {
+//		/**
+//		 * ...to the following non literal
+//		 */
+//		def --(subj: NonLiteral) = add(subj)
+//		/**
+//		 * ...to the following resource (given as a string)
+//		 */
+//		def --(subj: String) = add(new UriRef(subj))
+//
+//		/**
+//		 * ...to the following EzGraphNode
+//		 * (useful for opening a new parenthesis and specifying other things in more detail
+//		 */
+//		def --(subj: EzGraphNode) = addGN(subj)
+//		// since we can only have inverses from non literals (howto deal with bndoes?)
+//	}
 
-}
+//}
 
 
 /**
@@ -253,112 +246,17 @@ abstract class EzGraphNode(val ref: NonL
 		this
 	}*/
 
-	type T_Pred <: Predicate
-	type T_InvP <: InversePredicate
-	type T_EzGN <: EzGraphNode
-
-	protected def predicate(rel: UriRef): T_Pred
-	protected def inverse(rel: UriRef): T_InvP
-	protected def make(ref: NonLiteral, graph: TripleCollection): T_EzGN
-
-	/** is an instance of the given class */
-	def a(rdfclass: UriRef): T_EzGN = {
-		graph.add(new TripleImpl(ref, RDF.`type`, rdfclass))
-		return this.asInstanceOf[T_EzGN]
-	}
-
-	/*
-	 * create an EzGraphNode from this one where the backing graph is protected from writes by a new
-	 * SimpleGraph.
-	 */
-	def protect(): T_EzGN = make(ref, new UnionMGraph(new SimpleMGraph(), graph))
-
-	def this(s: NonLiteral) = this (s, new SimpleMGraph())
-
-	def this() = this (new BNode)
 
-	/** class for Inverse relations with the current EzGraphNode.ref as object */
-	abstract class InversePredicate(rel: UriRef) {
-
-		protected def addGN(subj: EzGraphNode) = {
-			//EzGraphNode.this + subj
-			add(subj.ref)
-		}
-
-		protected def add(subj: NonLiteral) = {
-			graph.add(new TripleImpl(subj, rel, ref))
-			EzGraphNode.this.asInstanceOf[T_EzGN]
-		}
-	}
-
-	/**
-	 *  class for relations with the current EzGraphNode.ref as subject
-	 */
-	abstract class Predicate(rel: UriRef) {
-
-		protected def add(obj: Resource): T_EzGN = {
-			addTriple(obj)
-			EzGraphNode.this.asInstanceOf[T_EzGN]
-		}
-
-		protected def addTriple(obj: Resource) {
-			graph.add(new TripleImpl(ref, rel, obj))
-		}
-
-		protected def addMany[T<:Resource](uris: Iterable[T]): T_EzGN = {
-			for (u <- uris) addTriple(u)
-			EzGraphNode.this.asInstanceOf[T_EzGN]
-		}
-
-		protected def addEG(sub: EzGraphNode): T_EzGN = {
-			//EzGraphNode.this + sub
-			add(sub.ref)
-		}
-
-		private def toTriples[T <: Resource](head: NonLiteral,list : List[T]): List[Triple] = {
-			val answer = new ListBuffer[Triple]
-			var varList = list
-			var headRef = head
-			while (varList != Nil) {
-				varList = varList match {
-					case head :: next :: rest => {
-						val nextRef = new BNode
-						answer.append(new TripleImpl(headRef, RDF.first, head))
-						answer.append(new TripleImpl(headRef, RDF.rest, nextRef))
-						headRef = nextRef
-						next :: rest
-					}
-					case head :: Nil => {
-						answer.append(new TripleImpl(headRef, RDF.first, head))
-						answer.append(new TripleImpl(headRef, RDF.rest, RDF.nil))
-						Nil
-					}
-					case Nil => Nil
-				}
-			}
-			answer.toList
-		}
-
-
-		protected def addList[T <: Resource](list: List[T]) = {
-			val headNode = new BNode
-			addTriple(headNode)
-		   val tripleLst = toTriples(headNode,list);
-			graph.add(new TripleImpl(headNode,RDF.`type`,RDF.List))
-			graph.addAll(collection.JavaConversions.asJavaCollection(tripleLst))
-			EzGraphNode.this.asInstanceOf[T_EzGN]
-		}
-
-	}
+	
 
 }
 
-object EzGraphNode {
-	/**
-	 * create a new EzGraphNode in the preferred writing style
-	 */
-	def apply[T<:EzGraphNode](ref: NonLiteral, graph: TripleCollection)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
-	 	writingStyle.preferred(ref,graph)
-	}
-}
+//object EzGraphNode {
+//	/**
+//	 * create a new EzGraphNode in the preferred writing style
+//	 */
+//	def apply[T<:EzGraphNode](ref: NonLiteral, graph: TripleCollection)(implicit writingStyle: EzStyle[T]=EzStyleChoice.arrow ): T = {
+//	 	writingStyle.preferred(ref,graph)
+//	}
+//}
 

Modified: incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala?rev=1141735&r1=1141734&r2=1141735&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala (original)
+++ incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/RichGraphNode.scala Thu Jun 30 21:46:11 2011
@@ -18,11 +18,15 @@
  */
 package org.apache.clerezza.rdf.scala.utils
 
+import org.apache.clerezza.rdf.ontologies.RDF
 import org.apache.clerezza.rdf.utils.GraphNode
 import java.util.Iterator
 import _root_.scala.collection.JavaConversions._
 import _root_.scala.reflect.Manifest
-import org.apache.clerezza.rdf.core.{TripleCollection, UriRef, Resource, Literal, TypedLiteral, LiteralFactory}
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph
+import org.apache.clerezza.rdf.core.impl.TripleImpl
+import org.apache.clerezza.rdf.core.{TripleCollection, UriRef, Resource, Literal, TypedLiteral, LiteralFactory, NonLiteral, BNode}
+import org.apache.clerezza.rdf.utils.UnionMGraph
 
 
 /**
@@ -134,6 +138,159 @@ class RichGraphNode(resource: Resource, 
 			base.remove()
 		}
 	}
+
+	//support for adding properties
+
+	protected def predicate(rel: UriRef) = new Predicate(rel)
+	protected def inverse(rel: UriRef) = new InversePredicate(rel)
+	//protected def make(ref: NonLiteral, graph: TripleCollection): RichGraphNode
+
+	/** is an instance of the given class */
+	def a(rdfclass: UriRef): RichGraphNode = {
+		addProperty(RDF.`type`, rdfclass)
+		return this
+	}
+
+	/*
+	 * create an RichGraphNode from this one where the backing graph is protected from writes by a new
+	 * SimpleGraph.
+	 */
+	def protect(): RichGraphNode = new RichGraphNode(getNode, new UnionMGraph(new SimpleMGraph(), graph))
+
+	def this(s: NonLiteral) = this (s, new SimpleMGraph())
+
+	def this() = this (new BNode)
+
+
+	/**
+	 * relate the subject via the given relation to....
+	 */
+	def --(rel: UriRef) = predicate(rel)
+
+	/**
+	 * relate the subject via the given (expressed as string) relation to....
+	 */
+	def --(rel: String) = predicate(new UriRef(rel))
+
+	/**
+	 * relate the subject via the inverse of the given relation to....
+	 * note: we can't have <-- as that messes up the balance of precedence
+	 */
+	def -<-(rel: UriRef) = inverse(rel)
+
+
+	/** class for Inverse relations with the current RichGraphNode.ref as object */
+	//TODO add support for adding many for symmetry reasons
+	class InversePredicate(rel: UriRef) {
+
+		protected def add(subj: RichGraphNode): RichGraphNode = {
+			//RichGraphNode.this + subj
+			add(subj.getNode.asInstanceOf[NonLiteral])
+		}
+
+		protected def add(subj: NonLiteral): RichGraphNode = {
+			RichGraphNode.this.addInverseProperty(rel, subj)
+			RichGraphNode.this
+		}
+
+		/**
+		 * ...to the following non literal
+		 */
+		def --(subj: NonLiteral) = add(subj)
+		/**
+		 * ...to the following resource (given as a string)
+		 */
+		def --(subj: String) = add(new UriRef(subj))
+
+		/**
+		 * ...to the following EzGraphNode
+		 * (useful for opening a new parenthesis and specifying other things in more detail
+		 */
+		def --(subj: EzGraphNode) = add(subj)
+		// since we can only have inverses from non literals (howto deal with bndoes?)
+	}
+
+	/**
+	 *  class for relations with the current RichGraphNode.ref as subject
+	 */
+	class Predicate(rel: UriRef) {
+
+		protected def add(obj: Resource): RichGraphNode = {
+			RichGraphNode.this.addProperty(rel, obj)
+			RichGraphNode.this
+		}
+
+		/**
+		 * Add one relation for each member of the iterable collection
+		 */
+		protected def addMany[T<:Resource](uris: Iterable[T]): RichGraphNode = {
+			for (u <- uris) add(u)
+			RichGraphNode.this
+		}
+
+		protected def addEG(sub: GraphNode): RichGraphNode = {
+			//RichGraphNode.this + sub
+			add(sub.getNode)
+		}
+
+		/**
+		 * ...to the following non resource
+		 */
+		def -->(obj: Resource) = add(obj)
+
+
+		/**
+		 * Adds a relation to a real linked list.
+		 * If you want one relation to each entry use -->> or ⟶*
+		 */
+		//def -->(list: List[Resource]) = addList(list)
+
+		/**
+		 * ...to the EzGraphNode, which is useful for opening a parenthesis.
+		 */
+		def -->(sub: GraphNode) = addEG(sub)
+
+		/**
+		 * Add one relation for each member of the iterable collection
+		 */
+		def -->>[T <: Resource](uris: Iterable[T]) = addMany(uris)
+
+
+		/*private def toTriples[T <: Resource](head: NonLiteral,list : List[T]): List[Triple] = {
+			val answer = new ListBuffer[Triple]
+			var varList = list
+			var headRef = head
+			while (varList != Nil) {
+				varList = varList match {
+					case head :: next :: rest => {
+						val nextRef = new BNode
+						answer.append(new TripleImpl(headRef, RDF.first, head))
+						answer.append(new TripleImpl(headRef, RDF.rest, nextRef))
+						headRef = nextRef
+						next :: rest
+					}
+					case head :: Nil => {
+						answer.append(new TripleImpl(headRef, RDF.first, head))
+						answer.append(new TripleImpl(headRef, RDF.rest, RDF.nil))
+						Nil
+					}
+					case Nil => Nil
+				}
+			}
+			answer.toList
+		}
+
+
+		protected def addList[T <: Resource](list: List[T]) = {
+			val headNode = new BNode
+			addTriple(headNode)
+			val tripleLst = toTriples(headNode,list);
+			graph.add(new TripleImpl(headNode,RDF.`type`,RDF.List))
+			graph.addAll(collection.JavaConversions.asJavaCollection(tripleLst))
+			EzGraphNod
+		}*/
+
+	}
 }
 
 

Modified: incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala?rev=1141735&r1=1141734&r2=1141735&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala (original)
+++ incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src/test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala Thu Jun 30 21:46:11 2011
@@ -81,251 +81,265 @@ class EzGraphTest {
 		gr.getGraph
 	}
 
-	@Test
-	def simpleGraphEquality {
-		val gr = new SimpleMGraph
-
-		val reto= new BNode()
-		gr.add(new TripleImpl(reto,RDF.`type`, FOAF.Person))
-
-		import EzStyleChoice.unicode
-		val ez = EzGraph()
-		ez.bnode ∈ FOAF.Person
-
-		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
-		Assert.assertEquals("the two graphs should be equals",gr.getGraph,ez.getGraph) 
-
-	}
-
-	@Test
-	def testList {
-		val gr = new SimpleMGraph
-		val reto= new UriRef(retoUri)
-		val todoRef = new UriRef("http://clerezza.org/ex/ont/todo")
-		val holiday = "http://dbpedia.org/resource/Holiday"
-		val list = new BNode
-		val list2 = new BNode
-		val list3 = new BNode
-
-		gr.add(new TripleImpl(reto, todoRef, list ))
-		gr.add(new TripleImpl(list,RDF.`type`, RDF.List))
-		gr.add(new TripleImpl(list,RDF.first, new PlainLiteralImpl("SPARQL update support",new Language("en"))))
-		gr.add(new TripleImpl(list,RDF.rest,list2))
-		gr.add(new TripleImpl(list2,RDF.first, new PlainLiteralImpl("XSPARQL support",new Language("en"))))
-		gr.add(new TripleImpl(list2,RDF.rest,list3))
-		gr.add(new TripleImpl(list3,RDF.first, new UriRef(holiday)))
-		gr.add(new TripleImpl(list3,RDF.rest,RDF.nil))
-		gr.add(new TripleImpl(reto,RDF.`type`, FOAF.Person))
-
-		val ez = EzGraph()
-
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		import org.apache.clerezza.rdf.scala.utils.EzStyleChoice.unicode
-		( ez.u(retoUri) ∈ FOAF.Person
-			    ⟝ todoRef ⟶ List[Resource]("SPARQL update support".lang('en),"XSPARQL support".lang('en),holiday.uri))
-
-		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph, ez.getGraph) //mutable graphs cannot be compared for equality
-
-	}
-
-	@Test
-	def oneToMany {
-		val gr = new SimpleMGraph
-		val reto= new UriRef(retoUri)
-		gr.add(new TripleImpl(reto,FOAF.knows,new UriRef(henryUri)))
-		gr.add(new TripleImpl(reto,FOAF.knows,new UriRef(danbriUri)))
-
-		val ez = EzGraph()
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		//default style is now arrow
-		(ez.u(retoUri) -- FOAF.knows -->> List(henryUri.uri,danbriUri.uri))
-
-		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph,ez.getGraph)
-
-		val ez2 = EzGraph()
-		(ez2.u(retoUri)(EzStyleChoice.unicode) ⟝  FOAF.knows ⟶*  Set(danbriUri.uri,henryUri.uri))
-
-		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez2.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph,ez2.getGraph)
-
-	}
-
-	@Test
-	def langEquals {
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-
-		 val lit = new PlainLiteralImpl("SPARQL update support",new Language("en"))
-		 val lit2 =  "SPARQL update support".lang('en)
-
-		Assert.assertEquals("the two literals should be equsl",lit.hashCode(),lit2.hashCode())
-		Assert.assertEquals("the two literals should be equsl",lit,lit2)
-
-		val lit3 = new PlainLiteralImpl("Reto Bachman-Gmür",new Language("rm"))
-		val lit4 = "Reto Bachman-Gmür".lang('rm)
-
-		Assert.assertEquals("the two lang literals should have same hash",lit3.hashCode(),lit4.hashCode())
-		Assert.assertEquals("the two lang literals should be equal",lit3,lit4)
-
-
-	}
 
 	@Test
-	def uriEquals {
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		val uc = new UriRef("http://clerezza.org/")
-		val ec = "http://clerezza.org/".uri
-
-		Assert.assertEquals("the two uris should have an equal hash",uc.hashCode(),ec.hashCode())
-		Assert.assertEquals("the two uris should be equal",uc,ec)
-
-
-	}
-
-	@Test
-	def literalTester1 {
-		val n3 = """
-		@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-		<http://bblfish.net/#hjs> a foaf:Person .
-		"""
-		val n3Lit : Literal = new TypedLiteralImpl(n3,new UriRef("http://example.com/turtle"))
-	   val gr = new SimpleMGraph
-		gr.add(new TripleImpl(new BNode,OWL.sameAs,n3Lit))
-
-		import EzGraph._
-		import EzStyleChoice.unicode
-		val ez = EzGraph()
-
-		(ez.bnode ⟝  OWL.sameAs ⟶  (n3^^"http://example.com/turtle".uri))
-
-		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph, ez.getGraph)
-
-	}
-
-	@Test
-	def literalTester2 {
-		val exp = LiteralFactory.getInstance().createTypedLiteral(65537)
-		val mod= new TypedLiteralImpl(bblfishModulus,hex)
-
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		val modZ: TypedLiteral = bblfishModulus^^hex
-		val expZ: TypedLiteral = 65537
-
-		Assert.assertEquals("the two literals should have an equal hash",exp.hashCode(),expZ.hashCode())
-		Assert.assertEquals("the two literals should be equal",exp,expZ)
-
-		Assert.assertEquals("the two literals should have an equal hash",mod.hashCode(),modZ.hashCode())
-		Assert.assertEquals("the two literals should be equal",mod,modZ)
-
-	}
-
-
-	@Test
-	def usingSymbolicArrows {
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		val ez = EzGraph()
-		import EzStyleChoice.unicode //in IntelliJ this is needed for the moment to remove the red lines
-		 // example using arrows
-		 (
-		   ez.b_("reto") ∈ FOAF.Person
-			 ⟝ FOAF.name ⟶ "Reto Bachman-Gmür".lang('rm)
-			 ⟝ FOAF.title ⟶ "Mr"
-			 ⟝ FOAF.currentProject ⟶ "http://clerezza.org/".uri
-			 ⟝ FOAF.knows ⟶ (
-			     ez.u("http://bblfish.net/#hjs") ∈ FOAF.Person
-			          ⟝ FOAF.name ⟶ "Henry Story"
-			          ⟝ FOAF.currentProject ⟶ "http://webid.info/".uri
-			          ⟵ identity ⟞ (
-			              ez.bnode ∈ RSAPublicKey
-			                 ⟝ modulus ⟶ 65537
-			                 ⟝ public_exponent ⟶ (bblfishModulus^^hex) // brackets needed due to precedence
-			          )
-			          ⟝ FOAF.knows ⟶* Set(ez.b_("reto").ref,ez.b_("danny").ref)
-			 )
-			 ⟝ FOAF.knows ⟶ (
-			     ez.b_("danny") ∈ FOAF.Person
-			          ⟝ FOAF.name ⟶ "Danny Ayers".lang('en)
-		             ⟝ FOAF.knows ⟶ "http://bblfish.net/#hjs".uri //knows
-					    ⟝ FOAF.knows ⟶ ez.b_("reto")
-			 )
-		 )
-		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph)
-		ez.b_("danny") ⟝  FOAF.name ⟶  "George"
-		Assert.assertFalse("Added one more triple, so graphs should no longer be equal", tinyGraph == ez.getGraph)
-	}
-
-	@Test
-	def usingAsciiArrows {
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		import EzStyleChoice.arrow
-		 val ez = EzGraph()
-		 // example using arrows
-		 (
-		   ez.b_("reto").a(FOAF.Person)
-			 -- FOAF.name --> "Reto Bachman-Gmür".lang('rm)
-			 -- FOAF.title --> "Mr"
-			 -- FOAF.currentProject --> "http://clerezza.org/".uri
-			 -- FOAF.knows --> (
-			     ez.u("http://bblfish.net/#hjs").a(FOAF.Person)
-			          -- FOAF.name --> "Henry Story"
-			          -- FOAF.currentProject --> "http://webid.info/".uri
- 			          -<- identity -- (
-			                   ez.bnode.a(RSAPublicKey) //. notation because of precedence of operators
-			                       -- modulus --> 65537
-			                       -- public_exponent --> (bblfishModulus^^hex) // brackets needed due to precedence
-			                   )
-			          -- FOAF.knows -->> List(ez.b_("reto").ref,ez.b_("danny").ref)
-			 )
-			 -- FOAF.knows --> (ez.b_("danny").a(FOAF.Person)
-			          -- FOAF.name --> "Danny Ayers".lang('en)
-		             -- FOAF.knows --> "http://bblfish.net/#hjs".uri //knows
-					    -- FOAF.knows --> ez.b_("reto")
-			 )
-		 )
-		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph)
-		ez.b_("danny") -- FOAF.name --> "George"
-		//Assert.assertNotSame("Added one more triple, so graphs should no longer be equal",tinyGraph,ez.graph)
-
-	}
-
-
-	@Test
-	def usingWordOperators {
-		import org.apache.clerezza.rdf.scala.utils.EzGraph._
-		import EzStyleChoice.english
-
-		 val ez = EzGraph()
-		 // example using arrows
-		 (
-		   ez.b_("reto").asInstanceOf[EzGraphNodeEn] a FOAF.Person
-			 has FOAF.name to "Reto Bachman-Gmür".lang('rm)
-			 has FOAF.title to "Mr"
-			 has FOAF.currentProject to "http://clerezza.org/".uri
-			 has FOAF.knows to (
-			     ez.u("http://bblfish.net/#hjs") a FOAF.Person
-			          has FOAF.name to "Henry Story"
-			          has FOAF.currentProject to "http://webid.info/".uri
- 			          is identity of (
-			                   ez.bnode a RSAPublicKey //. notation because of precedence of operators
-			                       has modulus to 65537
-			                       has public_exponent to bblfishModulus^^hex // brackets needed due to precedence
-			                   )
-			          has FOAF.knows toEach List(ez.b_("reto").ref,ez.b_("danny").ref)
-			 )
-			 has FOAF.knows to ( ez.b_("danny") a FOAF.Person
-			          has FOAF.name to "Danny Ayers".lang('en)
-		             has FOAF.knows to "http://bblfish.net/#hjs".uri //knows
-					    has FOAF.knows to ez.b_("reto")
-			 )
-		 )
-		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
-		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph) //mutable graphs cannot be compared for equality
-		ez.b_("danny") has FOAF.name to "George"
-		//Assert.assertNotSame("Added one more triple, so graphs should no longer be equal",tinyGraph,ez.getGraph)
-
-	}
+	def singleTriple {
+		val expected = {
+			val s = new SimpleMGraph
+			s.add(new TripleImpl(henryUri.uri, FOAF.knows, retoUri.uri))
+			s.getGraph
+		}
+		val ez = new EzGraph() {
+			henryUri.uri -- FOAF.knows --> retoUri.uri
+		}
+		Assert.assertEquals("The wto graphs should be equals", expected, ez.getGraph)
+	}
+
+//	@Test
+//	def simpleGraphEquality {
+//		val gr = new SimpleMGraph
+//
+//		val reto= new BNode()
+//		gr.add(new TripleImpl(reto,RDF.`type`, FOAF.Person))
+//
+//		//import EzStyleChoice.unicode
+//		val ez = EzGraph()
+//		ez.bnode ∈ FOAF.Person
+//
+//		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
+//		Assert.assertEquals("the two graphs should be equals",gr.getGraph,ez.getGraph)
+//
+//	}
+//
+//	@Test
+//	def testList {
+//		val gr = new SimpleMGraph
+//		val reto= new UriRef(retoUri)
+//		val todoRef = new UriRef("http://clerezza.org/ex/ont/todo")
+//		val holiday = "http://dbpedia.org/resource/Holiday"
+//		val list = new BNode
+//		val list2 = new BNode
+//		val list3 = new BNode
+//
+//		gr.add(new TripleImpl(reto, todoRef, list ))
+//		gr.add(new TripleImpl(list,RDF.`type`, RDF.List))
+//		gr.add(new TripleImpl(list,RDF.first, new PlainLiteralImpl("SPARQL update support",new Language("en"))))
+//		gr.add(new TripleImpl(list,RDF.rest,list2))
+//		gr.add(new TripleImpl(list2,RDF.first, new PlainLiteralImpl("XSPARQL support",new Language("en"))))
+//		gr.add(new TripleImpl(list2,RDF.rest,list3))
+//		gr.add(new TripleImpl(list3,RDF.first, new UriRef(holiday)))
+//		gr.add(new TripleImpl(list3,RDF.rest,RDF.nil))
+//		gr.add(new TripleImpl(reto,RDF.`type`, FOAF.Person))
+//
+//		val ez = EzGraph()
+//
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		import org.apache.clerezza.rdf.scala.utils.EzStyleChoice.unicode
+//		( ez.u(retoUri) ∈ FOAF.Person
+//			    ⟝ todoRef ⟶ List[Resource]("SPARQL update support".lang('en),"XSPARQL support".lang('en),holiday.uri))
+//
+//		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph, ez.getGraph) //mutable graphs cannot be compared for equality
+//
+//	}
+//
+//	@Test
+//	def oneToMany {
+//		val gr = new SimpleMGraph
+//		val reto= new UriRef(retoUri)
+//		gr.add(new TripleImpl(reto,FOAF.knows,new UriRef(henryUri)))
+//		gr.add(new TripleImpl(reto,FOAF.knows,new UriRef(danbriUri)))
+//
+//		val ez = EzGraph()
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		//default style is now arrow
+//		(ez.u(retoUri) -- FOAF.knows -->> List(henryUri.uri,danbriUri.uri))
+//
+//		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph,ez.getGraph)
+//
+//		val ez2 = EzGraph()
+//		(ez2.u(retoUri)(EzStyleChoice.unicode) ⟝  FOAF.knows ⟶*  Set(danbriUri.uri,henryUri.uri))
+//
+//		Assert.assertEquals("the two graphs should be of same size",gr.size(),ez2.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph,ez2.getGraph)
+//
+//	}
+//
+//	@Test
+//	def langEquals {
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//
+//		 val lit = new PlainLiteralImpl("SPARQL update support",new Language("en"))
+//		 val lit2 =  "SPARQL update support".lang('en)
+//
+//		Assert.assertEquals("the two literals should be equsl",lit.hashCode(),lit2.hashCode())
+//		Assert.assertEquals("the two literals should be equsl",lit,lit2)
+//
+//		val lit3 = new PlainLiteralImpl("Reto Bachman-Gmür",new Language("rm"))
+//		val lit4 = "Reto Bachman-Gmür".lang('rm)
+//
+//		Assert.assertEquals("the two lang literals should have same hash",lit3.hashCode(),lit4.hashCode())
+//		Assert.assertEquals("the two lang literals should be equal",lit3,lit4)
+//
+//
+//	}
+//
+//	@Test
+//	def uriEquals {
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		val uc = new UriRef("http://clerezza.org/")
+//		val ec = "http://clerezza.org/".uri
+//
+//		Assert.assertEquals("the two uris should have an equal hash",uc.hashCode(),ec.hashCode())
+//		Assert.assertEquals("the two uris should be equal",uc,ec)
+//
+//
+//	}
+//
+//	@Test
+//	def literalTester1 {
+//		val n3 = """
+//		@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+//		<http://bblfish.net/#hjs> a foaf:Person .
+//		"""
+//		val n3Lit : Literal = new TypedLiteralImpl(n3,new UriRef("http://example.com/turtle"))
+//	   val gr = new SimpleMGraph
+//		gr.add(new TripleImpl(new BNode,OWL.sameAs,n3Lit))
+//
+//		import EzGraph._
+//		import EzStyleChoice.unicode
+//		val ez = EzGraph()
+//
+//		(ez.bnode ⟝  OWL.sameAs ⟶  (n3^^"http://example.com/turtle".uri))
+//
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",gr.getGraph, ez.getGraph)
+//
+//	}
+//
+//	@Test
+//	def literalTester2 {
+//		val exp = LiteralFactory.getInstance().createTypedLiteral(65537)
+//		val mod= new TypedLiteralImpl(bblfishModulus,hex)
+//
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		val modZ: TypedLiteral = bblfishModulus^^hex
+//		val expZ: TypedLiteral = 65537
+//
+//		Assert.assertEquals("the two literals should have an equal hash",exp.hashCode(),expZ.hashCode())
+//		Assert.assertEquals("the two literals should be equal",exp,expZ)
+//
+//		Assert.assertEquals("the two literals should have an equal hash",mod.hashCode(),modZ.hashCode())
+//		Assert.assertEquals("the two literals should be equal",mod,modZ)
+//
+//	}
+//
+//
+//	@Test
+//	def usingSymbolicArrows {
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		val ez = EzGraph()
+//		import EzStyleChoice.unicode //in IntelliJ this is needed for the moment to remove the red lines
+//		 // example using arrows
+//		 (
+//		   ez.b_("reto") ∈ FOAF.Person
+//			 ⟝ FOAF.name ⟶ "Reto Bachman-Gmür".lang('rm)
+//			 ⟝ FOAF.title ⟶ "Mr"
+//			 ⟝ FOAF.currentProject ⟶ "http://clerezza.org/".uri
+//			 ⟝ FOAF.knows ⟶ (
+//			     ez.u("http://bblfish.net/#hjs") ∈ FOAF.Person
+//			          ⟝ FOAF.name ⟶ "Henry Story"
+//			          ⟝ FOAF.currentProject ⟶ "http://webid.info/".uri
+//			          ⟵ identity ⟞ (
+//			              ez.bnode ∈ RSAPublicKey
+//			                 ⟝ modulus ⟶ 65537
+//			                 ⟝ public_exponent ⟶ (bblfishModulus^^hex) // brackets needed due to precedence
+//			          )
+//			          ⟝ FOAF.knows ⟶* Set(ez.b_("reto").ref,ez.b_("danny").ref)
+//			 )
+//			 ⟝ FOAF.knows ⟶ (
+//			     ez.b_("danny") ∈ FOAF.Person
+//			          ⟝ FOAF.name ⟶ "Danny Ayers".lang('en)
+//		             ⟝ FOAF.knows ⟶ "http://bblfish.net/#hjs".uri //knows
+//					    ⟝ FOAF.knows ⟶ ez.b_("reto")
+//			 )
+//		 )
+//		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph)
+//		ez.b_("danny") ⟝  FOAF.name ⟶  "George"
+//		Assert.assertFalse("Added one more triple, so graphs should no longer be equal", tinyGraph == ez.getGraph)
+//	}
+//
+//	@Test
+//	def usingAsciiArrows {
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		import EzStyleChoice.arrow
+//		 val ez = EzGraph()
+//		 // example using arrows
+//		 (
+//		   ez.b_("reto").a(FOAF.Person)
+//			 -- FOAF.name --> "Reto Bachman-Gmür".lang('rm)
+//			 -- FOAF.title --> "Mr"
+//			 -- FOAF.currentProject --> "http://clerezza.org/".uri
+//			 -- FOAF.knows --> (
+//			     ez.u("http://bblfish.net/#hjs").a(FOAF.Person)
+//			          -- FOAF.name --> "Henry Story"
+//			          -- FOAF.currentProject --> "http://webid.info/".uri
+// 			          -<- identity -- (
+//			                   ez.bnode.a(RSAPublicKey) //. notation because of precedence of operators
+//			                       -- modulus --> 65537
+//			                       -- public_exponent --> (bblfishModulus^^hex) // brackets needed due to precedence
+//			                   )
+//			          -- FOAF.knows -->> List(ez.b_("reto").ref,ez.b_("danny").ref)
+//			 )
+//			 -- FOAF.knows --> (ez.b_("danny").a(FOAF.Person)
+//			          -- FOAF.name --> "Danny Ayers".lang('en)
+//		             -- FOAF.knows --> "http://bblfish.net/#hjs".uri //knows
+//					    -- FOAF.knows --> ez.b_("reto")
+//			 )
+//		 )
+//		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph)
+//		ez.b_("danny") -- FOAF.name --> "George"
+//		//Assert.assertNotSame("Added one more triple, so graphs should no longer be equal",tinyGraph,ez.graph)
+//
+//	}
+//
+//
+//	@Test
+//	def usingWordOperators {
+//		import org.apache.clerezza.rdf.scala.utils.EzGraph._
+//		import EzStyleChoice.english
+//
+//		 val ez = EzGraph()
+//		 // example using arrows
+//		 (
+//		   ez.b_("reto").asInstanceOf[EzGraphNodeEn] a FOAF.Person
+//			 has FOAF.name to "Reto Bachman-Gmür".lang('rm)
+//			 has FOAF.title to "Mr"
+//			 has FOAF.currentProject to "http://clerezza.org/".uri
+//			 has FOAF.knows to (
+//			     ez.u("http://bblfish.net/#hjs") a FOAF.Person
+//			          has FOAF.name to "Henry Story"
+//			          has FOAF.currentProject to "http://webid.info/".uri
+// 			          is identity of (
+//			                   ez.bnode a RSAPublicKey //. notation because of precedence of operators
+//			                       has modulus to 65537
+//			                       has public_exponent to bblfishModulus^^hex // brackets needed due to precedence
+//			                   )
+//			          has FOAF.knows toEach List(ez.b_("reto").ref,ez.b_("danny").ref)
+//			 )
+//			 has FOAF.knows to ( ez.b_("danny") a FOAF.Person
+//			          has FOAF.name to "Danny Ayers".lang('en)
+//		             has FOAF.knows to "http://bblfish.net/#hjs".uri //knows
+//					    has FOAF.knows to ez.b_("reto")
+//			 )
+//		 )
+//		Assert.assertEquals("the two graphs should be of same size",tinyGraph.size(),ez.size())
+//		Assert.assertEquals("Both graphs should contain exactly the same triples",tinyGraph,ez.getGraph) //mutable graphs cannot be compared for equality
+//		ez.b_("danny") has FOAF.name to "George"
+//		//Assert.assertNotSame("Added one more triple, so graphs should no longer be equal",tinyGraph,ez.getGraph)
+//
+//	}
 
 }