Git Product home page Git Product logo

rgen's People

Contributors

artemshein avatar ceigel avatar graaff avatar jkugs avatar mthiede avatar thallgren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rgen's Issues

Model equality

Hi,
I had implemented for my application a version of eql? which takes in account attributes and relations. Would you be interested in integrating in rgen? In case I would send you a patch.

Adding twice the same object in a non containment relation does not work

Hi,
I have a non containment relation:

class McWithNonContRef < RGen::MetamodelBuilder::MMBase
    has_one 'mcwta',McWithTwoAttrs
end

class McWithNonContRefMany < RGen::MetamodelBuilder::MMBase
    has_many 'mcwtas',McWithTwoAttrs
end

I add twice the same objects:

c1.addMcwtas(mcwta1)    
c1.addMcwtas(mcwta1)
assert_equal 2,c1.mcwtas.count

The assertion fails. Is this the supposed behavior? It seems quite surprising to me. While I understand that I could contain just once an object I don't see why I can not refer the same object twice.

$VERBOSE could conflict with other modules

Hi,
using RGen in a small script I found out that it is influenced by $VERBOSE.
I think this is a bad idea because that name could be potentially be used for something else (as it was in my case). I would suggest to rename it to $RGEN_VERBOSE.

In my case I got tons of lines like these:

[code]
/home/federico/.rvm/gems/jruby-1.7.4/gems/rgen-0.6.5/lib/rgen/metamodel_builder/builder_extensions.rb:265 warning: instance variable @abstract not initialized
(eval):8 warning: instance variable @name not initialized
(eval):7 warning: instance variable @abstract not initialized
(eval):7 warning: instance variable @interface not initialized
(eval):4 warning: instance variable @eStructuralFeatures not initialized
(eval):3 warning: instance variable @eStructuralFeatures not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):19 warning: instance variable @eContainingClass not initialized
(eval):7 warning: instance variable @ePackage not initialized
(eval):4 warning: instance variable @eSuperTypes not initialized
(eval):3 warning: instance variable @eSuperTypes not initialized
(eval):7 warning: instance variable @instanceClassName not initialized
(eval):4 warning: instance variable @eAnnotations not initialized
(eval):7 warning: instance variable @changeable not initialized
(eval):7 warning: instance variable @defaultValueLiteral not initialized
(eval):7 warning: instance variable @derived not initialized
(eval):7 warning: instance variable @lowerbound not initialized
(eval):8 warning: instance variable @name not initialized
(eval):7 warning: instance variable @ordered not initialized
(eval):7 warning: instance variable @transient not initialized

[/code]

Attribute 'name' have to be a String

If it is not an error is issued at rgen/metamodel_builder/builder_runtime.rb (line 85)

targetId += "(" + target.name + ")" if target.respond_to?(:name) and target.name

what if you sum target.name.to_s instead of target.name?

Override of is_a? causes degraded performance

The method RGen::MetamodelBuilder::BuilderRuntime#is_a? is currently where the CPU spends most of its time in some of our performance tests. I understand the need for overriding this very basic method to see the ClassModule type inheritance but perhaps there is less intrusive approach than to actually change the is_a? contract?

An alternative that I've experimented with is to implement a specific eIsA? method and then call that method instead when the ClassModule inheritance is relevant. In my experiment I changed the BuilderExtensions.type_check_code slightly so that it tests for eIsA? when the value is an MMBase but use is_a? when it's not. All tests are still green after changing 'test_inheritance' unit test to also use eIsA?. Our own performance tests show a significant improvement.

There are probably more places that needs changing in the Rgen code base (and more tests to write) and I'd be happy to submit a PR for this but I'd like to discuss it first.

Array#to_str blows up the same way as Array#to_hash

The same kind of problem as fixed in #2 for :to_hash occurs for the method :to_str which is used internally buy other ruby methods.

As an example, when calling join on an array, containing a nested array, and that array is empty causes a failure.

x = []
['hello', x].join(':')

The problem with this is that it happens in 3d party logic. Just as for :to_hash, the expectancy is that Array should raise an error (NoSuchMethod).

This can be fixed, by treating :to_str the same way as :to_hash - in array_extensions.rb e.g. like this:

    return super unless (size == 0 &&
      !(m == :to_hash || m == :to_str)) ||
      compact.any?{|e| e.is_a? RGen::MetamodelBuilder::MMBase}

Reference to another model builder

The following is more a question than an issue. I have the following situation: I have two meta-models, let's say "car.rb" and "wheel.rb". Now I would like to make within the "Car" ModelBuilder a reference to a Wheel created by the Wheel model builder. Is there any standard way? Note, in the Car metamodel I manually inserted the following:

require_relative 'wheel'
...
CarMetaModel::Car.contains_many_uni 'wheels', WheelMetaModel::Wheel

DefaultXMLInstantiator naming error with a tag named 'File'

When instantiating a model from an xml file that includes a tag named File using DefaultXMLInstantiator, the program crashes. I believe this is due to line 56 in default_xml_instantiator.rb: mod.const_get(class_name).new. The method call: const_get will, by default, also searchn up the ancestral chain. When I set the inherit flag to false: mod.const_get(class_name, false).new, the model was instantiated correctly.

XMI20Serializer drags in ecore_ext

When serializing a model built with metamodel_builder, the result contains eSubTypes extension and the result is not XMI 2.0 compliant.

I could not figure out how to get rid of this since (I think) the transformer that is involved drags in ecore_ext which defines the super/sub types to be bidirectional.

To get past this problem I simply commented out the line while performing serialization.

Not sure if there is a way to load a model and serialize it to XMI without triggering the code path in question. If not, this is problem that is hard to work around.

XMI20Serializer does not escape literal < characters

The XMI20 outputs < as literal characters in the XML stream. This does not work well - they have to encoded as < or there will be problems reading it back in again.

(I worked around this problem by manually editing the XML output).

Navigation

Hi,
on an instance of class RGen::MetamodelBuilder::MMBase (so an 'RGen eObject' I would say) there are methods to navigate children (direct children and indirect children)?
To get children of a given type?

Duplicate properties with the same name

Hi,
I had a problem with my code because a Metaclass was defining a reference named "value" while inheriting another reference with the same name.

I would suggest to issue a warning in such cases, the behavior is a bit confusing in my opinion.

Ecore model wrong for Enum attributes

When using attributes of Enum type, the created ECore model is wrong in that it always uses a type_name of "anonymous". This means that the model generated by metamodel builder must be patched after being created before the model can be used in EcoreToRuby transformation to again create the runtime classes.

It does not help to do the Enum creation outside of the modeled classes (i.e. assigning them to constants), patching is still required.

The package name is correct, but the type name is not.

latest release missing on rubygems?

Hi,
I noticed that there is the git tag v0.9.0 , but the latest release on rubygems is 0.8.2. Could you publish 0.9.0 on rubygems as well?

Tests fail with ruby >= 2.1.5

Trying to build on Fedora 21 with ruby 2.1.5, tests fail with:

Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
  /usr/share/ruby/test/unit.rb:1:in `<top (required)>'
  rgen_test.rb:3:in `<main>'
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/share/ruby/test/unit/testcase.rb:8:in `<module:Unit>'
/usr/share/ruby/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
        from /usr/share/ruby/test/unit.rb:261:in `<module:Unit>'
        from /usr/share/ruby/test/unit.rb:15:in `<module:Test>'
        from /usr/share/ruby/test/unit.rb:7:in `<top (required)>'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from rgen_test.rb:3:in `<main>'

With ruby 2..2.1 fails with:

+ ruby rgen_test.rb
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- test/unit (LoadError)
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54:in `require'
        from test/rgen_test.rb:3:in `<main>'

Test failures with Ruby 3.0

We see these test failures with Ruby 3.0

Finished in 0.617611s, 422.5960 runs/s, 2833.4978 assertions/s.

  1) Failure:
MetamodelFromEcoreTest#test_has_attr [/<<PKGBUILDDIR>>/test/metamodel_builder_test.rb:229]:
Expected /In (\w+::)+SimpleClass : Can not use a Symbol\(:someSymbol\) where a \[true,false\] is expected/ to match "In MetamodelFromEcoreTest::MetamodelFromEcore::SimpleClass : Can not use a Symbol(someSymbol)(:someSymbol) where a [true,false] is expected".

  2) Failure:
MetamodelFromEcoreTest#test_many_to_many [/<<PKGBUILDDIR>>/test/metamodel_builder_test.rb:619]:
Expected /In (\w+::)+BClassMM : Can not use a Symbol\(:notaaclass\) where a (\w+::)+AClassMM is expected/ to match "In MetamodelFromEcoreTest::MetamodelFromEcore::BClassMM : Can not use a Symbol(notaaclass)(:notaaclass) where a MetamodelFromEcoreTest::MetamodelFromEcore::AClassMM is expected".

  3) Failure:
MetamodelBuilderTest#test_many_to_many [/<<PKGBUILDDIR>>/test/metamodel_builder_test.rb:619]:
Expected /In (\w+::)+BClassMM : Can not use a Symbol\(:notaaclass\) where a (\w+::)+AClassMM is expected/ to match "In MetamodelBuilderTest::TestMetamodel::BClassMM : Can not use a Symbol(notaaclass)(:notaaclass) where a MetamodelBuilderTest::TestMetamodel::AClassMM is expected".

  4) Failure:
MetamodelBuilderTest#test_has_attr [/<<PKGBUILDDIR>>/test/metamodel_builder_test.rb:229]:
Expected /In (\w+::)+SimpleClass : Can not use a Symbol\(:someSymbol\) where a \[true,false\] is expected/ to match "In MetamodelBuilderTest::TestMetamodel::SimpleClass : Can not use a Symbol(someSymbol)(:someSymbol) where a [true,false] is expected".

261 runs, 1750 assertions, 4 failures, 0 errors, 0 skips
ERROR: Test "ruby3.0" failed. Exiting.

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.