fabulator 0.0.6 → 0.0.7
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.
- data/History.txt +20 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/features/step_definitions/expression_steps.rb +1 -1
- data/features/step_definitions/xml_steps.rb +2 -1
- data/features/support/env.rb +1 -0
- data/lib/fabulator.rb +13 -5
- data/lib/fabulator/action.rb +86 -19
- data/lib/fabulator/core/actions.rb +21 -6
- data/lib/fabulator/core/actions/choose.rb +16 -35
- data/lib/fabulator/core/actions/for_each.rb +20 -30
- data/lib/fabulator/core/actions/variables.rb +6 -8
- data/lib/fabulator/core/constraint.rb +2 -2
- data/lib/fabulator/core/filter.rb +0 -13
- data/lib/fabulator/core/group.rb +21 -25
- data/lib/fabulator/core/parameter.rb +5 -17
- data/lib/fabulator/core/state.rb +4 -44
- data/lib/fabulator/core/state_machine.rb +10 -38
- data/lib/fabulator/core/transition.rb +6 -39
- data/lib/fabulator/expr/axis.rb +2 -2
- data/lib/fabulator/expr/bin_expr.rb +3 -3
- data/lib/fabulator/expr/context.rb +37 -6
- data/lib/fabulator/expr/function.rb +9 -3
- data/lib/fabulator/expr/literal.rb +1 -1
- data/lib/fabulator/expr/node.rb +1 -1
- data/lib/fabulator/expr/node_logic.rb +1 -1
- data/lib/fabulator/expr/parser.rb +1 -1
- data/lib/fabulator/expr/predicates.rb +1 -1
- data/lib/fabulator/expr/statement_list.rb +4 -0
- data/lib/fabulator/expr/union_expr.rb +1 -1
- data/lib/fabulator/lib.rb +69 -0
- data/lib/fabulator/lib/action.rb +13 -0
- data/lib/fabulator/lib/attribute.rb +9 -0
- data/lib/fabulator/lib/lib.rb +47 -0
- data/lib/fabulator/lib/structural.rb +13 -0
- data/lib/fabulator/structural.rb +92 -0
- data/lib/fabulator/{action_lib.rb → tag_lib.rb} +89 -51
- data/lib/fabulator/template/standard_tags.rb +4 -3
- data/xsm_expression_parser.racc +1 -1
- metadata +27 -8
- data/TODO +0 -7
- data/features/xsm-inheritance.feature +0 -46
@@ -2,6 +2,7 @@ module Fabulator
|
|
2
2
|
module Expr
|
3
3
|
class Function
|
4
4
|
def initialize(ctx, nom, args)
|
5
|
+
nom.gsub(/\s+/, '')
|
5
6
|
bits = nom.split(/:/, 2)
|
6
7
|
@ns = ctx.get_ns(bits[0])
|
7
8
|
@name = bits[1]
|
@@ -13,17 +14,22 @@ module Fabulator
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def expr_type(context)
|
16
|
-
|
17
|
+
return [ FAB_NS, 'boolean' ] if @name =~ /\?$/
|
18
|
+
klass = TagLib.namespaces[@ns]
|
17
19
|
(klass.function_return_type(@name) rescue nil)
|
18
20
|
end
|
19
21
|
|
20
22
|
def run(context, autovivify = false)
|
21
|
-
klass =
|
23
|
+
klass = TagLib.namespaces[@ns]
|
22
24
|
return [] if klass.nil?
|
23
25
|
ctx = @ctx.merge(context)
|
24
|
-
|
26
|
+
ret = klass.run_function(
|
25
27
|
ctx, @name, @args.run(ctx)
|
26
28
|
)
|
29
|
+
if @name =~ /\?$/
|
30
|
+
ret = ret.collect{ |v| v.to([FAB_NS, 'boolean']) }
|
31
|
+
end
|
32
|
+
ret
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
data/lib/fabulator/expr/node.rb
CHANGED
@@ -31,7 +31,7 @@ module Fabulator
|
|
31
31
|
# see if there's a path between @vtype and t
|
32
32
|
# if so, do the conversion
|
33
33
|
# otherwise, return nil
|
34
|
-
path = Fabulator::
|
34
|
+
path = Fabulator::TagLib.type_path(self.vtype, t)
|
35
35
|
return self.anon_node(nil,nil) if path.empty?
|
36
36
|
v = self
|
37
37
|
path.each do |p|
|
@@ -49,7 +49,7 @@ module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expressio
|
|
49
49
|
@@regex[:qname] = %r{((?:#{@@regex[:ncname]}:)?#{@@regex[:ncname]})}
|
50
50
|
@@regex[:dollar_qname] = %r{\$#{@@regex[:qname]}}
|
51
51
|
@@regex[:dollar_int] = %r{\$([0-9]+)}
|
52
|
-
@@regex[:function_name] = %r{#{@@regex[:qname]}
|
52
|
+
@@regex[:function_name] = %r{#{@@regex[:qname]}\??\*?\s*(?=\([^:])}
|
53
53
|
|
54
54
|
@@ops = {
|
55
55
|
'..' => :DOT_DOT,
|
@@ -26,7 +26,7 @@ module Fabulator
|
|
26
26
|
# if all boolean and one is true, then keep
|
27
27
|
# if numeric, then keep if position == number
|
28
28
|
# if string and non-blank, then keep
|
29
|
-
unified_type = Fabulator::
|
29
|
+
unified_type = Fabulator::TagLib.unify_types(res.collect{ |r| r.vtype })
|
30
30
|
case unified_type.join('')
|
31
31
|
when FAB_NS+'boolean':
|
32
32
|
if res.select{ |r| r.to([FAB_NS, 'boolean']).value }.size > 0
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#
|
2
|
+
# Allows definition of a lib as XSM stuff -- the glue between the core
|
3
|
+
# engine and the lib definition
|
4
|
+
#
|
5
|
+
|
6
|
+
# need a way to specify a library entry type -- to support grammars
|
7
|
+
|
8
|
+
# library ns: http://dh.tamu.edu/ns/fabulator/1.0#
|
9
|
+
#<f:library f:ns="">
|
10
|
+
# <action name=''>
|
11
|
+
# <attribute name='' type='' as='' /> (could be type='expression')
|
12
|
+
# actions...
|
13
|
+
# </action>
|
14
|
+
#
|
15
|
+
# <structure name=''>
|
16
|
+
# <attribute ... />
|
17
|
+
# <element ... />
|
18
|
+
# actions
|
19
|
+
# </structure>
|
20
|
+
#
|
21
|
+
# <function name=''>
|
22
|
+
# actions...
|
23
|
+
# </function>
|
24
|
+
#
|
25
|
+
# <type name=''>
|
26
|
+
# <op name=''>
|
27
|
+
# actions...
|
28
|
+
# </op>
|
29
|
+
# <to name='' weight=''>
|
30
|
+
# actions...
|
31
|
+
# </to>
|
32
|
+
# <from name='' weight=''>
|
33
|
+
# actions...
|
34
|
+
# </from>
|
35
|
+
# </type>
|
36
|
+
#
|
37
|
+
# <filter name=''>
|
38
|
+
# actions...
|
39
|
+
# </filter>
|
40
|
+
#
|
41
|
+
# <constraint name=''>
|
42
|
+
# actions...
|
43
|
+
# </constraint>
|
44
|
+
#</library>
|
45
|
+
|
46
|
+
require 'fabulator/lib/lib'
|
47
|
+
require 'fabulator/lib/structural'
|
48
|
+
require 'fabulator/lib/action'
|
49
|
+
require 'fabulator/lib/attribute'
|
50
|
+
|
51
|
+
module Fabulator
|
52
|
+
module Lib
|
53
|
+
class LibLib < Fabulator::TagLib
|
54
|
+
namespace FAB_LIB_NS
|
55
|
+
|
56
|
+
structural :library, Lib
|
57
|
+
structural :structural, Structural
|
58
|
+
structural :action, Action
|
59
|
+
structural :attribute, Attribute
|
60
|
+
#structural :function, Function
|
61
|
+
#structural :mapping, Mapping
|
62
|
+
#structural :reduction, Reduction
|
63
|
+
#structural :consolidation, Consolidation
|
64
|
+
#structural :type, Type
|
65
|
+
#structural :filter, Filter
|
66
|
+
#structural :constraint, Constraint
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fabulator
|
2
|
+
module Lib
|
3
|
+
class Lib < Fabulator::Structural
|
4
|
+
|
5
|
+
namespace FAB_LIB_NS
|
6
|
+
|
7
|
+
attribute :ns, :static => true
|
8
|
+
|
9
|
+
contains :action, :storage => :hash, :key => :name
|
10
|
+
contains :structural, :storage => :hash, :key => :name
|
11
|
+
contains :function, :storage => :hash, :key => :name
|
12
|
+
contains :mapping, :storage => :hash, :key => :name
|
13
|
+
contains :reduction, :storage => :hash, :key => :name
|
14
|
+
contains :consolidation, :storage => :hash, :key => :name
|
15
|
+
contains :type, :storage => :hash, :key => :name
|
16
|
+
contains :filter, :storage => :hash, :key => :name
|
17
|
+
contains :constraint, :storage => :hash, :key => :name
|
18
|
+
|
19
|
+
def register_library
|
20
|
+
Fabulator::TagLib.namespaces[@ns] = self
|
21
|
+
@attributes.each do |attr|
|
22
|
+
Fabulator::TagLib.attributes << [ @ns, attr[:name], attr[:options] ]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def compile_action(e, c_attrs)
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_function(context, nom, args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def function_return_type(name)
|
33
|
+
(self.function_descriptions[name][:returns] rescue nil)
|
34
|
+
end
|
35
|
+
|
36
|
+
def function_args
|
37
|
+
@function_args ||= { }
|
38
|
+
end
|
39
|
+
|
40
|
+
def run_filter(context, nom)
|
41
|
+
end
|
42
|
+
|
43
|
+
def run_constraint(context, nom)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Fabulator
|
2
|
+
class Structural < Action
|
3
|
+
|
4
|
+
def compile_xml(xml, context)
|
5
|
+
XML.default_line_numbers = true
|
6
|
+
if xml.is_a?(String)
|
7
|
+
xml = LibXML::XML::Document.string xml
|
8
|
+
end
|
9
|
+
if xml.is_a?(LibXML::XML::Document)
|
10
|
+
xml = xml.root
|
11
|
+
end
|
12
|
+
|
13
|
+
if context.nil?
|
14
|
+
@context = @context.merge(xml)
|
15
|
+
else
|
16
|
+
@context = context.merge(xml)
|
17
|
+
end
|
18
|
+
|
19
|
+
self.setup(xml)
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.element(nom)
|
25
|
+
@@elements[self.name] = nom
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.contains(nom, opts = { })
|
29
|
+
ns = opts[:ns] || self.namespace
|
30
|
+
@@structurals ||= { }
|
31
|
+
@@structurals[self.name] ||= { }
|
32
|
+
@@structurals[self.name][ns] ||= { }
|
33
|
+
@@structurals[self.name][ns][nom.to_sym] = opts
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.structurals
|
37
|
+
return @@structurals[self.name]
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.accepts_structural?(ns, nom)
|
41
|
+
return false if @@structurals.nil?
|
42
|
+
return false if @@structurals[self.name].nil?
|
43
|
+
return false if @@structurals[self.name][ns].nil?
|
44
|
+
return false if @@structurals[self.name][ns][nom.to_sym].nil?
|
45
|
+
return true
|
46
|
+
end
|
47
|
+
|
48
|
+
def accepts_structural?(ns, nom)
|
49
|
+
self.class.accepts_structural?(ns, nom)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
protected
|
54
|
+
def setup(xml)
|
55
|
+
super
|
56
|
+
|
57
|
+
#klass = self.class.name
|
58
|
+
possibilities = self.class.structurals
|
59
|
+
|
60
|
+
if !possibilities.nil?
|
61
|
+
possibilities.each_pair do |ns, parts|
|
62
|
+
parts.each_pair do |nom, opts|
|
63
|
+
as = "@" + (opts[:as] || nom.to_s.pluralize).to_s
|
64
|
+
if opts[:storage].nil? || opts[:storage] == :array
|
65
|
+
self.instance_variable_set(as.to_sym, [])
|
66
|
+
elsif opts[:storage] == :hash
|
67
|
+
self.instance_variable_set(as.to_sym, {})
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
structs = @context.compile_structurals(xml)
|
73
|
+
structs.each_pair do |ns, parts|
|
74
|
+
next unless possibilities[ns]
|
75
|
+
parts.each_pair do |nom, objs|
|
76
|
+
next unless possibilities[ns][nom]
|
77
|
+
opts = possibilities[ns][nom]
|
78
|
+
as = "@" + (opts[:as] || nom.to_s.pluralize).to_s
|
79
|
+
if opts[:storage].nil? || opts[:storage] == :array
|
80
|
+
self.instance_variable_set(as.to_sym, self.instance_variable_get(as.to_sym) + objs)
|
81
|
+
else
|
82
|
+
tgt = self.instance_variable_get(as.to_sym)
|
83
|
+
objs.each do |obj|
|
84
|
+
tgt[obj.send(opts[:key] || :name)] = obj
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Fabulator
|
2
|
-
|
2
|
+
class TagLib
|
3
3
|
@@action_descriptions = {}
|
4
|
+
@@structural_descriptions = {}
|
5
|
+
@@structural_classes = {}
|
4
6
|
@@function_descriptions = {}
|
5
7
|
@@function_args = { }
|
6
8
|
@@namespaces = {}
|
@@ -18,6 +20,12 @@ module Fabulator
|
|
18
20
|
def self.action_descriptions
|
19
21
|
@@action_descriptions
|
20
22
|
end
|
23
|
+
def self.structural_descriptions
|
24
|
+
@@structural_descriptions
|
25
|
+
end
|
26
|
+
def self.structural_classes
|
27
|
+
@@structural_classes
|
28
|
+
end
|
21
29
|
def self.function_description
|
22
30
|
@@function_description
|
23
31
|
end
|
@@ -43,6 +51,12 @@ module Fabulator
|
|
43
51
|
def self.action_descriptions=(x)
|
44
52
|
@@action_descriptions = x
|
45
53
|
end
|
54
|
+
def self.structural_descriptions=(x)
|
55
|
+
@@structural_descriptions = x
|
56
|
+
end
|
57
|
+
def self.structural_classes=(x)
|
58
|
+
@@structural_classes = x
|
59
|
+
end
|
46
60
|
def self.function_description=(x)
|
47
61
|
@@function_description = x
|
48
62
|
end
|
@@ -59,19 +73,27 @@ module Fabulator
|
|
59
73
|
@@axes = x
|
60
74
|
end
|
61
75
|
|
62
|
-
|
63
|
-
|
64
|
-
base.module_eval do
|
65
|
-
def self.included(new_base)
|
66
|
-
super
|
67
|
-
new_base.action_descriptions.merge! self.action_descriptions
|
68
|
-
new_base.function_descriptions.merge! self.function_descriptions
|
69
|
-
new_base.function_args.merge! self.function_args
|
70
|
-
new_base.types.merge! self.types
|
71
|
-
end
|
76
|
+
def structural_class(nom)
|
77
|
+
Fabulator::TagLib.structural_classes[self.class.name][nom]
|
72
78
|
end
|
79
|
+
|
80
|
+
def self.inherited(base)
|
81
|
+
base.extend(ClassMethods)
|
73
82
|
end
|
74
83
|
|
84
|
+
# def self.included(base)
|
85
|
+
# base.extend(ClassMethods)
|
86
|
+
# base.module_eval do
|
87
|
+
# def self.included(new_base)
|
88
|
+
# super
|
89
|
+
# new_base.action_descriptions.merge! self.action_descriptions
|
90
|
+
# new_base.function_descriptions.merge! self.function_descriptions
|
91
|
+
# new_base.function_args.merge! self.function_args
|
92
|
+
# new_base.types.merge! self.types
|
93
|
+
# end
|
94
|
+
# end
|
95
|
+
# end
|
96
|
+
|
75
97
|
def self.find_op(t,o)
|
76
98
|
(@@types[t[0]][t[1]][:ops][o] rescue nil)
|
77
99
|
end
|
@@ -209,6 +231,12 @@ module Fabulator
|
|
209
231
|
end
|
210
232
|
end
|
211
233
|
|
234
|
+
def compile_structural(e, c)
|
235
|
+
if self.class.method_defined? "structural:#{e.name}"
|
236
|
+
send "structural:#{e.name}", e, c
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
212
240
|
def run_function(context, nom, args, depth=0)
|
213
241
|
ret = []
|
214
242
|
|
@@ -310,36 +338,40 @@ module Fabulator
|
|
310
338
|
end
|
311
339
|
|
312
340
|
def action_descriptions(hash = nil)
|
313
|
-
Fabulator::
|
341
|
+
Fabulator::TagLib.action_descriptions[self.name] ||= (hash ||{})
|
314
342
|
end
|
315
343
|
|
316
344
|
def function_descriptions(hash = nil)
|
317
|
-
Fabulator::
|
345
|
+
Fabulator::TagLib.action_descriptions[self.name] ||= (hash ||{})
|
318
346
|
end
|
319
347
|
|
320
348
|
def register_namespace(ns)
|
321
|
-
Fabulator::
|
349
|
+
Fabulator::TagLib.namespaces[ns] = self.new
|
350
|
+
end
|
351
|
+
|
352
|
+
def namespace(ns)
|
353
|
+
Fabulator::TagLib.namespaces[ns] = self.new
|
322
354
|
end
|
323
355
|
|
324
356
|
def register_attribute(a, options = {})
|
325
357
|
ns = nil
|
326
|
-
Fabulator::
|
358
|
+
Fabulator::TagLib.namespaces.each_pair do |k,v|
|
327
359
|
if v.is_a?(self)
|
328
360
|
ns = k
|
329
361
|
end
|
330
362
|
end
|
331
|
-
Fabulator::
|
363
|
+
Fabulator::TagLib.attributes << [ ns, a, options ]
|
332
364
|
end
|
333
365
|
|
334
366
|
def register_type(nom, options={})
|
335
367
|
ns = nil
|
336
|
-
Fabulator::
|
368
|
+
Fabulator::TagLib.namespaces.each_pair do |k,v|
|
337
369
|
if v.is_a?(self)
|
338
370
|
ns = k
|
339
371
|
end
|
340
372
|
end
|
341
|
-
Fabulator::
|
342
|
-
Fabulator::
|
373
|
+
Fabulator::TagLib.types[ns] ||= {}
|
374
|
+
Fabulator::TagLib.types[ns][nom] = options
|
343
375
|
|
344
376
|
function nom do |ctx, args|
|
345
377
|
args[0].collect { |i|
|
@@ -349,45 +381,67 @@ module Fabulator
|
|
349
381
|
end
|
350
382
|
|
351
383
|
def axis(nom, &block)
|
352
|
-
Fabulator::
|
384
|
+
Fabulator::TagLib.axes[nom] = block
|
353
385
|
end
|
354
386
|
|
355
387
|
def namespaces
|
356
|
-
Fabulator::
|
388
|
+
Fabulator::TagLib.namespaces
|
357
389
|
end
|
358
390
|
|
359
391
|
def desc(text)
|
360
|
-
Fabulator::
|
392
|
+
Fabulator::TagLib.last_description = RedCloth.new(Util.strip_leading_whitespace(text)).to_html
|
361
393
|
end
|
362
394
|
|
363
395
|
def action(name, klass = nil, &block)
|
364
|
-
self.action_descriptions[name] = Fabulator::
|
365
|
-
Fabulator::
|
396
|
+
self.action_descriptions[name] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
397
|
+
Fabulator::TagLib.last_description = nil
|
366
398
|
if block
|
367
399
|
define_method("action:#{name}", &block)
|
368
400
|
elsif !klass.nil?
|
369
|
-
action(name) { |e,
|
370
|
-
|
401
|
+
action(name) { |e,c|
|
402
|
+
r = klass.new
|
403
|
+
r.compile_xml(e,c)
|
404
|
+
r
|
405
|
+
}
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def structural(name, klass = nil, &block)
|
410
|
+
self.structural_descriptions[name] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
411
|
+
Fabulator::TagLib.last_description = nil
|
412
|
+
if block
|
413
|
+
define_method("structural:#{name}", &block)
|
414
|
+
elsif !klass.nil?
|
415
|
+
structural(name) { |e,c|
|
416
|
+
r = klass.new
|
417
|
+
r.compile_xml(e,c)
|
418
|
+
r
|
371
419
|
}
|
420
|
+
Fabulator::TagLib.structural_classes[self.name] ||= {}
|
421
|
+
Fabulator::TagLib.structural_classes[self.name][name] = klass
|
372
422
|
end
|
373
423
|
end
|
374
424
|
|
425
|
+
def structural_class(nom)
|
426
|
+
(Fabulator::TagLib.structural_classes[self.class.name][nom] rescue nil)
|
427
|
+
end
|
428
|
+
|
375
429
|
def function(name, returns = nil, takes = nil, &block)
|
376
430
|
self.function_descriptions[name] = { :returns => returns, :takes => takes }
|
377
|
-
self.function_descriptions[name][:description] = Fabulator::
|
431
|
+
self.function_descriptions[name][:description] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
378
432
|
#self.function_args[name] = { :return => returns, :takes => takes }
|
379
|
-
Fabulator::
|
433
|
+
Fabulator::TagLib.last_description = nil
|
380
434
|
define_method("fctn:#{name}", &block)
|
381
435
|
end
|
382
436
|
|
383
437
|
def reduction(name, opts = {}, &block)
|
384
438
|
self.function_descriptions[name] = { :type => :reduction }.merge(opts)
|
385
|
-
self.function_descriptions[name][:description] = Fabulator::
|
386
|
-
Fabulator::
|
439
|
+
self.function_descriptions[name][:description] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
440
|
+
Fabulator::TagLib.last_description = nil
|
387
441
|
define_method("fctn:#{name}", &block)
|
388
442
|
cons = self.function_descriptions[name][:consolidation]
|
389
443
|
if !cons.nil?
|
390
|
-
Fabulator::
|
444
|
+
Fabulator::TagLib.last_description = self.function_descriptions[name][:description]
|
391
445
|
consolidation name do |ctx, args|
|
392
446
|
send "fctn:#{cons}", ctx, args
|
393
447
|
end
|
@@ -396,15 +450,15 @@ module Fabulator
|
|
396
450
|
|
397
451
|
def consolidation(name, opts = {}, &block)
|
398
452
|
self.function_descriptions[name] = { :type => :consolidation }.merge(opts)
|
399
|
-
self.function_descriptions[name][:description] = Fabulator::
|
400
|
-
Fabulator::
|
453
|
+
self.function_descriptions[name][:description] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
454
|
+
Fabulator::TagLib.last_description = nil
|
401
455
|
define_method("fctn:consolidation:#{name}", &block)
|
402
456
|
end
|
403
457
|
|
404
458
|
def mapping(name, opts = {}, &block)
|
405
459
|
self.function_descriptions[name] = { :type => :mapping }.merge(opts)
|
406
|
-
self.function_descriptions[name][:description] = Fabulator::
|
407
|
-
Fabulator::
|
460
|
+
self.function_descriptions[name][:description] = Fabulator::TagLib.last_description if Fabulator::TagLib.last_description
|
461
|
+
Fabulator::TagLib.last_description = nil
|
408
462
|
define_method("fctn:#{name}", &block)
|
409
463
|
end
|
410
464
|
|
@@ -431,22 +485,6 @@ module Fabulator
|
|
431
485
|
def constraint(name, &block)
|
432
486
|
define_method("constraint:#{name}", &block)
|
433
487
|
end
|
434
|
-
|
435
|
-
def compile_actions(xml, rdf_model)
|
436
|
-
actions = [ ]
|
437
|
-
xml.each_element do |e|
|
438
|
-
ns = e.namespaces.namespace.href
|
439
|
-
#Rails.logger.info("Compiling <#{ns}><#{e.name}>")
|
440
|
-
next unless Fabulator::ActionLib.namespaces.include?(ns)
|
441
|
-
actions << (Fabulator::ActionLib.namespaces[ns].compile_action(e, rdf_model) rescue nil)
|
442
|
-
#Rails.logger.info("compile_actions: #{actions}")
|
443
|
-
end
|
444
|
-
#Rails.logger.info("compile_actions: #{actions}")
|
445
|
-
actions = actions - [ nil ]
|
446
|
-
#Rails.logger.info("compile_actions returning: #{actions}")
|
447
|
-
return actions
|
448
|
-
end
|
449
|
-
|
450
488
|
end
|
451
489
|
|
452
490
|
module Util
|