sdl-ng 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.yard_redcarpet_ext +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +13 -0
- data/README.md +454 -0
- data/Rakefile +16 -0
- data/bin/process_service_descriptions +102 -0
- data/examples/services/google_drive_for_business.service.rb +50 -0
- data/examples/services/salesforce_sales_cloud.service.rb +51 -0
- data/examples/translations/en.yml +184 -0
- data/examples/vocabulary/base/base.sdl.rb +8 -0
- data/examples/vocabulary/base/location.sdl.rb +5 -0
- data/examples/vocabulary/crf/characteristics.sdl.rb +25 -0
- data/examples/vocabulary/crf/charging.sdl.rb +8 -0
- data/examples/vocabulary/crf/compliance.sdl.rb +35 -0
- data/examples/vocabulary/crf/delivery.sdl.rb +22 -0
- data/examples/vocabulary/crf/dynamics.sdl.rb +6 -0
- data/examples/vocabulary/crf/interop.sdl.rb +54 -0
- data/examples/vocabulary/crf/optimizing.sdl.rb +15 -0
- data/examples/vocabulary/crf/portability.sdl.rb +25 -0
- data/examples/vocabulary/crf/protection.sdl.rb +8 -0
- data/examples/vocabulary/crf/reliability.sdl.rb +1 -0
- data/examples/vocabulary/crf/reputation.sdl.rb +3 -0
- data/lib/sdl.rb +17 -0
- data/lib/sdl/base.rb +20 -0
- data/lib/sdl/base/fact.rb +11 -0
- data/lib/sdl/base/property.rb +34 -0
- data/lib/sdl/base/service.rb +13 -0
- data/lib/sdl/base/service_compendium.rb +130 -0
- data/lib/sdl/base/type.rb +66 -0
- data/lib/sdl/exporters.rb +9 -0
- data/lib/sdl/exporters/exporter.rb +19 -0
- data/lib/sdl/exporters/markdown_service_exporter.rb +5 -0
- data/lib/sdl/exporters/rdf_exporter.rb +34 -0
- data/lib/sdl/exporters/rdf_mapping.rb +48 -0
- data/lib/sdl/exporters/schema_exporter.rb +9 -0
- data/lib/sdl/exporters/service_exporter.rb +9 -0
- data/lib/sdl/exporters/xml_mapping.rb +51 -0
- data/lib/sdl/exporters/xml_service_exporter.rb +37 -0
- data/lib/sdl/exporters/xsd_schema_exporter.rb +94 -0
- data/lib/sdl/receivers.rb +22 -0
- data/lib/sdl/receivers/fact_receiver.rb +15 -0
- data/lib/sdl/receivers/service_receiver.rb +63 -0
- data/lib/sdl/receivers/type_instance_receiver.rb +86 -0
- data/lib/sdl/receivers/type_receiver.rb +87 -0
- data/lib/sdl/translations/en.yml +9 -0
- data/lib/sdl/types.rb +19 -0
- data/lib/sdl/types/sdl_datetime.rb +10 -0
- data/lib/sdl/types/sdl_default_type.rb +13 -0
- data/lib/sdl/types/sdl_description.rb +10 -0
- data/lib/sdl/types/sdl_duration.rb +12 -0
- data/lib/sdl/types/sdl_number.rb +10 -0
- data/lib/sdl/types/sdl_string.rb +10 -0
- data/lib/sdl/types/sdl_type.rb +31 -0
- data/lib/sdl/types/sdl_url.rb +12 -0
- data/lib/sdl/util.rb +4 -0
- data/lib/sdl/util/documentation.rb +80 -0
- data/lib/sdl/util/nokogiri.rb +28 -0
- data/lib/sdl/util/verbs.rb +3 -0
- data/lib/sdl/version.rb +3 -0
- data/sdl-ng.gemspec +34 -0
- data/spec/documentation_spec.rb +64 -0
- data/spec/fact_type_instance_definition_spec.rb +188 -0
- data/spec/property_definitions_spec.rb +44 -0
- data/spec/service_compendium_spec.rb +90 -0
- data/spec/service_definition_spec.rb +81 -0
- data/spec/shared_test_compendium.rb +65 -0
- data/spec/spec_helper.rb +10 -0
- metadata +291 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 30daf06cf0f1fde000a8c2a8f3842b9be010a136
|
4
|
+
data.tar.gz: 19521cbe60a733612c245fc8d0f2d70520cc5b02
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: baa76502bc340d3a0efe1687dd4488ffb3f2e8f702548e2699b02593dff6935aceaac914bba0ace704b60b1c99bf79239c72e6d4c18699fa4aa45cc85e4bfb83
|
7
|
+
data.tar.gz: 98a5a901aad83cca33921e5c7e6287514768b23eaac23936ab113542c46f28497a50511a693cae8c1824d16881dbd8acfff164b8cf612c8df2263f54f32b7924
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
.idea
|
7
|
+
examples/output
|
8
|
+
examples/translations/en.out.yml
|
9
|
+
Gemfile.lock
|
10
|
+
InstalledFiles
|
11
|
+
_yardoc
|
12
|
+
coverage
|
13
|
+
doc/
|
14
|
+
lib/bundler/man
|
15
|
+
pkg
|
16
|
+
rdoc
|
17
|
+
spec/reports
|
18
|
+
test/tmp
|
19
|
+
test/version_tmp
|
20
|
+
tmp
|
data/.rspec
ADDED
data/.yard_redcarpet_ext
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
tables
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2013 Mathias Slawik
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,454 @@
|
|
1
|
+
Service Description Language Framework
|
2
|
+
======================================
|
3
|
+
|
4
|
+
This is a framework for the easy description of business aspects of internet services using self defined vocabularies.
|
5
|
+
|
6
|
+
Its main features are:
|
7
|
+
|
8
|
+
* Comprehensive textual domain-specific language
|
9
|
+
* DSL implemented as Ruby code, allowing flexible use cases (e.g. extracting data from websites)
|
10
|
+
* Export of services and vocabulary to XML/XSD and RDF
|
11
|
+
* Internationalization of vocabulary descriptions
|
12
|
+
|
13
|
+
Upcoming features include:
|
14
|
+
|
15
|
+
* Definition of service property comparison
|
16
|
+
* Input alignment (e.g. matching country to jurisdiction)
|
17
|
+
* Property type enforcement / type conversion
|
18
|
+
* Feature model based service variant management
|
19
|
+
* Modelling of dynamic pricing
|
20
|
+
|
21
|
+
The main design constraints for the framework are:
|
22
|
+
|
23
|
+
* A text editor should suffice to create service descriptions and vocabulary
|
24
|
+
* Compared to other general SDLs, e.g. USDL, Linked-USDL, and OWL-S syntactic and semantic noise should be reduced
|
25
|
+
* Concrete serialization technologies should be abstracted, such as XML/XSD, RDF/OWL and EMF/Ecore
|
26
|
+
* There is no common answer to "What is a service?". Therefore the structure of service descriptions should be provided by concrete use cases, and not the framework itself
|
27
|
+
* The functionality of the framework should be demonstrated on existing services
|
28
|
+
* Using a programming language as textual format should allow both static and dynamic information to be available in the same file
|
29
|
+
|
30
|
+
The SDL Framework is the basis of the TRESOR Broker, and will be supporting the "Open Service Compendium", an envisioned crowdsourced repository for service descriptions, their comparison and brokering.
|
31
|
+
|
32
|
+
General Overview
|
33
|
+
================
|
34
|
+
|
35
|
+
The SDL Framework allows the definition of *vocabulary* and *service descriptions*. The *vocabulary* defines "What can generally be known about any service" (a so called meta-model). *Service descriptions* refer to defined *vocabulary* and define "What is known about a specific service".
|
36
|
+
|
37
|
+
For example, a *vocabulary* defines that "services can be accessed using a browser" and that "there are different browsers in existence", while the *service description* of a concrete service, e.g. Salesforce Sales Cloud, defines that it can be accessed using Internet Explorer 7+, recent versions of Firefox and Chrome and Safari 5+ on mac. (see `examples/service_definitions/salesforce_sales_cloud.service.rb` for more examples)
|
38
|
+
|
39
|
+
The vocabulary
|
40
|
+
--------------
|
41
|
+
|
42
|
+
A *vocabulary* defines *fact classes*, *SDL types*, *properties*, and *SDL type instances*.
|
43
|
+
|
44
|
+
Any fact class, property value and type instance can be *annotated* with arbitrary data to capture "fine-print" of descriptions.
|
45
|
+
|
46
|
+
### Fact classes
|
47
|
+
|
48
|
+
A *fact class* is a class of possible statements about a service. Some examples are:
|
49
|
+
|
50
|
+
| Class name | Statement |
|
51
|
+
| ----------------------- | ---------------------------------------------- |
|
52
|
+
| BrowserInterface | It can be accessed using a browser |
|
53
|
+
| CloudServiceModel | It can be categorized by a cloud service model |
|
54
|
+
| CommunicationProtection | It is protected by a communication protection |
|
55
|
+
| EstablishingYear | It has a defined year of establishment |
|
56
|
+
|
57
|
+
### SDL Types and type instances
|
58
|
+
|
59
|
+
An *SDL type* is used for structuring fact information.
|
60
|
+
|
61
|
+
Within a vocabulary, SDL types can be instantiated. These *SDL type instances* can be easily referred to from fact instances by their name. This allows different service descriptions to refer to the same instances.
|
62
|
+
|
63
|
+
The following table shows some examples of types, their purpose, and predefined instances:
|
64
|
+
|
65
|
+
| Type name | Used with | Description | Instances |
|
66
|
+
| ----------------------- | ----------------------- | -------------------------------------- | --------------------- |
|
67
|
+
| Browser | BrowserInterface | A web browser | Firefox, Chome, Opera |
|
68
|
+
| CloudServiceModel | CloudServiceModel | A cloud service model | SaaS, PaaS, IaaS |
|
69
|
+
| CommunicationProtection | CommunicationProtection | A way to protect service communication | VPN, HTTPS |
|
70
|
+
|
71
|
+
### Fact and Type Properties
|
72
|
+
|
73
|
+
*Properties* give more information about facts and types. Every property has a name, type, and can be multi valued (a list).
|
74
|
+
|
75
|
+
Some example properties are:
|
76
|
+
|
77
|
+
| Defined on | Name | Type | Multi-valued | Definition |
|
78
|
+
| ------------------------------ | ------------------------ | ----------------------- | ------------ | ------------------------------------------- |
|
79
|
+
| BrowserInterface (Fact) | compatible_browsers | CompatibleBrowser | Yes | A list of compatible browsers |
|
80
|
+
| CompatibleBrowser (Type) | browser | Browser | No | A browser |
|
81
|
+
| Browser (Type) | url | URL | No | The URL of a Browser |
|
82
|
+
| CloudServiceModel (Fact) | cloud_service_model | CloudServiceModel | No | The cloud service model |
|
83
|
+
| CommunicationProtection (Fact) | communication_protection | CommunicationProtection | No | The communication protection of the service |
|
84
|
+
| EstablishingYear (Fact) | year | Integer | No | The year a service was established |
|
85
|
+
|
86
|
+
Types can be either types wrapping Ruby classes, e.g. dates, durations, strings, numbers and URLs, and also other SDL types.
|
87
|
+
|
88
|
+
Service Descriptions
|
89
|
+
--------------------
|
90
|
+
|
91
|
+
A *service description* uses *fact classes*, *types*, and *type instances* to describe services.
|
92
|
+
|
93
|
+
Vocabulary Syntax
|
94
|
+
=================
|
95
|
+
|
96
|
+
This chapter defines the syntax of vocabularies.
|
97
|
+
|
98
|
+
Fact class and type definition
|
99
|
+
------------------------------
|
100
|
+
|
101
|
+
The fact class and type definition are very similar.
|
102
|
+
|
103
|
+
This is how fact classes are defined:
|
104
|
+
|
105
|
+
`fact` *\<symbolic name>* `do`
|
106
|
+
|
107
|
+
> *\<Fact properties and subfacts>*
|
108
|
+
|
109
|
+
`end`
|
110
|
+
|
111
|
+
And this is how types are defined:
|
112
|
+
|
113
|
+
`type` *\<symbolic name>* `do`
|
114
|
+
|
115
|
+
> *\<Type properties and subtypes>*
|
116
|
+
|
117
|
+
`end`
|
118
|
+
|
119
|
+
Every fact class and type definition is identified by its *symbolic name*, for which the SDL framework creates a Ruby class:
|
120
|
+
|
121
|
+
| Symbolic name | Ruby class constant name |
|
122
|
+
| --------------------- | --------------------------- |
|
123
|
+
| `:name` | `Name` |
|
124
|
+
| `:payment_option` | `PaymentOption` |
|
125
|
+
| `:compatible_browser` | `CompatibleBrowser` |
|
126
|
+
| `:browser` | `Browser` |
|
127
|
+
|
128
|
+
The definition block includes *properties* and *subclasses* of fact classes and types respectively.
|
129
|
+
|
130
|
+
Property definition
|
131
|
+
-------------------
|
132
|
+
|
133
|
+
Fact and type properties are defined according to the following pattern:
|
134
|
+
|
135
|
+
*\<type>* *\<name>*
|
136
|
+
|
137
|
+
*\<type>* can refer either to a *wrapped type* or another SDL *type*.
|
138
|
+
|
139
|
+
*Wrapped types* wrap Ruby classes. The following are available (see `lib/sdl/types`):
|
140
|
+
|
141
|
+
| Wrapped Ruby Type | Referenced as |
|
142
|
+
| ----------------------- | -------------------------- |
|
143
|
+
| String | `string`, `str` |
|
144
|
+
| Integer | `number`, `integer`, `ìnt` |
|
145
|
+
| Time | `datetime` |
|
146
|
+
| ActiveSupport::Duration | `duration` |
|
147
|
+
| URI | `uri`, `url` |
|
148
|
+
|
149
|
+
*SDL types* are referred by their name, e.g. `payment_option` references `PaymentOption`.
|
150
|
+
|
151
|
+
Properties can be multi valued, denoted by a `list_of_` prefix, e.g. `list_of_strings` or `list_of_browsers`.
|
152
|
+
|
153
|
+
*\<name>* can be omitted, if it is the same as the name of the type. The following type definitions are equal
|
154
|
+
|
155
|
+
url
|
156
|
+
|
157
|
+
equals
|
158
|
+
|
159
|
+
url :url
|
160
|
+
|
161
|
+
Type instances definition
|
162
|
+
-------------------------
|
163
|
+
|
164
|
+
Predefined type instances are created using the following pattern:
|
165
|
+
|
166
|
+
*\<type reference>* *\<symbolic name>* `do`
|
167
|
+
|
168
|
+
> *\<property definition>*
|
169
|
+
|
170
|
+
`end`
|
171
|
+
|
172
|
+
If a browser type is defined as such:
|
173
|
+
|
174
|
+
type :browser do
|
175
|
+
url
|
176
|
+
end
|
177
|
+
|
178
|
+
Instantiating browsers can be done like this:
|
179
|
+
|
180
|
+
browser :firefox do
|
181
|
+
url 'http://www.mozilla.org/firefox/'
|
182
|
+
end
|
183
|
+
|
184
|
+
browser :chrome do
|
185
|
+
url 'https://www.google.com/chrome'
|
186
|
+
end
|
187
|
+
|
188
|
+
browser :internet_explorer do
|
189
|
+
url 'http://windows.microsoft.com/en-US/internet-explorer/download-ie'
|
190
|
+
end
|
191
|
+
|
192
|
+
Subtype and subfact definition
|
193
|
+
------------------------------
|
194
|
+
|
195
|
+
As types and facts are Ruby classes, they can be inherited.
|
196
|
+
|
197
|
+
This is how subclasses of fact classes are defined:
|
198
|
+
|
199
|
+
`fact` *\<symbolic name>* `do`
|
200
|
+
|
201
|
+
> `subfact` *\<symbolic name>* `do`
|
202
|
+
|
203
|
+
> > *\<Subfact properties and further subfacts>*
|
204
|
+
|
205
|
+
> `end`
|
206
|
+
|
207
|
+
`end`
|
208
|
+
|
209
|
+
It is very similar to subclasses of type classes:
|
210
|
+
|
211
|
+
`type` *\<symbolic name>* `do`
|
212
|
+
|
213
|
+
> `subtype` *\<symbolic name>* `do`
|
214
|
+
|
215
|
+
> > *\<Subtype properties and further subtypes>*
|
216
|
+
|
217
|
+
> `end`
|
218
|
+
|
219
|
+
`end`
|
220
|
+
|
221
|
+
Service definition syntax
|
222
|
+
=========================
|
223
|
+
|
224
|
+
The service definition contains any number of lines following the pattern:
|
225
|
+
|
226
|
+
*\<fact class reference>* *\<property setting instructions>*
|
227
|
+
|
228
|
+
There are different ways how to reference facts and set property values, shown in the following subsections.
|
229
|
+
|
230
|
+
Fact class reference
|
231
|
+
--------------------
|
232
|
+
|
233
|
+
Fact classes can be referred by three different mechanisms: either *`has_`\<fact name>*, or *\<fact name>*, or *`is_`\<past perfective of fact name as verb>*. This allows choosing a term which has the highest readability for a certain fact class.
|
234
|
+
|
235
|
+
The following table contains some examples:
|
236
|
+
|
237
|
+
| Fact class | *`has_`\<fact name>* | *\<fact name>* | *`is_`\<past perfective of fact name as verb>* |
|
238
|
+
| ---------- | -------------------- | -------------- | ---------------------------------------------- |
|
239
|
+
| `Name` | `has_name` | `name` | `is_named` |
|
240
|
+
| `Bill` | `has_bill` | `bill` | `is_billed` |
|
241
|
+
| `Feature` | `has_feature` | `feature` | `is_featured` |
|
242
|
+
|
243
|
+
Property setting instructions
|
244
|
+
-----------------------------
|
245
|
+
|
246
|
+
Setting the values of fact and type properties can be done in two ways:
|
247
|
+
|
248
|
+
### Short form
|
249
|
+
|
250
|
+
If a fact or type has only some properties, setting properties can be done by specifying their values in the order they appear in the vocabulary:
|
251
|
+
|
252
|
+
*\<fact or type reference>* *\<first value>*, *\<second value>*, *\<n-th value>*
|
253
|
+
|
254
|
+
The following example (taken from `examples/service_definitions/google_drive_for_business.service.rb`) illustrates this mechanism:
|
255
|
+
|
256
|
+
name 'Google Drive for Business'
|
257
|
+
|
258
|
+
has_add_on_repository 'https://www.google.com/enterprise/marketplace/home', 1000
|
259
|
+
|
260
|
+
If properties should be set in a different order, the property names can be specified as:
|
261
|
+
|
262
|
+
*\<fact or type reference>* *\<name>* `:` *\<value>*, *\<name>* `:` *\<value>*, ...
|
263
|
+
|
264
|
+
An example would be:
|
265
|
+
|
266
|
+
has_documentation url: 'http://www.salesforce.com/sales-cloud/overview/'
|
267
|
+
|
268
|
+
The default Ruby syntax applies for creating lists: `[` *\<item 1>* `, ` *\<item 2>* `, ` *\<item n>* `]`
|
269
|
+
|
270
|
+
It should be obvious that the order of values has to change if the order of properties changes.
|
271
|
+
|
272
|
+
### Block form
|
273
|
+
|
274
|
+
If a fact or type has many properties, setting those can be done as a block:
|
275
|
+
|
276
|
+
*\<fact or type reference>* `do`
|
277
|
+
|
278
|
+
> *\<name>* *\<value>*
|
279
|
+
|
280
|
+
`end`
|
281
|
+
|
282
|
+
The following example (see `examples/service_definitions/salesforce_sales_cloud.service.rb`) illustrates this mechanism:
|
283
|
+
|
284
|
+
has_add_on_repository do
|
285
|
+
url 'https://appexchange.salesforce.com/'
|
286
|
+
number_of_add_ons 2000
|
287
|
+
end
|
288
|
+
|
289
|
+
Multi-valued properties are created by specifying the name more than once, for example:
|
290
|
+
|
291
|
+
has_browser_interface do
|
292
|
+
compatible_browser ...
|
293
|
+
compatible_browser ...
|
294
|
+
compatible_browser ...
|
295
|
+
compatible_browser ...
|
296
|
+
end
|
297
|
+
|
298
|
+
### Combining both methods
|
299
|
+
|
300
|
+
Both methods can be combined:
|
301
|
+
|
302
|
+
*\<fact or type reference>* *\<property setting instructions>* `do`
|
303
|
+
|
304
|
+
> *\<name>* *\<value>*
|
305
|
+
|
306
|
+
`end`
|
307
|
+
|
308
|
+
So the example of the previous subsection can be rewritten as:
|
309
|
+
|
310
|
+
has_add_on_repository 'https://appexchange.salesforce.com/' do
|
311
|
+
number_of_add_ons 2000
|
312
|
+
end
|
313
|
+
|
314
|
+
Referencing type instances
|
315
|
+
--------------------------
|
316
|
+
|
317
|
+
Type instances can be referred to by using *name*, as for example:
|
318
|
+
|
319
|
+
has_cloud_service_model saas
|
320
|
+
|
321
|
+
Due to the inner workings of the framework, if there are different instances with the same *name*, then the name has to be prepended by a colon (`:`), for example:
|
322
|
+
|
323
|
+
has_cloud_service_model :saas
|
324
|
+
|
325
|
+
Annotating data
|
326
|
+
---------------
|
327
|
+
|
328
|
+
Annotations can be used to capture the "fine-print" of service descriptions.
|
329
|
+
|
330
|
+
By adding `annotation: ` *annotation* any property value definition and fact instance can be annotated, for example:
|
331
|
+
|
332
|
+
has_cloud_service_model :saas, annotation: "Unless you are Deutsche Bank"
|
333
|
+
|
334
|
+
has_add_on_repository 'https://appexchange.salesforce.com/' do
|
335
|
+
number_of_add_ons 2000, annotation: "... and rising every minute"
|
336
|
+
end
|
337
|
+
|
338
|
+
Using Ruby code for crazy stuff
|
339
|
+
-------------------------------
|
340
|
+
|
341
|
+
As all service descriptions and vocabulary are Ruby code, any functionality can be integrated into the descriptions.
|
342
|
+
|
343
|
+
The following code example uses the helper function `fetch_from_url` which uses Nokogiri to fetch a url and filter it according to a CSS selector to retrieve feature descriptions:
|
344
|
+
|
345
|
+
features = fetch_from_url 'http://www.salesforce.com/sales-cloud/overview/', '.slide h3 + p'
|
346
|
+
|
347
|
+
has_feature 'Mobile', features[0]
|
348
|
+
has_feature 'Contact Management', features[1]
|
349
|
+
has_feature 'Opportunity Management', features[2]
|
350
|
+
has_feature 'Chatter', features[3]
|
351
|
+
has_feature 'Email Integration', features[4]
|
352
|
+
|
353
|
+
Interfacing with the framework
|
354
|
+
==============================
|
355
|
+
|
356
|
+
As the framework is to be used within other applications, there is no mening to "running" it.
|
357
|
+
|
358
|
+
Nevertheless, there is a GEM binary, `process_service_descriptions` provided, which does the following:
|
359
|
+
|
360
|
+
* Load translations from the `translations` directory
|
361
|
+
* Load all vocabulary definitions from the `vocabulary` directory
|
362
|
+
* Use this vocabulary to process all service descriptions from a `services` directory
|
363
|
+
* Output XML/XSD, RDF and Markdown to the `output` directory
|
364
|
+
|
365
|
+
This binary can be used within the `examples` subdirectory of this GEM.
|
366
|
+
|
367
|
+
Examples
|
368
|
+
========
|
369
|
+
|
370
|
+
To run all examples, execute the GEM binary `process_service_descriptions` within the `examples` subdirectory of this GEM.
|
371
|
+
|
372
|
+
Google Drive for Business
|
373
|
+
-------------------------
|
374
|
+
|
375
|
+
Included from `examples/service_definitions/google_drive_for_business.service.rb`
|
376
|
+
|
377
|
+
{include:file:examples/service_definitions/google_drive_for_business.service.rb}
|
378
|
+
|
379
|
+
Salesforce Sales cloud
|
380
|
+
----------------------
|
381
|
+
|
382
|
+
Included from `examples/service_definitions/salesforce_sales_cloud.service.rb`
|
383
|
+
|
384
|
+
{include:file:examples/service_definitions/salesforce_sales_cloud.service.rb}
|
385
|
+
|
386
|
+
The most basic example
|
387
|
+
----------------------
|
388
|
+
|
389
|
+
This vocabulary specifies that services can have an availability, expressed as an integer:
|
390
|
+
|
391
|
+
fact :availability do
|
392
|
+
integer :availability
|
393
|
+
end
|
394
|
+
|
395
|
+
This defines a Fact class `Availability`, with an integer property `availability` which can be instantiated within service descriptions as:
|
396
|
+
|
397
|
+
has_availability 100
|
398
|
+
|
399
|
+
or just
|
400
|
+
|
401
|
+
availability 100
|
402
|
+
|
403
|
+
If `service` would be a service description object, this would output `100`
|
404
|
+
|
405
|
+
puts service.availability
|
406
|
+
|
407
|
+
The definition of color
|
408
|
+
-----------------------
|
409
|
+
|
410
|
+
The following type class definition is used to specify that the type `:color` is defined by a hexadecimal value, stored in a string.
|
411
|
+
|
412
|
+
type :color do
|
413
|
+
string :hex_value
|
414
|
+
end
|
415
|
+
|
416
|
+
It is now possible to define instances of this type and assign them symbolic names, such as `red`, `green` or `blue`:
|
417
|
+
|
418
|
+
color :red do
|
419
|
+
hex_value '#F00'
|
420
|
+
end
|
421
|
+
|
422
|
+
color :green do
|
423
|
+
hex_value '#0F0'
|
424
|
+
end
|
425
|
+
|
426
|
+
color :blue do
|
427
|
+
hex_value '#00F'
|
428
|
+
end
|
429
|
+
|
430
|
+
After definition of types, a service fact class can be defined, referring to this type.
|
431
|
+
|
432
|
+
fact :color do
|
433
|
+
color :color
|
434
|
+
end
|
435
|
+
|
436
|
+
Now, differently colored services can be described, e.g.:
|
437
|
+
|
438
|
+
red_service.service.rb:
|
439
|
+
has_color :blue
|
440
|
+
|
441
|
+
green_service.service.rb:
|
442
|
+
has_color :green
|
443
|
+
|
444
|
+
blue_service.service.rb:
|
445
|
+
has_color :blue
|
446
|
+
|
447
|
+
Contributing
|
448
|
+
============
|
449
|
+
|
450
|
+
1. Fork it
|
451
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
452
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
453
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
454
|
+
5. Create new Pull Request
|