Skip to content

Commit

Permalink
Update GML class definition
Browse files Browse the repository at this point in the history
  • Loading branch information
kwkwan committed Jul 17, 2024
1 parent 023cc40 commit 5580743
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
72 changes: 72 additions & 0 deletions lib/xmi/extensions/gml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,87 @@ class CodeList < Shale::Mapper
end
end

class DataType < Shale::Mapper
attribute :is_collection, Shale::Type::String
attribute :no_property_type, Shale::Type::String
attribute :base_class, Shale::Type::String

xml do
root "DataType"

map_attribute "isCollection", to: :is_collection
map_attribute "noPropertyType", to: :no_property_type
map_attribute "base_Class", to: :base_class
end
end

class Union < Shale::Mapper
attribute :is_collection, Shale::Type::String
attribute :no_property_type, Shale::Type::String
attribute :base_class, Shale::Type::String

xml do
root "Union"

map_attribute "isCollection", to: :is_collection
map_attribute "noPropertyType", to: :no_property_type
map_attribute "base_Class", to: :base_class
end
end

class Enumeration < Shale::Mapper
attribute :base_enumeration, Shale::Type::String

xml do
root "Enumeration"

map_attribute "base_Enumeration", to: :base_enumeration
end
end

class Type < Shale::Mapper
attribute :is_collection, Shale::Type::String
attribute :no_property_type, Shale::Type::String
attribute :base_class, Shale::Type::String

xml do
root "Type"

map_attribute "isCollection", to: :is_collection
map_attribute "noPropertyType", to: :no_property_type
map_attribute "base_Class", to: :base_class
end
end

class FeatureType < Shale::Mapper
attribute :is_collection, Shale::Type::String
attribute :no_property_type, Shale::Type::String
attribute :base_class, Shale::Type::String
attribute :by_value_property_type, Shale::Type::String

xml do
root "FeatureType"

map_attribute "isCollection", to: :is_collection
map_attribute "noPropertyType", to: :no_property_type
map_attribute "base_Class", to: :base_class
map_attribute "byValuePropertyType", to: :by_value_property_type
end
end

class Property < Shale::Mapper
attribute :sequence_number, Shale::Type::String
attribute :base_property, Shale::Type::String
attribute :is_metadata, Shale::Type::String
attribute :inline_or_by_reference, Shale::Type::String

xml do
root "property"

map_attribute "sequenceNumber", to: :sequence_number
map_attribute "base_Property", to: :base_property
map_attribute "isMetadata", to: :is_metadata
map_attribute "inlineOrByReference", to: :inline_or_by_reference
end
end
end
Expand Down
35 changes: 35 additions & 0 deletions lib/xmi/sparx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,11 @@ def self.included(klass) # rubocop:disable Metrics/MethodLength
attribute :eauml_import, EaRoot::Eauml::Import, collection: true
attribute :gml_application_schema, EaRoot::Gml::ApplicationSchema, collection: true
attribute :gml_code_list, EaRoot::Gml::CodeList, collection: true
attribute :gml_data_type, EaRoot::Gml::CodeList, collection: true
attribute :gml_union, EaRoot::Gml::CodeList, collection: true
attribute :gml_enumeration, EaRoot::Gml::CodeList, collection: true
attribute :gml_type, EaRoot::Gml::CodeList, collection: true
attribute :gml_feature_type, EaRoot::Gml::CodeList, collection: true
attribute :gml_property, EaRoot::Gml::Property, collection: true
end
end
Expand Down Expand Up @@ -1002,6 +1007,21 @@ class SparxRoot < Root
map_element "CodeList", to: :gml_code_list,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "DataType", to: :gml_data_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Union", to: :gml_union,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Enumeration", to: :gml_enumeration,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Type", to: :gml_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "FeatureType", to: :gml_feature_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "property", to: :gml_property,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
Expand Down Expand Up @@ -1054,6 +1074,21 @@ class SparxRoot2013 < Root2013
map_element "CodeList", to: :gml_code_list,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "DataType", to: :gml_data_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Union", to: :gml_union,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Enumeration", to: :gml_enumeration,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "Type", to: :gml_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "FeatureType", to: :gml_feature_type,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
map_element "property", to: :gml_property,
namespace: "http://www.sparxsystems.com/profiles/GML/1.0",
prefix: "GML"
Expand Down
5 changes: 5 additions & 0 deletions spec/xmi/sparx/sparx2013_root_gml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
%i[
ApplicationSchema
CodeList
DataType
Enumeration
FeatureType
Property
Type
Union
].sort
end

Expand Down

0 comments on commit 5580743

Please sign in to comment.