Skip to content

Commit

Permalink
fixes for ISU export 12.5.2016
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickoswald committed May 18, 2016
1 parent ab1acec commit af12e0a
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/main/scala/ch/ninecode/CIM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1453,15 +1453,15 @@ object ServiceCategory extends Parser
// <cim:IdentifiedObject.name></cim:IdentifiedObject.name>
// <cim:IdentifiedObject.aliasName>Tariftyp</cim:IdentifiedObject.aliasName>
// <cim:PricingStructure.code>102</cim:PricingStructure.code>
// <cim:ServiceCategory rdf:resource="NETZ"/>
// <cim:PricingStructure.ServiceCategory rdf:resource="NETZ"/>
// </cim:PricingStructure>

case class PricingStructure (override val id: String, override val alias: String, override val description: String, override val name: String, val code: String, val category: String) extends NamedElement (id, alias, description, name)

object PricingStructure extends Parser
{
val codex = Pattern.compile ("""<cim:PricingStructure.code>([\s\S]*?)<\/cim:PricingStructure.code>""")
val catex = Pattern.compile ("""<cim:ServiceCategory\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val catex = Pattern.compile ("""<cim:PricingStructure.ServiceCategory\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
override def steps () = Array (
NamedElement.parse,
Element.parse_element (codex, 1, "code", false)_,
Expand Down Expand Up @@ -1514,15 +1514,15 @@ object Customer extends Parser
// <cim:IdentifiedObject.description>CustomerAgreement</cim:IdentifiedObject.description>
// <cim:IdentifiedObject.name></cim:IdentifiedObject.name>
// <cim:IdentifiedObject.aliasName>Vertrag</cim:IdentifiedObject.aliasName>
// <cim:ServiceCategory rdf:resource="NETZ"/>
// <cim:Customer rdf:resource="80340129"/>
// <cim:CustomerAgreement.ServiceCategory rdf:resource="NETZ"/>
// <cim:CustomerAgreement.Customer rdf:resource="80340129"/>
// </cim:CustomerAgreement>
case class CustomerAgreement (override val id: String, override val alias: String, override val description: String, override val name: String, val category: String, val customer: String) extends NamedElement (id, alias, description, name)

object CustomerAgreement extends Parser
{
val catex = Pattern.compile ("""<cim:ServiceCategory\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val cusex = Pattern.compile ("""<cim:Customer\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val catex = Pattern.compile ("""<cim:CustomerAgreement.ServiceCategory\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val cusex = Pattern.compile ("""<cim:CustomerAgreement.Customer\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
override def steps () = Array (
NamedElement.parse,
Element.parse_element (catex, 2, "category", false)_,
Expand All @@ -1545,10 +1545,10 @@ object CustomerAgreement extends Parser
// <cim:UsagePoint.nominalServiceVoltage>-1</cim:UsagePoint.nominalServiceVoltage>
// <cim:UsagePoint.ratedPower>-1</cim:UsagePoint.ratedPower>
// <cim:UsagePoint.ratedCurrent>-1</cim:UsagePoint.ratedCurrent>
// <cim:ServiceLocation rdf:resource="11100002858"/>
// <cim:UsagePointLocationLocation rdf:resource="61708"/>
// <cim:CustomerAgreement rdf:resource="41250281"/>
// <cim:PricingStructure rdf:resource="N5_SD_P"/>
// <cim:UsagePoint.ServiceLocation rdf:resource="11100002858"/>
// <cim:UsagePoint.UsagePointLocationLocation rdf:resource="61708"/>
// <cim:UsagePoint.CustomerAgreement rdf:resource="41250281"/>
// <cim:UsagePoint.PricingStructure rdf:resource="N5_SD_P"/>
// </cim:UsagePoint>
case class UsagePoint (override val id: String, override val alias: String, override val description: String, override val name: String, val outageregion: String, val nominalvoltage: String, val ratedpower: String, val ratedcurrent: String, val servicepoint: String, val usagepointlocation: String, val customeragreement: String, val pricingstructure: String) extends NamedElement (id, alias, description, name)

Expand All @@ -1558,10 +1558,12 @@ object UsagePoint extends Parser
val volex = Pattern.compile ("""<cim:UsagePoint.nominalServiceVoltage>([\s\S]*?)<\/cim:UsagePoint.nominalServiceVoltage>""")
val powex = Pattern.compile ("""<cim:UsagePoint.ratedPower>([\s\S]*?)<\/cim:UsagePoint.ratedPower>""")
val curex = Pattern.compile ("""<cim:UsagePoint.ratedCurrent>([\s\S]*?)<\/cim:UsagePoint.ratedCurrent>""")
val locex = Pattern.compile ("""<cim:ServiceLocation\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val uplex = Pattern.compile ("""<cim:UsagePointLocationLocation\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val cusex = Pattern.compile ("""<cim:CustomerAgreement\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val priex = Pattern.compile ("""<cim:PricingStructure\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val locex = Pattern.compile ("""<cim:UsagePoint.ServiceLocation\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val uplex = Pattern.compile ("""<cim:UsagePoint.UsagePointLocation\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
// error in ISU.CIM, remove when fixed:
val uplex2 = Pattern.compile ("""<cim:UsagePoint.UsagePointLocationLocation\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val cusex = Pattern.compile ("""<cim:UsagePoint.CustomerAgreement\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
val priex = Pattern.compile ("""<cim:UsagePoint.PricingStructure\s+rdf:resource\s*?=\s*?("|')([\s\S]*?)\1\s*?\/>""")
override def steps () = Array (
NamedElement.parse,
Element.parse_element (outex, 1, "outageregion", false)_,
Expand All @@ -1570,6 +1572,7 @@ object UsagePoint extends Parser
Element.parse_element (curex, 1, "current", false)_,
Element.parse_element (locex, 2, "servicelocation", false)_,
Element.parse_element (uplex, 2, "usagelocation", false)_,
Element.parse_element (uplex2, 2, "usagelocation", false)_,
Element.parse_element (cusex, 2, "customer", false)_,
Element.parse_element (priex, 2, "pricing", false)_
)
Expand Down Expand Up @@ -1813,7 +1816,7 @@ class CIM (var xml:String, var start: Long = 0L, var end: Long = 0L)

object CIM
{
val CHUNK = 1024*1024*128
val CHUNK = 1024*1024*64
val OVERREAD = 2048 // should be large enough that no RDF element is bigger than this
val rddex = Pattern.compile ("""\s*<(cim:[^>\.\s]+)([>\s][\s\S]*?)<\/\1>\s*""") // important to consume leading and trailing whitespace

Expand Down

0 comments on commit af12e0a

Please sign in to comment.