Skip to content

Instantly share code, notes, and snippets.

@bblfish
Created February 9, 2012 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bblfish/1780789 to your computer and use it in GitHub Desktop.
Save bblfish/1780789 to your computer and use it in GitHub Desktop.
pimp my rdf
package org.w3.rdf
import org.w3.algebraic._
trait Module {
val xsdString = IRI("http://www.w3.org/2001/XMLSchema#string")
val rdfLangString = IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")
trait GraphInterface extends Iterable[Triple] { self =>
def ++(other: Graph): Graph
}
type Graph <: GraphInterface
type Triple
type Node
type IRI <: Node
type BNode <: Node
type Literal <: Node
type PlainLiteral <: TypedLiteral
type LangLiteral <: Literal
type TypedLiteral <: Literal
type Lang
trait GraphCompanionObject {
def empty: Graph
def apply(elems: Triple*): Graph
def apply(it: Iterable[Triple]): Graph
}
val Graph: GraphCompanionObject
val Triple: AlgebraicDataType3[Node, IRI, Node, Triple]
val IRI : AlgebraicDataType1[String, IRI]
val BNode: AlgebraicDataType1[String, BNode]
protected val Literal: AlgebraicDataType3[String, IRI, Option[Lang], Literal]
val PlainLiteral: AlgebraicDataType1[String, PlainLiteral]
val TypedLiteral: AlgebraicDataType2[String, IRI, TypedLiteral]
val LangLiteral: AlgebraicDataType2[String, Some[Lang], LangLiteral]
val Lang: AlgebraicDataType1[String, Lang]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment