Giter Site home page Giter Site logo

gov.nasa.jpl.imce.oml.development.generators's People

Contributors

nicolasrouquette avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gov.nasa.jpl.imce.oml.development.generators's Issues

Subtle code generation bugs affect the OML Converter's merge function

  • Frameless:

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!

Update code generation templates for OML datatypes

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
	...
}

Minor fixes

For xtend: OMLSpecificationTables.read*Restrictions parse "null" as no value.
For scala: Pattern for restriction metaclasses for OML Frameless representation.

Fix plural spelling for table names

AnnotationPropertys.json
EntityScalarDataPropertys.json
EntityStructuredDataPropertys.json
ScalarDataPropertys.json
StructuredDataPropertys.json

Generate companion object query functions for Extent-based queries methods

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.

Update generators for the oml.tycho refactoring.

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:

  • The Xtend generators are ran from the Eclipse IDE as simple command-line applications.
  • The other projects are imported in the Eclipse workspace but are not built in Eclipse.
  • The Scala projects (oml.tables and oml.resolver) are developed using IntelliJ.

(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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.