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 20:21:28 UTC
svn commit: r1141650 - in
/incubator/clerezza/issues/CLEREZZA-510-reto/rdf.scala.utils/src:
main/scala/org/apache/clerezza/rdf/scala/utils/EzGraph.scala
test/scala/org/apache/clerezza/rdf/scala/utils/EzGraphTest.scala
Author: reto
Date: Thu Jun 30 18:21:28 2011
New Revision: 1141650
URL: http://svn.apache.org/viewvc?rev=1141650&view=rev
Log:
CLEREZZA-510: removed unncessary code (because of inheritance or implicit conversion obsoleting overloaded methods
Modified:
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/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/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=1141650&r1=1141649&r2=1141650&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 18:21:28 2011
@@ -30,88 +30,10 @@ import org.apache.clerezza.rdf.core._
import org.apache.clerezza.rdf.core.impl._
object EzGraph {
-
+ //not sure this is needed, as a EzGraph is typically subclassed by an anonymous class
def apply(graph: MGraph) = new EzGraph(graph)
def apply() = new EzGraph()
- private val litFactory = LiteralFactory.getInstance
-
- implicit def string2lit(str: String) = new EzLiteral(str)
-
- implicit def lit2String(lit: Literal) = lit.getLexicalForm
-
- implicit def date2lit(date: Date) = litFactory.createTypedLiteral(date)
-
- implicit def int2lit(int: Int) = litFactory.createTypedLiteral(int)
-
- implicit def bigint2lit(bint: BigInt) = litFactory.createTypedLiteral(bint.underlying())
-
- implicit def bigint2lit(bigInt: BigInteger) = litFactory.createTypedLiteral(bigInt)
-
- implicit def bool2lit(boolean: Boolean) = litFactory.createTypedLiteral(boolean)
-
- implicit def scalaBool2lit(boolean: scala.Boolean) = litFactory.createTypedLiteral(boolean)
-
- implicit def long2lit(long: Long) = litFactory.createTypedLiteral(long)
-
- implicit def double2lit(double: Double) = litFactory.createTypedLiteral(double)
-
- implicit def uriRef2Prefix(uriRef: UriRef) = new NameSpace(uriRef.getUnicodeString)
-
- implicit def URItoUriRef(uri: URI) = new UriRef(uri.toString)
-
- implicit def URLtoUriRef(url: URL) = new UriRef(url.toExternalForm)
-
- //inspired from http://programming-scala.labs.oreilly.com/ch11.html
-
-}
-
-/**
- * An easy Literal implementations, contains functions for mapping literals to other literals, ie from String literals to
- * typed literals.
- */
-class EzLiteral(lexicalForm: String) extends TypedLiteral {
-
- def unapply(lexical: String) = lexical
-
- /**
- * @return a plain literal with language specified by lang
- */
- def lang(lang: String) = new PlainLiteralImpl(lexicalForm, new Language(lang))
- def lang(lang: Language) = new PlainLiteralImpl(lexicalForm, lang)
- def lang(lang: Symbol) = new PlainLiteralImpl(lexicalForm, new Language(lang.name))
-
- /**
- * Map to a Typed Literal of given type
- */
- def ^^(typ: UriRef) = new TypedLiteralImpl(lexicalForm, typ)
-
- /**
- * Map to a URI of given lexical form
- */
- def uri = new UriRef(lexicalForm)
-
- /**
- * get the pure string
- */
- override def getLexicalForm = lexicalForm
-
- override def equals(other: Any) = {
- other match {
- case olit: TypedLiteral => (olit eq this) || (olit.getLexicalForm == lexicalForm && olit.getDataType == this.getDataType)
- case _ => false
- }
- }
-
- override def hashCode() = XSD.string.hashCode() + lexicalForm.hashCode()
-
- def getDataType = XSD.string
-
- /**
- * String literals are just strings
- * See RDF Semantics rules xsd 1a and xsd 1b in http://www.w3.org/TR/rdf-mt/
- */
- override def toString() = lexicalForm
}
/**
@@ -294,11 +216,6 @@ class EzGraphNodeU(ref: NonLiteral, grap
class PredicateU(rel: UriRef) extends Predicate(rel) {
/**
- * ...to the following literal string
- */
- def â¶(obj: String) = add(new EzLiteral(obj))
-
- /**
* ...to the following resource
*/
def â¶(obj: Resource) = add(obj)
@@ -384,10 +301,6 @@ class EzGraphNodeA(ref: NonLiteral, grap
*/
def -->(obj: Resource) = add(obj)
- /**
- * ...to the following string literal
- */
- def -->(lit: String) = add(new EzLiteral(lit))
/**
* Adds a relation to a real linked list.
@@ -482,11 +395,6 @@ class EzGraphNodeEn(ref: NonLiteral, gra
/**
- * ...to the following literal string
- */
- def to(lit: String) = add(new EzLiteral(lit))
-
- /**
* ...to the following resource
*/
def to(obj: Resource) = add(obj)
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=1141650&r1=1141649&r2=1141650&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 18:21:28 2011
@@ -22,6 +22,7 @@ import org.apache.clerezza.rdf.ontologie
import org.junit._
import org.apache.clerezza.rdf.core._
import impl._
+import Preamble._
class EzGraphTest {