stepmod-utils 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d46a471013b96ac232688535ff7384c7044d166987ae53dd2e1fefd0009a73fb
4
- data.tar.gz: 39a320ba1cd3b7d05fcb34f17077d12ac036b1de3ed0db730af214f0127ceea0
3
+ metadata.gz: fd7dda08cc3511c8d5a25d912e1fc81872d2e8879c4065768e3032b1b7068296
4
+ data.tar.gz: f394c802254fd8443431452cd3eec62730d9def7e7628d8812f227daa7b689df
5
5
  SHA512:
6
- metadata.gz: 723e010d940375916081ed59592c413219f5b0fce10df237bf6504a8be5a40c7405a8b057ec8fe692f2307fcddaecf763cb23dd1a152d1ed1a7e07087e0f49a0
7
- data.tar.gz: ada92ea7ec12cbe80509a6f9d5a45d354211b9f9aa5a5f18e5dc2e86de58569a63572d65937ccba26917931a7315c016fa4bdd8f660602d46085cb190b1cd61b
6
+ metadata.gz: ece9c20e6fa654abc670182b432cb8dcdceddb58e1ccf9856d47beb77bc732af90c3395e2d704ea45c8c85dc15f967c68a5232b66ea3f04129d39fb9f6489cf7
7
+ data.tar.gz: 0bbb3bee01bef5443ffb39f5e1cc383228ad0d44c6745a7ec207a866abeb303f82e2638b9c04a1a3b5c073d8c903ef0da3f62f28ec0238c8b5b8b9e5fb195867
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- # Specify your gem's dependencies in stepmod-utils.gemspec
4
5
  gemspec
6
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
7
 
6
8
  gem "rake", "~> 12.0"
7
9
  gem "rspec", "~> 3.0"
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #!/usr/bin/env ruby
4
+ # encoding: UTF-8
5
+
6
+ # resolve bin path, ignoring symlinks
7
+ require "pathname"
8
+ bin_file = Pathname.new(__FILE__).realpath
9
+
10
+ # add self to libpath
11
+ $:.unshift File.expand_path("../../lib", bin_file)
12
+
13
+ # Fixes https://github.com/rubygems/rubygems/issues/1420
14
+ require "rubygems/specification"
15
+
16
+ class Gem::Specification
17
+ def this; self; end
18
+ end
19
+
20
+ require 'bundler/setup'
21
+ require 'stepmod/utils/stepmod_definition_converter'
22
+ require 'stepmod/utils/bibdata'
23
+ require 'stepmod/utils/concept'
24
+
25
+ ReverseAsciidoctor.config.unknown_tags = :bypass
26
+
27
+ parsed_terms = []
28
+ parsed_bibliography = []
29
+ encountered_terms = {}
30
+
31
+ paths = ARGV.map do |path|
32
+ path = "../iso-10303-stepmod/data"
33
+ puts "Searching for #{path}/{resource,module,application_protocol,business_object_model}.xml..."
34
+ Dir[
35
+ "#{path}/**/resource.xml",
36
+ "#{path}/**/application_protocol.xml",
37
+ "#{path}/**/business_object_model.xml",
38
+ "#{path}/**/module.xml"
39
+ ]
40
+ end.flatten.sort.uniq
41
+
42
+ paths.each do |file_path|
43
+ puts("Processing XML file #{file_path}")
44
+ current_document = Nokogiri::XML(File.read(file_path)).root
45
+
46
+ bibdata = nil
47
+ begin
48
+ bibdata = Stepmod::Utils::Bibdata.new(document: current_document)
49
+ rescue
50
+ puts "WARNING: Unknown file #{file_path}, skipped"
51
+ next
52
+ end
53
+
54
+ if bibdata.part.to_s.empty?
55
+ puts "FATAL: missing `part` attribute: #{file_path}"
56
+ end
57
+
58
+ # read definitions
59
+ current_document.xpath('//definition').each.with_index(1) do |definition, index|
60
+
61
+ term_id = definition['id']
62
+ unless term_id.nil?
63
+ if encountered_terms[term_id]
64
+ puts "FATAL: Duplicated term with id: #{term_id}, #{file_path}"
65
+ end
66
+ encountered_terms[term_id] = true
67
+ end
68
+
69
+ concept = Stepmod::Utils::Concept.parse(
70
+ definition,
71
+ reference_anchor: bibdata.anchor,
72
+ # Assume that definition is located in clause 3 of the ISO document
73
+ # in order. We really don't have a good reference here.
74
+ reference_clause: "3.#{index}"
75
+ )
76
+
77
+ parsed_terms << concept
78
+ parsed_bibliography << bibdata
79
+ end
80
+
81
+ end
82
+
83
+ parsed_bibliography.uniq!
84
+
85
+ File.open('031-generated-terms.adoc', 'w') { |file|
86
+ file.puts(parsed_terms.map(&:to_mn_adoc).join("\n"))
87
+ }
88
+
89
+ File.open('991-generated-bibliography.adoc', 'w') { |file|
90
+ file.puts(parsed_bibliography.map(&:to_mn_adoc).join("\n"))
91
+ }
@@ -0,0 +1,122 @@
1
+ module Stepmod
2
+ module Utils
3
+
4
+ class Bibdata
5
+
6
+ DOCNUMBER = 10303
7
+
8
+ attr_accessor *%w(
9
+ type doctype part title_en title_fr version language pub_year pub_date
10
+ )
11
+
12
+ def initialize(document:)
13
+ return nil unless document.is_a?(Nokogiri::XML::Element)
14
+
15
+ # module, resource, application_protocol, business_object_model
16
+ @type = document.name
17
+
18
+ raise 'UnknownFileError' unless %w(module resource application_protocol business_object_model).include?(@type)
19
+
20
+ @doctype = document['status']
21
+ @part = document['part']
22
+ @title_en = document['title'] ||
23
+ document['name'].gsub('_', ' ').capitalize.gsub('2d','2D').gsub('3d','3D')
24
+ @title_fr = document['name.french']
25
+ @version = document['version']
26
+ @language = document['language']
27
+
28
+ # Some publication.year contains month...
29
+ @pub_year = document['publication.year'].split('-').first
30
+ @pub_date = document['publication.date']
31
+
32
+ puts to_mn_adoc
33
+
34
+ return self
35
+ # <module
36
+ # name="security_classification"
37
+ # name.french="Classification des s&#233;curit&#233;s"
38
+ # part="1015"
39
+ # wg.number="1095"
40
+ # wg.number.supersedes="720"
41
+ # wg.number.arm.supersedes="1096"
42
+ # wg.number.arm="3221"
43
+ # wg.number.mim="1097"
44
+ # checklist.internal_review="2133"
45
+ # checklist.project_leader="2134"
46
+ # checklist.convener="2135"
47
+ # version="1"
48
+ # status="TS"
49
+ # language="E"
50
+ # publication.year="2004"
51
+ # publication.date="2004-12-01"
52
+ # published="y"
53
+ # rcs.date="$Date: 2009/11/02 10:59:35 $"
54
+ # rcs.revision="$Revision: 1.26 $"
55
+ # development.folder="dvlp"
56
+ # >
57
+
58
+ end
59
+
60
+ def docid
61
+ no_date = case doctype
62
+ when "IS"
63
+ "ISO #{DOCNUMBER}-#{part}"
64
+ when "WD"
65
+ "ISO/WD #{DOCNUMBER}-#{part}"
66
+ when "CD"
67
+ "ISO/CD #{DOCNUMBER}-#{part}"
68
+ when "DIS"
69
+ "ISO/DIS #{DOCNUMBER}-#{part}"
70
+ when "TS"
71
+ "ISO/TS #{DOCNUMBER}-#{part}"
72
+ when "CD-TS"
73
+ "ISO/CD TS #{DOCNUMBER}-#{part}"
74
+ else
75
+ "UNKNOWN DOCTYPE: (#{doctype})"
76
+ end
77
+
78
+ if pub_year
79
+ "#{no_date}:#{pub_year}"
80
+ else
81
+ no_date
82
+ end
83
+ end
84
+
85
+ def part_title
86
+ case part
87
+ when [200..299]
88
+ "Application protocol: #{title_en}"
89
+ when [300..399]
90
+ "Abstract test suite: #{title_en}"
91
+ when [400..499]
92
+ "Application module: #{title_en}"
93
+ when [500..599]
94
+ "Application interpreted construct: #{title_en}"
95
+ when [1000..1799]
96
+ "Application module: #{title_en}"
97
+ else
98
+ title_en
99
+ end
100
+ end
101
+
102
+ def full_title
103
+ "Industrial automation systems and integration -- Product data representation and exchange -- Part #{part}: #{part_title}"
104
+ end
105
+
106
+ def anchor
107
+ docid.gsub('/', '-').gsub(' ', '_')
108
+ end
109
+
110
+ def to_mn_adoc
111
+ if title_en
112
+ "* [[[ISO#{DOCNUMBER}-#{part},#{docid}]]], _#{full_title}_"
113
+ else
114
+ "* [[[ISO#{DOCNUMBER}-#{part},#{docid}]]]"
115
+ end
116
+ end
117
+
118
+ end
119
+
120
+ end
121
+ end
122
+
@@ -0,0 +1,32 @@
1
+ module Stepmod
2
+ module Utils
3
+
4
+ class Concept
5
+ attr_accessor *%w(designation definition reference_anchor reference_clause examples notes synonym converted_definition)
6
+
7
+ def initialize(options)
8
+ options.each_pair do |k, v|
9
+ send("#{k}=", v)
10
+ end
11
+ end
12
+
13
+ def self.parse(definition_xml, reference_anchor:, reference_clause:)
14
+ new(
15
+ converted_definition: Stepmod::Utils::StepmodDefinitionConverter.convert(definition_xml),
16
+ reference_anchor: reference_anchor,
17
+ reference_clause: reference_clause
18
+ )
19
+ end
20
+
21
+ def to_mn_adoc
22
+ <<~TEXT
23
+ #{converted_definition}
24
+
25
+ [.source]
26
+ <<#{reference_anchor},clause=#{reference_clause}>>
27
+ TEXT
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class ClauseRef < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, _state = {})
8
+ " term:[#{normalized_ref(node['linkend'])}] "
9
+ end
10
+
11
+ private
12
+
13
+ def normalized_ref(ref)
14
+ return unless ref || ref.empty?
15
+
16
+ ref.to_s.split(':').last.squeeze(' ').strip
17
+ end
18
+ end
19
+ ReverseAsciidoctor::Converters.register :clause_ref, ClauseRef.new
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,61 @@
1
+
2
+ module Stepmod
3
+ module Utils
4
+ module Converters
5
+ class Def < ReverseAsciidoctor::Converters::Base
6
+ def convert(node, state = {})
7
+ node = node.dup
8
+ "#{additional_block(node)}#{treat_children(node, state)}"
9
+ end
10
+
11
+ private
12
+
13
+ def treat_children(node, state)
14
+ converted = node.children.each_with_object({}) do |child, res|
15
+ content = treat(child, state)
16
+ .split("\n")
17
+ .map(&:strip)
18
+ .reject(&:empty?)
19
+ .join("\n")
20
+ .strip
21
+ next if content.empty?
22
+
23
+ res[child] = content
24
+ end
25
+ previous = nil
26
+ result = ''
27
+ converted.each.with_index do |(child, content), i|
28
+ if i == 0 || inlinde_tag?(child, previous)
29
+ result += " #{content}"
30
+ else
31
+ result += "\n\n#{content}"
32
+ end
33
+ previous = child
34
+ end
35
+ result.strip
36
+ end
37
+
38
+ def inlinde_tag?(child, previous)
39
+ %w[text sub i clause_ref].include?(child.name) && previous && %w[i sub text clause_ref].include?(previous.name)
40
+ end
41
+
42
+ def additional_block(node)
43
+ # Treat first `p` tag as an `alt` block, metanorma/stepmod-utils#9
44
+ first_child_tag = node
45
+ .children
46
+ .find { |n| n.is_a?(Nokogiri::XML::Element) }
47
+ return unless first_child_tag&.name == 'p' &&
48
+ defined?(Stepmod::Utils::Converters::Synonym)
49
+
50
+ result = Stepmod::Utils::Converters::Synonym
51
+ .new
52
+ .convert(first_child_tag)
53
+ first_child_tag.remove
54
+ "#{result}\n\n"
55
+ end
56
+ end
57
+
58
+ ReverseAsciidoctor::Converters.register :def, Def.new
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Definition < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ treat_children(node, state)
9
+ end
10
+
11
+ private
12
+
13
+ def treat_children(node, state)
14
+ res = node.children.map { |child| treat(child, state) }
15
+ res.map(&:strip).reject(&:empty?).join("\n\n")
16
+ end
17
+ end
18
+
19
+ ReverseAsciidoctor::Converters.register :definition, Definition.new
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Em < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ content = treat_children(node, state.merge(already_italic: true))
9
+ if content.strip.empty? || state[:already_italic]
10
+ content
11
+ else
12
+ "#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}"
13
+ end
14
+ end
15
+ end
16
+
17
+ ReverseAsciidoctor::Converters.register :em, Em.new
18
+ ReverseAsciidoctor::Converters.register :cite, Em.new
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Example < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ <<~TEMPLATE
9
+ [example]
10
+ ====
11
+ #{treat_children(node, state).strip}
12
+ ====
13
+ TEMPLATE
14
+ end
15
+ end
16
+ ReverseAsciidoctor::Converters.register :example, Example.new
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class ExpressRef < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, _state = {})
8
+ "*#{node['linkend'].to_s.split('.').last}*"
9
+ end
10
+ end
11
+ ReverseAsciidoctor::Converters.register :express_ref, ExpressRef.new
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class ModuleRef < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, _state = {})
8
+ " term:[#{node['linkend']}] "
9
+ end
10
+ end
11
+ ReverseAsciidoctor::Converters.register :module_ref, ModuleRef.new
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Note < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ <<~TEMPLATE
9
+ [NOTE]
10
+ --
11
+ #{treat_children(node, state).strip}
12
+ --
13
+ TEMPLATE
14
+ end
15
+ end
16
+ ReverseAsciidoctor::Converters.register :note, Note.new
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'stepmod/utils/converters/em'
4
+
5
+ module Stepmod
6
+ module Utils
7
+ module Converters
8
+ class Stem < ReverseAsciidoctor::Converters::Base
9
+ def convert(node, state = {})
10
+ return Em.new.convert(node, state) if node.text.strip.length > 8
11
+
12
+ " stem:[#{node.text.strip}] "
13
+ end
14
+ end
15
+
16
+ ReverseAsciidoctor::Converters.register :i, Stem.new
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Synonym < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ "alt:[#{node.text.strip}]"
9
+ end
10
+ end
11
+
12
+ ReverseAsciidoctor::Converters.register :synonym, Synonym.new
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stepmod
4
+ module Utils
5
+ module Converters
6
+ class Term < ReverseAsciidoctor::Converters::Base
7
+ def convert(node, state = {})
8
+ "=== #{treat_children(node, state).strip}"
9
+ end
10
+ end
11
+
12
+ ReverseAsciidoctor::Converters.register :term, Term.new
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'reverse_asciidoctor'
4
+ require 'stepmod/utils/converters/clause_ref'
5
+ require 'stepmod/utils/converters/express_ref'
6
+ require 'stepmod/utils/converters/module_ref'
7
+ require 'stepmod/utils/converters/def'
8
+ require 'stepmod/utils/converters/definition'
9
+ require 'stepmod/utils/converters/em'
10
+ require 'stepmod/utils/converters/example'
11
+ require 'stepmod/utils/converters/note'
12
+ require 'stepmod/utils/converters/stem'
13
+ require 'stepmod/utils/converters/term'
14
+ require 'stepmod/utils/converters/synonym'
15
+
16
+ require 'reverse_asciidoctor/converters/a'
17
+ require 'reverse_asciidoctor/converters/blockquote'
18
+ require 'reverse_asciidoctor/converters/bypass'
19
+ require 'reverse_asciidoctor/converters/br'
20
+ require 'reverse_asciidoctor/converters/code'
21
+ require 'reverse_asciidoctor/converters/drop'
22
+ require 'reverse_asciidoctor/converters/head'
23
+ require 'reverse_asciidoctor/converters/hr'
24
+ require 'reverse_asciidoctor/converters/ignore'
25
+ require 'reverse_asciidoctor/converters/li'
26
+ require 'reverse_asciidoctor/converters/ol'
27
+ require 'reverse_asciidoctor/converters/p'
28
+ require 'reverse_asciidoctor/converters/pass_through'
29
+ require 'reverse_asciidoctor/converters/q'
30
+ require 'reverse_asciidoctor/converters/strong'
31
+ require 'reverse_asciidoctor/converters/sup'
32
+ require 'reverse_asciidoctor/converters/sub'
33
+ require 'reverse_asciidoctor/converters/text'
34
+
35
+
36
+ module Stepmod
37
+ module Utils
38
+ class StepmodDefinitionConverter
39
+ def self.convert(input, options = {})
40
+ root = if input.is_a?(String)
41
+ then Nokogiri::XML(input).root
42
+ elsif input.is_a?(Nokogiri::XML::Document)
43
+ then input.root
44
+ elsif input.is_a?(Nokogiri::XML::Node)
45
+ then input
46
+ end
47
+
48
+ root || (return '')
49
+
50
+ ReverseAsciidoctor.config.with(options) do
51
+ result = ReverseAsciidoctor::Converters.lookup(root.name).convert(root)
52
+ ReverseAsciidoctor.cleaner.tidy(result)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -0,0 +1,302 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- $Id: resource.xml,v 1.22 2009/11/02 11:00:33 lothartklein Exp $ -->
3
+ <!DOCTYPE resource SYSTEM "../../../dtd/res_doc/resource.dtd">
4
+ <!-- Generated by mkresource.js, Eurostep Limited, http://www.eurostep.com -->
5
+ <!--
6
+ To view the resource in IExplorer, open: sys/1_scope.xml
7
+ -->
8
+ <resource
9
+ name="classification_and_set_theory"
10
+ name.french="Classification et théorie des ensembles"
11
+ part="54"
12
+ version="1"
13
+ wg.number="3212"
14
+ wg.number.supersedes="1509"
15
+ wg.number.express="3213"
16
+ wg.number.express.supersedes="1510"
17
+ checklist.internal_review="3215"
18
+ checklist.project_leader="3216"
19
+ checklist.convener="3217"
20
+ sc4.working_group="12"
21
+ status="IS"
22
+ language="E"
23
+ publication.date="2005-03-15"
24
+ publication.year="2005"
25
+ published="n"
26
+ development.folder="dvlp"
27
+ rcs.date="$Date: 2009/11/02 11:00:33 $"
28
+ rcs.revision="$Revision: 1.22 $">
29
+
30
+ <keywords>
31
+ resource, STEP, 10303, integrated resources, set theory, class, classification, specialisation, subset, superset,
32
+ union, intersection, complement power set
33
+ </keywords>
34
+ <!-- the abstract for the resource. If not provided, the XSL will use the inscope -->
35
+ <abstract>
36
+ <p>ISO 10303-54 specifies:</p>
37
+ <ul>
38
+ <li>that an object is a member of a set, and can define a finite set by enumerating all its members;</li>
39
+ <li>that the relationship between two sets is proper subset, subset, or equal;</li>
40
+ <li>that a set is result of a union, intersection, complement or powerset operation.</li>
41
+ </ul>
42
+ </abstract>
43
+ <!-- the abstract for the resource. If not provided, the XSL will use the in scope
44
+ <abstract>
45
+ <li>a specification that an object is a member of a set;</li>
46
+ <li>a specification of all the members of a finite set;</li>
47
+ <li>a specification that one set is a proper subset of, is a
48
+ subset of, or is equal to another;</li>
49
+ <li>a specification that a set is result of a union,
50
+ intersection, complement or powerset operation.</li>
51
+ </abstract>
52
+ -->
53
+ <!-- Reference to contacts detailed in stepmod/data/basic/contacts.xml -->
54
+ <contacts>
55
+ <projlead ref="ap221.projlead" />
56
+ <editor ref="ap221.projeditor" />
57
+ </contacts>
58
+
59
+ <!-- Introduction -->
60
+ <!-- The introduction should start as shown: -->
61
+ <purpose>
62
+ <p>
63
+ This part of ISO 10303 specifies an application resource for the
64
+ representation of classes or sets and classification relationships. This part of ISO 10303 also supports the
65
+ following set theory relationships:</p>
66
+ <ul>
67
+ <li>complement;</li>
68
+ <li>intersection;</li>
69
+ <li>power set;</li>
70
+ <li>proper subset;</li>
71
+ <li>same membership (that is, set equality);</li>
72
+ <li>subset;</li>
73
+ <li>union.</li>
74
+ </ul>
75
+ </purpose>
76
+
77
+ <!-- Schema Interface express-g diagrams -->
78
+ <!-- refer to p41ed2 as example -->
79
+ <schema_diag>
80
+ <express-g>
81
+ <imgfile title="Relationship between schemas in ISO 10303-54" file="schema_diagexpg1.xml" />
82
+ </express-g>
83
+ </schema_diag>
84
+
85
+ <!-- Items in scope -->
86
+ <inscope>
87
+ <li>the existence of a class or set;</li>
88
+ <li>the distinction between a class or set that is defined by abstract criteria, and a class or set that is defined
89
+ by enumerating its members;</li>
90
+
91
+
92
+ <li>the classification relationship between a class or set and a member;</li>
93
+
94
+ <li>the complete enumeration of the members for a class or set;</li>
95
+ <li> the representation of set theory relationships between classes or sets;</li>
96
+
97
+ <li>the following set theory relationships:
98
+ <ul>
99
+ <li>complement;</li>
100
+ <li>equivalence;</li>
101
+ <li>intersection;</li>
102
+ <li>power set;</li>
103
+ <li>proper subset;</li>
104
+ <li>subset;</li>
105
+ <li>union.</li>
106
+ </ul>
107
+ </li>
108
+ </inscope>
109
+
110
+ <!-- Items out of scope -->
111
+ <outscope>
112
+ <li>mappings between sets or classes;</li>
113
+ <li>relationships that are not classification or set theory relationships; </li>
114
+ <li>entities and relationships specific to continuous sets.
115
+ <note number="1">
116
+ <p>All the entities and relationships within this part of ISO 10303 are equally valid for discrete and
117
+ continuous sets.</p>
118
+ </note>
119
+ <note number="2">
120
+ <p>Entities and relationships for continuous sets can be created in anntotated EXPRESS schemas that use or
121
+ specialize entities in this part of ISO 10303, as follows:</p>
122
+ <ul>
123
+ <li><b>discrete_class_by_intension</b> and <b>continuous_set</b> can be disjoint subtypes of
124
+ <express_ref linkend="classification_and_set_theory:ir:classification_schema.class_by_intension" />;</li>
125
+ <li><b>open_set</b> and <b>closed_set</b> can be disjoint subtypes of <b>continuous_set</b>;</li>
126
+ <li><b>closure</b> can be the relationship between an <b>open_set</b> and the <b>closed_set</b> that is its
127
+ <b>boundary</b>.</li>
128
+ </ul>
129
+ </note>
130
+ </li>
131
+ </outscope>
132
+
133
+ <normrefs>
134
+ <normref.inc normref="ref10303-41" />
135
+ </normrefs>
136
+
137
+ <definition>
138
+ <term id="set">set
139
+ </term>
140
+ <synonym>class</synonym>
141
+ <def>
142
+ <p>number of things considered together</p>
143
+ <note number="1"> A set that is defined by enumerating its members is a 'class by intension'.</note>
144
+ <note number="2">A set that is defined by means of criteria that do not enumerate the members is a 'class by
145
+ extension'.</note>
146
+ </def>
147
+ </definition>
148
+ <!--
149
+ <abbreviations/>
150
+ -->
151
+
152
+ <schema name="classification_schema" version="1">
153
+ <!-- Note schema EXPRESS are in ..\resources\resource_name name_of_schema.xml -->
154
+ <introduction>The classification_schema specifies a class, and a classification relationship between a class and a
155
+ member of a class.
156
+ </introduction>
157
+ <fund_cons>
158
+ <p>For many different entity types defined within ISO 10303, an instance may stand for a class or set of things.
159
+ The fact that an instance stands for a class or set of things can be made explicit by creating a compound
160
+ instance of:</p>
161
+ <ul>
162
+ <li>the entity type class defined in this part of ISO 10303, and</li>
163
+ <li>
164
+ another entity type defined in ISO 10303. </li>
165
+ </ul>
166
+ <p>Members can be specified for an instance of the entity type class. An instance of the entity type class can be
167
+ involved in set theory relationships, such as union or intersection, with other instances of the entity type
168
+ class.</p>
169
+ <note>Instances of the entity types product, product_definition_formation and product_definition in ISO 10303-41
170
+ can be classes. In order to allow set theory relationships for these classes, an application protocol or
171
+ application module can define a subtype of:</note>
172
+ <ul>
173
+ <li>product_definition_formation (from ISO 10303-41);</li>
174
+ <li>class (from this part of ISO 10303).</li>
175
+ </ul>
176
+ <example number="1">
177
+ Pump model 'XYZ_123' is a product_definition_formation and a class. This class is a class_by_extension.
178
+ </example>
179
+
180
+ <example number="2">The set of pumps enumerated in maintenance contract '98/1234' is a class. This class is a
181
+ class_by_intension.</example>
182
+
183
+ <example number="3">The relationship between individual pump 'X/85/4567' and pump model 'XYZ_123', that indicates
184
+ the model of the pump, is a classification.</example>
185
+ <example number="4">The relationship between individual pump 'X/85/4567' and the set of pumps enumerated in
186
+ maintenance contract '98/1234', that indicates it is one of the set, is a classification. The complete set of
187
+ pumps covered by the contract can be defined by an instance of the entity type complete_membership.
188
+ </example>
189
+ <example number="5">The set of pumps that are both within maintenance contract '98/1234' and of pump model
190
+ 'XYZ_123' can be defined by the set theory relationship intersection.</example>
191
+ </fund_cons>
192
+
193
+ <!-- EXPRESS-G -->
194
+ <express-g>
195
+ <imgfile file="classification_schemaexpg2.xml" />
196
+ </express-g>
197
+ </schema>
198
+ <schema name="set_theory_schema" version="1">
199
+ <!-- Note schema EXPRESS are in ..\resources\resource_name name_of_schema.xml -->
200
+ <introduction>The set_theory_schema specifies the following relationships between classes:
201
+ <ul>
202
+ <li>complement;</li>
203
+ <li>intersection;</li>
204
+ <li>power set;</li>
205
+ <li>proper subset;</li>
206
+ <li>same membership (that is, set equality);</li>
207
+ <li>subset;</li>
208
+ <li>union.</li>
209
+ </ul>
210
+ </introduction>
211
+ <fund_cons>
212
+ <p>The set theory schema defines set theory relationship between classes or sets.</p>
213
+
214
+ <note number="1">In this part of ISO 10303, the terms class and set are synonyms.</note>
215
+
216
+ <p>In order to use this schema the entity that records the class or set shall be
217
+ <express_ref linkend="classification_and_set_theory:ir:classification_schema.class" /> or a subtype of
218
+ <express_ref linkend="classification_and_set_theory:ir:classification_schema.class" />.</p>
219
+ <example number="1">
220
+ <p>Consider the following instances of
221
+ <express_ref linkend="classification_and_set_theory:ir:classification_schema.class" />:</p>
222
+ <ul>
223
+ <li>
224
+ pump model 'XYZ_123', which is a
225
+ <express_ref
226
+ linkend="product_definition_schema:ir_express:product_definition_schema.product_definition_formation" />
227
+
228
+ and a
229
+ <express_ref linkend="classification_and_set_theory:ir:classification_schema.class" />; and </li>
230
+ <li>
231
+ the set of pumps enumerated in maintenance contract '98/1234'.
232
+ </li>
233
+ </ul>
234
+ <p>An instance of the relationship
235
+ <express_ref linkend="classification_and_set_theory:ir:set_theory_schema.subset" />
236
+
237
+ indicates that each of the set of pumps enumerated in maintenance contract '98/1234' is of pump model
238
+ 'XYZ_123'.
239
+ </p>
240
+ </example>
241
+
242
+ <example number="2">
243
+ <p>An organization has pumps of type A and type B. Some pumps handle radioactive fluids. There are the following
244
+ classes of activity:</p>
245
+ <ul>
246
+ <li>
247
+ SA - service pump type A;</li>
248
+ <li>
249
+ SB - service pump type B;</li>
250
+ <li>
251
+ DR - service equipment that has handled radioactive fluids.
252
+ </li>
253
+ </ul>
254
+ <p>For workflow management purposes, the following derived class of activity is defined:</p>
255
+ <ul>
256
+ <li>
257
+ DRS - service pump that has handled radioactive fluids.
258
+ </li>
259
+ </ul>
260
+ <p>This class is the
261
+ <express_ref linkend="classification_and_set_theory:ir:set_theory_schema.intersection" />
262
+
263
+ of class DR with the
264
+ <express_ref linkend="classification_and_set_theory:ir:set_theory_schema.union" />
265
+
266
+ of classes SA and SB.</p>
267
+ </example>
268
+ </fund_cons>
269
+
270
+ <!-- EXPRESS-G -->
271
+ <express-g>
272
+ <imgfile file="set_theory_schemaexpg2.xml" />
273
+ </express-g>
274
+ </schema>
275
+
276
+
277
+ <shortnames>
278
+ <shortname entity="class" name="CLASS" />
279
+ <shortname entity="class_by_extension" name="CLBYEX" />
280
+ <shortname entity="class_by_intension" name="CLBYIN" />
281
+ <shortname entity="classification" name="CLSSFC" />
282
+ <shortname entity="complete_membership" name="CMPMMB" />
283
+ <shortname entity="complete_membership_of_empty_set" name="CMOES" />
284
+ <shortname entity="complete_membership_of_non_empty_set" name="CMONES" />
285
+ <shortname entity="complement" name="CMPLMN" />
286
+ <shortname entity="intersection" name="INTRSC" />
287
+ <shortname entity="power_set" name="PWRST" />
288
+ <shortname entity="proper_subset" name="PRPSBS" />
289
+ <shortname entity="same_membership" name="SMMMB" />
290
+ <shortname entity="subset" name="SUBSET" />
291
+ <shortname entity="union" name="UNION" />
292
+ <shortname entity="union_of_all_members" name="UOAM" />
293
+ </shortnames>
294
+ <!--
295
+ <tech_discussion/>
296
+
297
+ <examples/>
298
+
299
+ <add_scope/>
300
+ -->
301
+ <!-- <bibliography/> -->
302
+ </resource>
@@ -6,11 +6,9 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Ribose Inc."]
7
7
  spec.email = ["open.source@ribose.com"]
8
8
 
9
- spec.summary = "stepmod-utils converts NISO STS XML into Metanorma XML."
9
+ spec.summary = "Stepmod-utils is a toolkit that works on STEPmod data."
10
10
  spec.description = <<~DESCRIPTION
11
- stepmod-utils converts NISO STS XML into Metanorma XML.
12
- This gem is a wrapper around stepmod-utils.jar available from
13
- https://github.com/metanorma/stepmod-utils, with versions matching the JAR file.
11
+ Stepmod-utils is a toolkit that works on STEPmod data.
14
12
  DESCRIPTION
15
13
 
16
14
  spec.homepage = "https://github.com/metanorma/stepmod-utils"
@@ -33,4 +31,5 @@ Gem::Specification.new do |spec|
33
31
 
34
32
  spec.add_runtime_dependency "thor", "~> 1.0"
35
33
  spec.add_runtime_dependency "reverse_adoc", "~> 0.2"
34
+ spec.add_development_dependency "byebug", "~> 11.1"
36
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stepmod-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,13 +38,27 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.2'
41
- description: |
42
- stepmod-utils converts NISO STS XML into Metanorma XML.
43
- This gem is a wrapper around stepmod-utils.jar available from
44
- https://github.com/metanorma/stepmod-utils, with versions matching the JAR file.
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '11.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.1'
55
+ description: 'Stepmod-utils is a toolkit that works on STEPmod data.
56
+
57
+ '
45
58
  email:
46
59
  - open.source@ribose.com
47
- executables: []
60
+ executables:
61
+ - term_extractor
48
62
  extensions: []
49
63
  extra_rdoc_files: []
50
64
  files:
@@ -60,8 +74,24 @@ files:
60
74
  - Rakefile
61
75
  - bin/console
62
76
  - bin/setup
77
+ - exe/term_extractor
63
78
  - lib/stepmod/utils.rb
79
+ - lib/stepmod/utils/bibdata.rb
80
+ - lib/stepmod/utils/concept.rb
81
+ - lib/stepmod/utils/converters/clause_ref.rb
82
+ - lib/stepmod/utils/converters/def.rb
83
+ - lib/stepmod/utils/converters/definition.rb
84
+ - lib/stepmod/utils/converters/em.rb
85
+ - lib/stepmod/utils/converters/example.rb
86
+ - lib/stepmod/utils/converters/express_ref.rb
87
+ - lib/stepmod/utils/converters/module_ref.rb
88
+ - lib/stepmod/utils/converters/note.rb
89
+ - lib/stepmod/utils/converters/stem.rb
90
+ - lib/stepmod/utils/converters/synonym.rb
91
+ - lib/stepmod/utils/converters/term.rb
92
+ - lib/stepmod/utils/stepmod_definition_converter.rb
64
93
  - lib/stepmod/utils/version.rb
94
+ - resource_example.xml
65
95
  - stepmod-utils.gemspec
66
96
  homepage: https://github.com/metanorma/stepmod-utils
67
97
  licenses:
@@ -85,5 +115,5 @@ requirements: []
85
115
  rubygems_version: 3.0.3
86
116
  signing_key:
87
117
  specification_version: 4
88
- summary: stepmod-utils converts NISO STS XML into Metanorma XML.
118
+ summary: Stepmod-utils is a toolkit that works on STEPmod data.
89
119
  test_files: []