31. object Chromosome extends
Entity
with RelationalEntity!
with GraphVertex
with XmlElement {
self =>
sealed trait ChromosomePart {
val ownerType = self
}
// Ontology Trait
val featuringType = self
val ownedFeature = chromatine :: Nil
// XML Trait
val namespace = "urn:domain:chromosome:1.0"
val prefix = "chr"
// Features
val chromatine =
new Chromatine(
name = "chromatine",
ownerType = Chromosome,
mapping = Map.empty[String, String])
}
32. implicit def enrich[A <: DomainModel](model: A) = new {
def metamodel: Option[Type] = Ontology.typeOf(model)
}
def xmlFilter[A <: DomainModel] =
(model: A) ⇒ model.metamodel match {
case Some(_: XmlElement) ⇒ body(XmlModel[A](model))
case _ ⇒ fail[XmlModel[A]]!
("No XmlElement meta-model definition could be found")
}
def ingoingEdges[A <: DomainModel] =
(model: A) ⇒ model.metamodel match {
case Some(vertex: GraphVertex) ⇒ !
Ontology.edges.filter(_.target == vertex)
case _ ⇒ List.empty[GraphEdge]
}
33. implicit def enrich[A <: DomainModel](model: A) = new {
def metamodel: Option[Type] = Ontology.typeOf(model)
}
def xmlFilter[A <: DomainModel] =
(model: A) ⇒ model.metamodel match {
case Some(_: XmlElement) ⇒ body(XmlModel[A](model))
case _ ⇒ fail[XmlModel[A]]!
("No XmlElement meta-model definition could be found")
}
def ingoingEdges[A <: DomainModel] =
(model: A) ⇒ model.metamodel match {
case Some(vertex: GraphVertex) ⇒ !
Ontology.edges.filter(_.target == vertex)
case _ ⇒ List.empty[GraphEdge]
}