jpl-imce / gov.nasa.jpl.imce.oml.development.generators Goto Github PK
View Code? Open in Web Editor NEWOML Development Generators
OML Development Generators
Instead of:
tables.LiteralValue.fromJSON(s"""{"literalType":"${tuple.literalValueLiteralType}","value":"${tuple.literalValue}"}"""),
Need:
tables.LiteralValue.fromJSON(s"""{"literalType":"${tuple.literalValueLiteralType}","value":${Json.fromString(tuple.literalValue).toString}}"""),
The reason is that the OML tabular representation may have strings that contain characters like "
; which need to be properly quoted for a valid Json string.
Also:
protected def void readNumericScalarRestrictions(Extent ext, ArrayList<String> lines) {
val kvs = OMLZipResource.lines2tuples(lines)
while (!kvs.empty) {
val kv = kvs.remove(kvs.size - 1)
val oml = createNumericScalarRestriction()
val uuid = kv.remove("uuid")
val minExclusive_value = kv.remove("minExclusive")
if (null !== minExclusive_value && minExclusive_value.length > 0)
oml.minExclusive = OMLTables.toLiteralNumber(minExclusive_value)
val minInclusive_value = kv.remove("minInclusive")
if (null !== minInclusive_value && minInclusive_value.length > 0)
oml.minInclusive = OMLTables.toLiteralNumber(minInclusive_value)
val maxExclusive_value = kv.remove("maxExclusive")
if (null !== maxExclusive_value && maxExclusive_value.length > 0)
oml.maxExclusive = OMLTables.toLiteralNumber(maxExclusive_value)
val maxInclusive_value = kv.remove("maxInclusive")
if (null !== maxInclusive_value && maxInclusive_value.length > 0)
oml.maxInclusive = OMLTables.toLiteralNumber(maxInclusive_value)
oml.name = OMLTables.toLocalName(kv.remove("name"))
val pair = new Pair<NumericScalarRestriction, Map<String,String>>(oml, kv)
numericScalarRestrictions.put(uuid, pair)
includeNumericScalarRestrictions(uuid, oml)
}
}
Should check for a null string too!
The OML metamodels in *.xcore use Xcore datatype aliases & wrapper classes.
Examples of datatype aliases:
type DateTimeDataType wraps gov.nasa.jpl.imce.oml.model.datatypes.DateTimeValue
type LanguageTagDataType wraps gov.nasa.jpl.imce.oml.model.datatypes.LanguageTagValue
type StringDataType wraps gov.nasa.jpl.imce.oml.model.datatypes.StringValue
type UUIDDataType wraps gov.nasa.jpl.imce.oml.model.datatypes.UUIDValue
type URIDataType wraps gov.nasa.jpl.imce.oml.model.datatypes.URIValue
Examples of datatype wrapper classes:
abstract class LiteralValue {}
class LiteralDateTime extends LiteralValue {
DateTimeDataType[1] dateTime
}
class LiteralString extends LiteralValue {
StringDataType[1] string
}
...
Due to the restriction for context-free parsing of lexical tokens in Xtext (see: https://www.eclipse.org/Xtext/documentation/301_grammarlanguage.html#datatype-rules),
datatype wrapper classes are necessary to abstract different kinds of disjoint lexical tokens (e.g., DateTimeDataType
, StringDataType
, ...) as values for a common abstract datatype (e.g., LiteralValue
).
However, this requires updating the code generators to recognize datatype aliases and wrappers.
For the latter, this entails that a "datatype attribute" in Xcore may be a composite typed by an abstract datatype wrapper class; e.g.:
class ScalarOneOfLiteralAxiom extends TermAxiom {
refers ScalarOneOfRestriction[1] axiom
/*
* The value of the literal from the restrictedScalar datatype
*/
contains LiteralValue[1] value
...
}
For xtend: OMLSpecificationTables.read*Restrictions parse "null" as no value.
For scala: Pattern for restriction metaclasses for OML Frameless representation.
AnnotationPropertys.json
EntityScalarDataPropertys.json
EntityStructuredDataPropertys.json
ScalarDataPropertys.json
StructuredDataPropertys.json
Example.
Currently:
trait Resource
{
def iri
()(implicit extent: Extent): scala.Option[gov.nasa.jpl.imce.oml.tables.IRI]
def name
(): gov.nasa.jpl.imce.oml.tables.LocalName
def abbrevIRI
()(implicit extent: Extent): scala.Option[scala.Predef.String]
}
Desired:
trait Resource
{
def iri
()(implicit extent: Extent): scala.Option[gov.nasa.jpl.imce.oml.tables.IRI]
def name
(): gov.nasa.jpl.imce.oml.tables.LocalName
def abbrevIRI
()(implicit extent: Extent): scala.Option[scala.Predef.String]
}
object Resource {
def iri
(r: Resource, extent: Extent)
: scala.Option[gov.nasa.jpl.imce.oml.tables.IRI]
= r.iri()(extent)
def abbrevIRI
(r: Resource, extent: Extent)
: scala.Option[scala.Predef.String]
= r.abbrevIRI()(extent)
}
Currently, the trait query methods cannot be passed as arguments because of the implicit parameter. With the companion object query functions, it is possible to pass such functions as arguments.
This affects several OML elements including JPL-IMCE/gov.nasa.jpl.imce.oml#147
To facilitate using Apache Spark & GraphX on OML, generate a vertexId long identifier.
In the cradle-based multi-project organization, there were several git subrepos:
These were subrepos of the oml.core project so that the gradle build scripts could execute the Xtend generators.
In the tyco-based refactoring, there are no git subrepos.
Instead:
(IntelliJ uses the SBT build configuration; Eclipse cannot support all the features of the SBT build configuration; which means that to use Eclipse would require maintaining a dual build configuration for a partial build in Eclipse and a complete build in SBT)
To handle arbitrary directed graph topologies of OML Modules & OML ModuleEdges, it is necessary to relax the representation in OML Tables & OML Resolver for a ModuleEdge such that the target Module is referenced by its IRI instead of by its UUID (in the table representation) or by its Module (in the resolver representation).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.