mexico 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.gitmodules +3 -0
- data/.project +14 -0
- data/.rspec +2 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +165 -0
- data/README.md +116 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/assets/TESTCORPUS/Corpus.xml +26 -0
- data/assets/fiesta/b6/layer_connectors.fst +16 -0
- data/assets/fiesta/b6/match_jones_161_CM_neu_checked.parsed.xml +1225 -0
- data/assets/fiesta/elan/ElanFileFormat.eaf +76 -0
- data/assets/fiesta/elan/ElanFileFormat.pfsx +8 -0
- data/assets/fiesta/elan/ElanFileFormatComplexInterLayerLinks.eaf +107 -0
- data/assets/fiesta/elan/reflinks_example.eaf +270 -0
- data/assets/fiesta/elan/test_all_interlayerrelations.fst +43 -0
- data/assets/fiesta/head/head.fst +24 -0
- data/assets/fiesta/praat/mexico.ShortTextGrid +81 -0
- data/assets/fiesta/praat/mexico.TextGrid +104 -0
- data/assets/helpers/collection_ref_handler.rb +29 -0
- data/assets/helpers/id_ref_handler.rb +29 -0
- data/assets/helpers/roxml_attribute_handler.rb +57 -0
- data/assets/out_only/construct_and_write_spec.toe +99 -0
- data/assets/spec.html +554 -0
- data/bin/mexico +5 -0
- data/features/mexico.feature +9 -0
- data/features/step_definitions/mexico_steps.rb +0 -0
- data/features/support/env.rb +15 -0
- data/info/releasenotes/0.0.1.md +5 -0
- data/info/releasenotes/0.0.2.md +5 -0
- data/info/releasenotes/0.0.3.md +5 -0
- data/info/releasenotes/0.0.4.md +5 -0
- data/info/releasenotes/0.0.5.md +8 -0
- data/info/releasenotes/0.0.6.md +3 -0
- data/info/releasenotes/0.0.7.md +4 -0
- data/info/releasenotes/0.0.8.md +9 -0
- data/info/releasenotes/0.0.9.md +7 -0
- data/lib/mexico/cmd.rb +210 -0
- data/lib/mexico/constants.rb +82 -0
- data/lib/mexico/constraints/constraint.rb +85 -0
- data/lib/mexico/constraints/fiesta_constraints.rb +209 -0
- data/lib/mexico/constraints.rb +27 -0
- data/lib/mexico/core/corpus_core.rb +39 -0
- data/lib/mexico/core/design_core.rb +31 -0
- data/lib/mexico/core/media_type.rb +61 -0
- data/lib/mexico/core.rb +36 -0
- data/lib/mexico/fiesta/interfaces/b6_chat_game_interface.rb +222 -0
- data/lib/mexico/fiesta/interfaces/elan_interface.rb +143 -0
- data/lib/mexico/fiesta/interfaces/short_text_grid_interface.rb +99 -0
- data/lib/mexico/fiesta/interfaces/text_grid_interface.rb +103 -0
- data/lib/mexico/fiesta/interfaces.rb +31 -0
- data/lib/mexico/fiesta.rb +27 -0
- data/lib/mexico/file_system/bound_to_corpus.rb +37 -0
- data/lib/mexico/file_system/corpus.rb +207 -0
- data/lib/mexico/file_system/data.rb +96 -0
- data/lib/mexico/file_system/design.rb +75 -0
- data/lib/mexico/file_system/design_component.rb +78 -0
- data/lib/mexico/file_system/entry.rb +59 -0
- data/lib/mexico/file_system/fiesta_document.rb +344 -0
- data/lib/mexico/file_system/fiesta_map.rb +112 -0
- data/lib/mexico/file_system/head.rb +33 -0
- data/lib/mexico/file_system/id_ref.rb +46 -0
- data/lib/mexico/file_system/implicit_item_link.rb +19 -0
- data/lib/mexico/file_system/interval_link.rb +84 -0
- data/lib/mexico/file_system/item.rb +166 -0
- data/lib/mexico/file_system/item_link.rb +98 -0
- data/lib/mexico/file_system/item_links_proxy.rb +13 -0
- data/lib/mexico/file_system/layer.rb +89 -0
- data/lib/mexico/file_system/layer_connector.rb +74 -0
- data/lib/mexico/file_system/layer_link.rb +75 -0
- data/lib/mexico/file_system/local_file.rb +101 -0
- data/lib/mexico/file_system/participant.rb +69 -0
- data/lib/mexico/file_system/participant_role.rb +43 -0
- data/lib/mexico/file_system/point_link.rb +79 -0
- data/lib/mexico/file_system/property.rb +35 -0
- data/lib/mexico/file_system/property_map.rb +37 -0
- data/lib/mexico/file_system/resource.rb +174 -0
- data/lib/mexico/file_system/scale.rb +125 -0
- data/lib/mexico/file_system/section.rb +41 -0
- data/lib/mexico/file_system/static_collection_ref.rb +64 -0
- data/lib/mexico/file_system/template.rb +23 -0
- data/lib/mexico/file_system/trial.rb +87 -0
- data/lib/mexico/file_system/url.rb +65 -0
- data/lib/mexico/file_system.rb +62 -0
- data/lib/mexico/not_yet_implemented_error.rb +28 -0
- data/lib/mexico/util/fancy_container.rb +57 -0
- data/lib/mexico/util.rb +51 -0
- data/lib/mexico.rb +36 -0
- data/spec/constraints/constraints_spec.rb +306 -0
- data/spec/core/media_type_spec.rb +50 -0
- data/spec/fiesta/b6_spec.rb +43 -0
- data/spec/fiesta/elan_spec.rb +43 -0
- data/spec/fiesta/head_spec.rb +54 -0
- data/spec/fiesta/praat_spec.rb +54 -0
- data/spec/fiesta/read_spec.rb +76 -0
- data/spec/file_system_based/better_collection_spec.rb +142 -0
- data/spec/file_system_based/corpus_spec.rb +194 -0
- data/spec/file_system_based/design_spec.rb +100 -0
- data/spec/file_system_based/inter_links_spec.rb +100 -0
- data/spec/file_system_based/item_links_spec.rb +76 -0
- data/spec/file_system_based/rdf_spec.rb +177 -0
- data/spec/file_system_based/resource_spec.rb +111 -0
- data/spec/file_system_based/trial_spec.rb +129 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/toe/construct_and_write_spec.rb +82 -0
- data/spec/toe/construction_spec.rb +110 -0
- data/spec/toe/item_spec.rb +58 -0
- data/spec/toe/layer_spec.rb +63 -0
- data/spec/toe/scale_spec.rb +89 -0
- data/spec/toe/toe_document_spec.rb +39 -0
- data/test/helper.rb +19 -0
- data/test/test_mexico.rb +7 -0
- metadata +357 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# This file is part of the MExiCo gem.
|
|
2
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
3
|
+
# http://www.sfb673.org
|
|
4
|
+
#
|
|
5
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
7
|
+
# published by the Free Software Foundation, either version 3 of
|
|
8
|
+
# the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with MExiCo. If not, see
|
|
17
|
+
# <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'poseidon'
|
|
20
|
+
|
|
21
|
+
# Trials model the events from reality that form the ultimate substrate
|
|
22
|
+
# of a corpus. Trials are usually numbered sequentially. A trial
|
|
23
|
+
# stands for a specific clip or segment of reality, e.g., a time span
|
|
24
|
+
# and a location in space where the events under observation occurred.
|
|
25
|
+
class Mexico::FileSystem::Trial
|
|
26
|
+
|
|
27
|
+
include Mexico::FileSystem::BoundToCorpus
|
|
28
|
+
extend Mexico::FileSystem::IdRef
|
|
29
|
+
|
|
30
|
+
include ::ROXML
|
|
31
|
+
|
|
32
|
+
# identifier
|
|
33
|
+
xml_accessor :identifier, :from => '@identifier'
|
|
34
|
+
|
|
35
|
+
# type String
|
|
36
|
+
xml_accessor :name, :from => '@name'
|
|
37
|
+
|
|
38
|
+
# type String
|
|
39
|
+
xml_accessor :cue, :from => '@cue'
|
|
40
|
+
|
|
41
|
+
# type Integer
|
|
42
|
+
xml_accessor :running_number, :from => '@runningnumber', :as => Integer
|
|
43
|
+
|
|
44
|
+
# type String
|
|
45
|
+
xml_accessor :description, :from => "Description"
|
|
46
|
+
|
|
47
|
+
# attr_accessor :corpus
|
|
48
|
+
xml_accessor :design_id, :from => '@design_id'
|
|
49
|
+
|
|
50
|
+
# type Mexico::FileSystem::Design
|
|
51
|
+
id_ref :design
|
|
52
|
+
|
|
53
|
+
# POSEIdON-based RDF augmentation
|
|
54
|
+
include Poseidon
|
|
55
|
+
|
|
56
|
+
self_uri %q(http://cats.sfb673.org/Trial)
|
|
57
|
+
instance_uri_scheme %q(http://phoibos.sfb673.org/corpora/#{corpus.identifier}/trials/#{identifier})
|
|
58
|
+
|
|
59
|
+
rdf_property :identifier, %q(http://cats.sfb673.org/identifier)
|
|
60
|
+
rdf_property :name, %q(http://cats.sfb673.org/name)
|
|
61
|
+
rdf_property :description, %q(http://cats.sfb673.org/description)
|
|
62
|
+
rdf_property :cue, %q(http://cats.sfb673.org/cue)
|
|
63
|
+
rdf_property :running_number, %q(http://cats.sfb673.org/running_number)
|
|
64
|
+
|
|
65
|
+
# creates a new Trial object.
|
|
66
|
+
# @option opts [String] :identifier The identifier of the new trial object.
|
|
67
|
+
# @option opts [String] :description The identifier of the new trial object.
|
|
68
|
+
# @option opts [String] :cue The cue for the new trial object.
|
|
69
|
+
# @option opts [Integer] :running_number The running number for the new trial object.
|
|
70
|
+
def initialize(opts={})
|
|
71
|
+
# @corpus = corpus
|
|
72
|
+
[:identifier,:name,:description,:cue,:running_number].each do |att|
|
|
73
|
+
send("#{att}=", opts[att]) if opts.has_key?(att)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Returns a collection of resources that are associated with this trial.
|
|
78
|
+
# @return [Array<Resource>] an array of resources associated with this trial.
|
|
79
|
+
def resources
|
|
80
|
+
@corpus.resources.select{ |i| i.trial === self }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def linked_to_design?
|
|
84
|
+
return design!=nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# This file is part of the MExiCo gem.
|
|
2
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
3
|
+
# http://www.sfb673.org
|
|
4
|
+
#
|
|
5
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
7
|
+
# published by the Free Software Foundation, either version 3 of
|
|
8
|
+
# the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with MExiCo. If not, see
|
|
17
|
+
# <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
require 'poseidon'
|
|
20
|
+
|
|
21
|
+
# An URL object stands for a resource representation at the given location.
|
|
22
|
+
class Mexico::FileSystem::URL
|
|
23
|
+
|
|
24
|
+
include Mexico::FileSystem::BoundToCorpus
|
|
25
|
+
extend Mexico::FileSystem::IdRef
|
|
26
|
+
extend Mexico::FileSystem::StaticCollectionRef
|
|
27
|
+
|
|
28
|
+
include ::ROXML
|
|
29
|
+
|
|
30
|
+
xml_accessor :identifier, :from => '@identifier'
|
|
31
|
+
xml_accessor :name, :from => '@name'
|
|
32
|
+
xml_accessor :description, :from => 'Description'
|
|
33
|
+
|
|
34
|
+
xml_accessor :href, :from => "@href"
|
|
35
|
+
|
|
36
|
+
# POSEIdON-based RDF augmentation
|
|
37
|
+
include Poseidon
|
|
38
|
+
self_uri %q(http://cats.sfb673.org/URL)
|
|
39
|
+
instance_uri_scheme %q(http://phoibos.sfb673.org/corpora/#{corpus.identifier}/urls/#{identifier})
|
|
40
|
+
rdf_property :identifier, %q(http://cats.sfb673.org/identifier)
|
|
41
|
+
rdf_property :name, %q(http://cats.sfb673.org/name)
|
|
42
|
+
rdf_property :description, %q(http://cats.sfb673.org/description)
|
|
43
|
+
rdf_property :href, %q(http://cats.sfb673.org/href)
|
|
44
|
+
|
|
45
|
+
def initialize(opts={})
|
|
46
|
+
# @corpus = corpus
|
|
47
|
+
[:identifier,:name,:description].each do |att|
|
|
48
|
+
send("#{att}=", opts[att]) if opts.has_key?(att)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Retrieves a bunch of meta data with information about this resource representation.
|
|
53
|
+
# @return [Hash] A hash containing various information (size, mime_type, availability)
|
|
54
|
+
def info
|
|
55
|
+
# @todo Implement this method stub
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attempts to fetch the contents at this resource.
|
|
59
|
+
# @option opts [String] :format The format to be retrieved. If omitted, the standard format will be retrieved.
|
|
60
|
+
# @return [String or ByteArray] The file contents, as a string or binary object.
|
|
61
|
+
def get(opts = {} )
|
|
62
|
+
# @todo Implement this method stub
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# This file is part of the MExiCo gem.
|
|
2
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
3
|
+
# http://www.sfb673.org
|
|
4
|
+
#
|
|
5
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
7
|
+
# published by the Free Software Foundation, either version 3 of
|
|
8
|
+
# the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with MExiCo. If not, see
|
|
17
|
+
# <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
# The FileSystem module contains an implementation of the MExiCo
|
|
20
|
+
# library that works locally with a set of folders and files as
|
|
21
|
+
# its backend.
|
|
22
|
+
module Mexico::FileSystem
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#require 'mexico/file_system/file_system_utils.rb'
|
|
27
|
+
#require 'mexico/file_system/xml_based_collection.rb'
|
|
28
|
+
|
|
29
|
+
require 'mexico/file_system/bound_to_corpus.rb'
|
|
30
|
+
require 'mexico/file_system/id_ref.rb'
|
|
31
|
+
require 'mexico/file_system/static_collection_ref.rb'
|
|
32
|
+
|
|
33
|
+
require 'mexico/file_system/participant_role.rb'
|
|
34
|
+
require 'mexico/file_system/participant.rb'
|
|
35
|
+
require 'mexico/file_system/local_file.rb'
|
|
36
|
+
require 'mexico/file_system/url.rb'
|
|
37
|
+
require 'mexico/file_system/resource.rb'
|
|
38
|
+
|
|
39
|
+
require 'mexico/file_system/property.rb'
|
|
40
|
+
require 'mexico/file_system/property_map.rb'
|
|
41
|
+
require 'mexico/file_system/section.rb'
|
|
42
|
+
require 'mexico/file_system/head.rb'
|
|
43
|
+
require 'mexico/file_system/scale.rb'
|
|
44
|
+
require 'mexico/file_system/layer.rb'
|
|
45
|
+
require 'mexico/file_system/layer_connector.rb'
|
|
46
|
+
#require 'mexico/file_system/fiesta_list.rb'
|
|
47
|
+
require 'mexico/file_system/fiesta_map.rb'
|
|
48
|
+
require 'mexico/file_system/data.rb'
|
|
49
|
+
require 'mexico/file_system/layer_link.rb'
|
|
50
|
+
require 'mexico/file_system/item_link.rb'
|
|
51
|
+
require 'mexico/file_system/implicit_item_link.rb'
|
|
52
|
+
require 'mexico/file_system/point_link.rb'
|
|
53
|
+
require 'mexico/file_system/interval_link.rb'
|
|
54
|
+
require 'mexico/file_system/item.rb'
|
|
55
|
+
require 'mexico/file_system/fiesta_document.rb'
|
|
56
|
+
|
|
57
|
+
require 'mexico/file_system/trial.rb'
|
|
58
|
+
require 'mexico/file_system/design_component.rb'
|
|
59
|
+
require 'mexico/file_system/design.rb'
|
|
60
|
+
require 'mexico/file_system/corpus.rb'
|
|
61
|
+
|
|
62
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file is part of the MExiCo gem.
|
|
2
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
3
|
+
# http://www.sfb673.org
|
|
4
|
+
#
|
|
5
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
7
|
+
# published by the Free Software Foundation, either version 3 of
|
|
8
|
+
# the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with MExiCo. If not, see
|
|
17
|
+
# <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
# This class provides a corpus representation that is backed up by the filesystem.
|
|
20
|
+
# A central Corpus definition file in the top-level folder contains an
|
|
21
|
+
# XML representation of the corpus structure, and all actual resources are found
|
|
22
|
+
# as files on a file system reachable from the top-level folder.
|
|
23
|
+
|
|
24
|
+
class NotYetImplementedError < StandardError
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# This file is part of the MExiCo gem.
|
|
3
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
4
|
+
# http://www.sfb673.org
|
|
5
|
+
#
|
|
6
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
8
|
+
# published by the Free Software Foundation, either version 3 of
|
|
9
|
+
# the License, or (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
# License along with MExiCo. If not, see
|
|
18
|
+
# <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
# This module contains various helper methods.
|
|
21
|
+
module Mexico::Util::FancyContainer
|
|
22
|
+
|
|
23
|
+
#module ClassMethods
|
|
24
|
+
|
|
25
|
+
def add_fancy_container(container_name, p_back_collection_name=nil)
|
|
26
|
+
back_collection_name = p_back_collection_name.nil? ? "#{container_name.to_s}_container" : p_back_collection_name
|
|
27
|
+
define_method(container_name) do |*args|
|
|
28
|
+
coll = Array.new(instance_variable_get("@#{back_collection_name}"))
|
|
29
|
+
if args.is_a?(Enumerable)
|
|
30
|
+
if args.length==1
|
|
31
|
+
if args.first.is_a?(String)
|
|
32
|
+
# one argument in string form: assume an identifier, return a single object or nil
|
|
33
|
+
return instance_variable_get("@#{back_collection_name}").find{|x| x.identifier == args.first }
|
|
34
|
+
end
|
|
35
|
+
if args.first.is_a?(Hash)
|
|
36
|
+
# one argument in string form: assume a hash with conditions
|
|
37
|
+
args.first.each do |key,val|
|
|
38
|
+
if val.is_a?(String)
|
|
39
|
+
coll.select!{|c| c.send(key).to_s==val }
|
|
40
|
+
elsif val.is_a?(Regexp)
|
|
41
|
+
coll.select!{|c| c.send(key).to_s=~val }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
return coll
|
|
45
|
+
end
|
|
46
|
+
if args.first.is_a?(Integer)
|
|
47
|
+
return coll[args.first]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
# otherwise:
|
|
52
|
+
orig_coll = instance_variable_get("@#{back_collection_name}")
|
|
53
|
+
orig_coll = [] if orig_coll.nil?
|
|
54
|
+
Array.new(orig_coll)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/mexico/util.rb
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# This file is part of the MExiCo gem.
|
|
3
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
4
|
+
# http://www.sfb673.org
|
|
5
|
+
#
|
|
6
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
8
|
+
# published by the Free Software Foundation, either version 3 of
|
|
9
|
+
# the License, or (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
# License along with MExiCo. If not, see
|
|
18
|
+
# <http://www.gnu.org/licenses/>.
|
|
19
|
+
|
|
20
|
+
# This module contains various helper methods.
|
|
21
|
+
module Mexico::Util
|
|
22
|
+
|
|
23
|
+
# A list of umlauts and other special characters that are word characters in German.
|
|
24
|
+
UMLAUTS = {
|
|
25
|
+
"ä" => "ae",
|
|
26
|
+
"ö" => "oe",
|
|
27
|
+
"ü" => "ue",
|
|
28
|
+
"ß" => "ss"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Simple helper that strips away double quotes around a string.
|
|
32
|
+
# @param string [String] The string to be unquoted.
|
|
33
|
+
# @return [String] The unquoted string.
|
|
34
|
+
def self.strip_quotes(string)
|
|
35
|
+
return string.gsub(/^"/, '').gsub(/"$/, '')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Helper method that takes a name and sanitizes it for use as an XML/FiESTA id.
|
|
39
|
+
# @param string [String] The string to be converted to an ID.
|
|
40
|
+
# @return [String] The resulting ID.
|
|
41
|
+
def self.to_xml_id(string)
|
|
42
|
+
result = string.downcase
|
|
43
|
+
UMLAUTS.each_pair do |u,v|
|
|
44
|
+
result.gsub!(/#{u}/, v)
|
|
45
|
+
end
|
|
46
|
+
return result.gsub(/[^\w\d]/, '')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
require 'mexico/util/fancy_container'
|
data/lib/mexico.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This file is part of the MExiCo gem.
|
|
2
|
+
# Copyright (c) 2012-2014 Peter Menke, SFB 673, Universität Bielefeld
|
|
3
|
+
# http://www.sfb673.org
|
|
4
|
+
#
|
|
5
|
+
# MExiCo is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as
|
|
7
|
+
# published by the Free Software Foundation, either version 3 of
|
|
8
|
+
# the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# MExiCo is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with MExiCo. If not, see
|
|
17
|
+
# <http://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
require 'nokogiri'
|
|
22
|
+
require 'roxml'
|
|
23
|
+
require 'fileutils'
|
|
24
|
+
|
|
25
|
+
# This is the main module for the MExiCO gem.
|
|
26
|
+
module Mexico
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
require "mexico/core.rb"
|
|
31
|
+
require "mexico/util.rb"
|
|
32
|
+
require "mexico/constraints.rb"
|
|
33
|
+
require "mexico/file_system.rb"
|
|
34
|
+
require "mexico/constants.rb"
|
|
35
|
+
require "mexico/fiesta.rb"
|
|
36
|
+
require 'mexico/cmd.rb'
|