Skip to content

Commit

Permalink
feat: migrate to lutaml-model, fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Aug 30, 2024
1 parent 50446d1 commit cf41fee
Show file tree
Hide file tree
Showing 326 changed files with 1,101 additions and 1,090 deletions.
12 changes: 8 additions & 4 deletions lib/ogc/gml.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# frozen_string_literal: true

require "lutaml/model"

Lutaml::Model::Config.configure do |config|
require "lutaml/model/xml_adapter/nokogiri_adapter"
config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
end

require_relative "gml/version"

module Ogc
module Gml
class Error < StandardError; end

# Your code goes here...
end
end

require 'shale'
require 'shale/adapter/nokogiri'
Shale.xml_adapter = Shale::Adapter::Nokogiri

require_relative "gml/abstract_continuous_coverage"
require_relative "gml/abstract_coordinate_operation"
require_relative "gml/abstract_coordinate_system"
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_continuous_coverage.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "coverage_function"
require_relative "abstract_coverage"

Expand Down
10 changes: 5 additions & 5 deletions lib/ogc/gml/abstract_coordinate_operation.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "coordinate_operation_accuracy"
require_relative "crs_property"
Expand All @@ -9,10 +9,10 @@
module Ogc
module Gml
class AbstractCoordinateOperation < AbstractTopology
attribute :remarks, Shale::Type::String
attribute :domain_of_validity, Shale::Type::String
attribute :scope, Shale::Type::String, collection: true
attribute :operation_version, Shale::Type::String
attribute :remarks, :string
attribute :domain_of_validity, :string
attribute :scope, :string, collection: true
attribute :operation_version, :string
attribute :coordinate_operation_accuracy, CoordinateOperationAccuracy, collection: true
attribute :source_crs, CRSProperty
attribute :target_crs, CRSProperty
Expand Down
12 changes: 6 additions & 6 deletions lib/ogc/gml/abstract_coordinate_system.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand All @@ -10,15 +10,15 @@

module Ogc
module Gml
class AbstractCoordinateSystem < Shale::Mapper
attribute :id, Shale::Type::Value
attribute :aggregation_type, Shale::Type::String
class AbstractCoordinateSystem < Lutaml::Model::Serializable
attribute :id, :string
attribute :aggregation_type, :string
attribute :meta_data_property, MetaDataProperty, collection: true
attribute :description, Shale::Type::String
attribute :description, :string
attribute :description_reference, Reference
attribute :identifier, CodeWithAuthority
attribute :name, Code, collection: true
attribute :remarks, Shale::Type::String
attribute :remarks, :string
attribute :axis, CoordinateSystemAxisProperty, collection: true

xml do
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_coverage.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "bounding_shape"
require_relative "domain_set"
require_relative "location_property"
Expand Down
8 changes: 4 additions & 4 deletions lib/ogc/gml/abstract_crs.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand All @@ -11,9 +11,9 @@
module Ogc
module Gml
class AbstractCRS < AbstractTopology
attribute :remarks, Shale::Type::String
attribute :domain_of_validity, Shale::Type::String, collection: true
attribute :scope, Shale::Type::String, collection: true
attribute :remarks, :string
attribute :domain_of_validity, :string, collection: true
attribute :scope, :string, collection: true

xml do
root "AbstractSingleCRS"
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_curve.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "abstract_geometric_primitive"

module Ogc
Expand Down
10 changes: 5 additions & 5 deletions lib/ogc/gml/abstract_curve_segment.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

module Ogc
module Gml
class AbstractCurveSegment < Shale::Mapper
attribute :num_derivatives_at_start, Shale::Type::Integer#, default: -> { "0" }
attribute :num_derivatives_at_end, Shale::Type::Integer#, default: -> { "0" }
attribute :num_derivative_interior, Shale::Type::Integer#, default: -> { "0" }
class AbstractCurveSegment < Lutaml::Model::Serializable
attribute :num_derivatives_at_start, :integer #, default: -> { "0" }
attribute :num_derivatives_at_end, :integer #, default: -> { "0" }
attribute :num_derivative_interior, :integer #, default: -> { "0" }

xml do
root "AbstractCurveSegment"
Expand Down
10 changes: 5 additions & 5 deletions lib/ogc/gml/abstract_datum.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand All @@ -11,11 +11,11 @@
module Ogc
module Gml
class AbstractDatum < AbstractTopology
attribute :remarks, Shale::Type::String
attribute :domain_of_validity, Shale::Type::String
attribute :scope, Shale::Type::String, collection: true
attribute :remarks, :string
attribute :domain_of_validity, :string
attribute :scope, :string, collection: true
attribute :anchor_definition, Code
attribute :realization_epoch, Shale::Type::Date
attribute :realization_epoch, :date

xml do
root "AbstractDatum"
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_feature.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "bounding_shape"
require_relative "code"
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_feature_collection.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "bounding_shape"
require_relative "feature_array_property"
require_relative "feature_property"
Expand Down
8 changes: 4 additions & 4 deletions lib/ogc/gml/abstract_general_conversion.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand All @@ -12,9 +12,9 @@
module Ogc
module Gml
class AbstractGeneralConversion < AbstractTopology
attribute :remarks, Shale::Type::String
attribute :domain_of_validity, Shale::Type::String
attribute :scope, Shale::Type::String, collection: true
attribute :remarks, :string
attribute :domain_of_validity, :string
attribute :scope, :string, collection: true
attribute :coordinate_operation_accuracy, CoordinateOperationAccuracy, collection: true

xml do
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_general_derived_crs.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "general_conversion_property"
require_relative "abstract_crs"

Expand Down
6 changes: 3 additions & 3 deletions lib/ogc/gml/abstract_general_operation_parameter.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "abstract_topology"

module Ogc
module Gml
class AbstractGeneralOperationParameter < AbstractTopology
attribute :remarks, Shale::Type::String
attribute :minimum_occurs, Shale::Type::Integer
attribute :remarks, :string
attribute :minimum_occurs, :integer

xml do
root "AbstractGeneralOperationParameter"
Expand Down
8 changes: 4 additions & 4 deletions lib/ogc/gml/abstract_general_operation_parameter_property.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "abstract_general_operation_parameter"

module Ogc
module Gml
class AbstractGeneralOperationParameterProperty < Shale::Mapper
attribute :nil_reason, Shale::Type::Value
attribute :remote_schema, Shale::Type::Value
class AbstractGeneralOperationParameterProperty < Lutaml::Model::Serializable
attribute :nil_reason, :string
attribute :remote_schema, :string
attribute :abstract_general_operation_parameter, AbstractGeneralOperationParameter

xml do
Expand Down
4 changes: 2 additions & 2 deletions lib/ogc/gml/abstract_general_parameter_value.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

module Ogc
module Gml
class AbstractGeneralParameterValue < Shale::Mapper
class AbstractGeneralParameterValue < Lutaml::Model::Serializable
xml do
root "AbstractGeneralParameterValue"
namespace "http://www.opengis.net/gml/3.2", "gml"
Expand Down
4 changes: 2 additions & 2 deletions lib/ogc/gml/abstract_general_parameter_value_property.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "abstract_general_parameter_value"

module Ogc
module Gml
class AbstractGeneralParameterValueProperty < Shale::Mapper
class AbstractGeneralParameterValueProperty < Lutaml::Model::Serializable
attribute :abstract_general_parameter_value, AbstractGeneralParameterValue

xml do
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_general_transformation.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "abstract_coordinate_operation"

module Ogc
Expand Down
4 changes: 2 additions & 2 deletions lib/ogc/gml/abstract_geometric_aggregate.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "abstract_geometric_primitive"

module Ogc
module Gml
class AbstractGeometricAggregate < AbstractGeometricPrimitive
attribute :aggregation_type, Shale::Type::String
attribute :aggregation_type, :string

xml do
root "AbstractGeometricAggregate"
Expand Down
16 changes: 8 additions & 8 deletions lib/ogc/gml/abstract_geometric_primitive.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand All @@ -9,14 +9,14 @@

module Ogc
module Gml
class AbstractGeometricPrimitive < Shale::Mapper
attribute :id, Shale::Type::Value
attribute :srs_name, Shale::Type::Value
attribute :srs_dimension, Shale::Type::Integer
attribute :axis_labels, Shale::Type::Value
attribute :uom_labels, Shale::Type::Value
class AbstractGeometricPrimitive < Lutaml::Model::Serializable
attribute :id, :string
attribute :srs_name, :string
attribute :srs_dimension, :integer
attribute :axis_labels, :string
attribute :uom_labels, :string
attribute :meta_data_property, MetaDataProperty, collection: true
attribute :description, Shale::Type::String
attribute :description, :string
attribute :description_reference, Reference
attribute :identifier, CodeWithAuthority
attribute :name, Code, collection: true
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_geometry.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"
require_relative "abstract_geometric_primitive"

module Ogc
Expand Down
2 changes: 1 addition & 1 deletion lib/ogc/gml/abstract_gml.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

require_relative "code"
require_relative "code_with_authority"
Expand Down
10 changes: 5 additions & 5 deletions lib/ogc/gml/abstract_gridded_surface.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

module Ogc
module Gml
class AbstractGriddedSurface < Shale::Mapper
attribute :aggregation_type, Shale::Type::String
attribute :rows, Shale::Type::Integer
attribute :columns, Shale::Type::Integer
class AbstractGriddedSurface < Lutaml::Model::Serializable
attribute :aggregation_type, :string
attribute :rows, :integer
attribute :columns, :integer

xml do
root "AbstractGriddedSurface"
Expand Down
8 changes: 4 additions & 4 deletions lib/ogc/gml/abstract_meta_data.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

module Ogc
module Gml
class AbstractMetaData < Shale::Mapper
attribute :content, Shale::Type::String
attribute :id, Shale::Type::Value
class AbstractMetaData < Lutaml::Model::Serializable
attribute :content, :string
attribute :id, :string

xml do
root "AbstractMetaData"
Expand Down
6 changes: 3 additions & 3 deletions lib/ogc/gml/abstract_parametric_curve_surface.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require "shale"
require "lutaml/model"

module Ogc
module Gml
class AbstractParametricCurveSurface < Shale::Mapper
attribute :aggregation_type, Shale::Type::String
class AbstractParametricCurveSurface < Lutaml::Model::Serializable
attribute :aggregation_type, :string

xml do
root "AbstractParametricCurveSurface"
Expand Down
Loading

0 comments on commit cf41fee

Please sign in to comment.