7 |
|
|
8 |
<project name="VO-DML-builder" default="run_vo-dml" basedir="."> |
<project name="VO-DML-builder" default="run_vo-dml" basedir="."> |
9 |
|
|
10 |
<description> |
<description> |
11 |
This build file can be considered as the transformer tool for any data model in VO-DML format, |
This build file can be considered as the transformer tool for any data model in VO-DML format, |
12 |
the official IVOA VO-DML data model language. |
the official IVOA VO-DML data model language. |
13 |
Such files can be generated from an xmi file formatted with MagicDraw CE 12.1. [TODO add more info about this]. |
Such files can be generated from an xmi file formatted with MagicDraw CE 12.1. [TODO add more info about this]. |
14 |
But can also be written by hand or generated any other way. |
But can also be written by hand or generated any other way. |
15 |
Further targets exist for |
Further targets exist for |
36 |
</description> |
</description> |
37 |
|
|
38 |
|
|
39 |
<property file="build.properties" /> |
<property file="build.properties" /> |
40 |
<property file="${model}/vo-dml.properties" /> |
<property file="${model}/vo-dml.properties" /> |
41 |
<property name="ant.contrib.jar" value="./libs/ant-contrib-0.6.jar"/> |
<property name="ant.contrib.jar" value="./libs/ant-contrib-0.6.jar"/> |
42 |
|
|
43 |
<!-- define XSLT2 task --> |
|
44 |
<presetdef name="xslt2"> |
<!-- define XSLT2 task --> |
45 |
<!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. --> |
<presetdef name="xslt2"> |
46 |
<!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 --> |
<!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. --> |
47 |
<xslt force="true" classpath="./libs/saxon9.jar:./libs/ant-trax.jar:./libs" processor="SaxonLiaison"> |
<!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 --> |
48 |
<outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" /> |
<xslt force="true" classpath="./libs/saxon9.jar:./libs/ant-trax.jar:./libs" processor="SaxonLiaison"> |
49 |
</xslt> |
<outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" /> |
50 |
</presetdef> |
</xslt> |
51 |
|
</presetdef> |
52 |
<target name="set-ant-contrib" if="ant.contrib.jar"> |
|
53 |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
<target name="set-ant-contrib" if="ant.contrib.jar"> |
54 |
<classpath> |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
55 |
<pathelement location="${ant.contrib.jar}" /> |
<classpath> |
56 |
</classpath> |
<pathelement location="${ant.contrib.jar}" /> |
57 |
</taskdef> |
</classpath> |
58 |
</target> |
</taskdef> |
59 |
|
</target> |
|
<!-- allow use of schematron to validate vo-dml --> |
|
|
<!-- |
|
|
<taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="./xslt/libs/ant-schematron-2010-04-14.jar" /> |
|
|
--> |
|
|
<!-- set global properties for this build --> |
|
60 |
|
|
61 |
<!-- Get build properties (model dependent) --> |
<!-- allow use of schematron to validate vo-dml --> |
62 |
|
<!-- |
63 |
|
<taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="./libs/ant-schematron-2010-04-14.jar" /> |
64 |
|
--> |
65 |
|
<!-- set global properties for this build --> |
66 |
|
|
67 |
|
<!-- get build properties (model dependent) --> |
68 |
|
<tstamp> |
69 |
|
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" /> |
70 |
|
</tstamp> |
71 |
|
|
72 |
|
<!-- unused/obsolete ??? |
73 |
|
<property name="source_checked" value="${dm.filename.prefix}_CHECK.xml" /> |
74 |
|
<property name="paths.target" value="${dm.filename.prefix}.paths.html" /> |
75 |
|
<property name="paths.target.xml" value="${dm.filename.prefix}.paths.xml" /> |
76 |
|
<property name="pojo.target" value="${dm.filename.prefix}.pojo.xml" /> |
77 |
|
<property name="uml" location="./uml" /> |
78 |
|
<property name="build" location="./build"/> |
79 |
|
<property name="build.jaxb" location="${build}/jaxb" /> |
80 |
|
<property name="build.jaxb.jar" value="vo-dml.jaxb.jar" /> |
81 |
|
<property name="build.src" location="${build}/src" /> |
82 |
|
<property name="build.src.jar" value="vo-dml.src.jar" /> |
83 |
|
<property name="build.gen" location="${build}/gen" /> |
84 |
|
<property name="build.gen.jar" value="vo-dml.models.jar" /> |
85 |
|
--> |
86 |
|
|
87 |
|
<!-- locations of support code/modules --> |
88 |
|
<property name="libs" location="./libs" /> |
89 |
|
<property name="xsd" location="../xsd" /> |
90 |
|
<property name="xslt" location="./xslt" /> |
91 |
|
|
92 |
|
<!-- vo-dml generation properties --> |
93 |
|
<property name="vo-dml.dir" value="${model}/xml" /> |
94 |
|
<property name="vo-dml.source" value="${dm.filename.prefix}.vo-dml.xml" /> |
95 |
|
|
96 |
|
<property name="html.dir" value="${model}" /> |
97 |
|
<property name="html.target" value="${dm.filename.prefix}.html" /> |
98 |
|
<property name="graphviz.gvd" value="${dm.filename.prefix}.gvd" /> |
99 |
|
<property name="graphviz.png" value="${dm.filename.prefix}.png" /> |
100 |
|
<property name="graphviz.map" value="${dm.filename.prefix}.cmap" /> |
101 |
|
<property name="graphviz.map.placeholder" value="___GRAPHVIZ_MAP___" /> |
102 |
|
|
103 |
|
|
104 |
|
<!-- java generation properties --> |
105 |
|
<property name="rdf.target" value="${dm.filename.prefix}.ttl"/> |
106 |
|
<property name="java.gen" location="./java/gen" /> |
107 |
|
<property name="sources.gen" location="${java.gen}" /> |
108 |
|
<property name="sources" location="./java/src" /> |
109 |
|
<property name="jaxb" location="./java/jaxb" /> |
110 |
|
<property name="jaxb.preserve" location="./java/jaxb-preserve" /> |
111 |
|
<property name="jaxb.libs" location="${libs}/jaxb" /> |
112 |
|
|
113 |
|
<!-- schema generation properties --> |
114 |
|
<property name="xsd.gen" location="./models-xsd" /> |
115 |
|
|
116 |
|
|
117 |
|
<fileset id="jarfiles" dir="${libs}"> |
118 |
|
<!-- eclipselink (2.2.0) JPA 2.0 reference implementation --> |
119 |
|
<include name="eclipselink.jar" /> |
120 |
|
<include name="kxml2-2.3.0.jar" /> |
121 |
|
<include name="mongo-java-driver-2.9.3.jar" /> |
122 |
|
</fileset> |
123 |
|
|
124 |
|
<!-- target about : --> |
125 |
|
<target name="about" depends="init" description="show information for public targets"> |
126 |
|
<echo>available ant targets : </echo> |
127 |
|
<echo>-------------------------------------------------------------------------------</echo> |
128 |
|
<echo> - updateSpec : make all transformations (uml -> metaModel -> others) </echo> |
129 |
|
<echo> required for the specification </echo> |
130 |
|
<echo>-------------------------------------------------------------------------------</echo> |
131 |
|
</target> |
132 |
|
|
133 |
|
<!-- target init : timestamp --> |
134 |
|
<target name="init"> |
135 |
|
<echo>-------------------------------------------------------------------------------</echo> |
136 |
|
<echo> project name : ${dm.filename.prefix} </echo> |
137 |
|
<echo>-------------------------------------------------------------------------------</echo> |
138 |
|
</target> |
139 |
|
|
140 |
<tstamp> |
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
141 |
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" /> |
vo-dml generation |
142 |
</tstamp> |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
143 |
<!-- |
|
144 |
--> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
145 |
<property name="source_checked" value="${dm.filename.prefix}_CHECK.xml" /> |
<!-- Target: run_vo-dml --> |
146 |
|
<!-- Description: Run xmi2vo-dml, validate_vo-dml, vo-dml2html in sequence --> |
147 |
<property name="vo-dml.source" value="${dm.filename.prefix}.vo-dml.xml" /> |
<!-- on each target model --> |
148 |
<property name="html.target" value="${dm.filename.prefix}.html" /> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
149 |
<property name="rdf.target" value="${dm.filename.prefix}.ttl"/> |
<target name="run_vo-dml" depends="set-ant-contrib" description="generate VO-DML/XML, validate it and generate HTML for all generated model, requires ant-contrib"> |
150 |
<property name="paths.target" value="${dm.filename.prefix}.paths.html" /> |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
151 |
<property name="paths.target.xml" value="${dm.filename.prefix}.paths.xml" /> |
<for list="${models}" param="model"> |
152 |
<property name="pojo.target" value="${dm.filename.prefix}.pojo.xml" /> |
<sequential> |
153 |
<property name="uml" location="./uml" /> |
<ant target="run_xmi2vo-dml" inheritAll="true"/> |
154 |
<property name="xslt" location="./xslt" /> |
<ant target="run_validate_vo-dml" inheritAll="true"/> |
155 |
<property name="java.gen" location="./java/gen" /> |
<ant target="run_vo-dml2html" inheritAll="true"/> |
156 |
<property name="sources.gen" location="${java.gen}" /> |
</sequential> |
157 |
<property name="libs" location="./libs" /> |
</for> |
158 |
<property name="sources" location="./java/src" /> |
</target> |
159 |
<property name="jaxb" location="./java/jaxb" /> |
|
160 |
<property name="jaxb.preserve" location="./java/jaxb-preserve" /> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
161 |
<property name="jaxb.libs" location="${libs}/jaxb" /> |
<!-- Target: run_xmi2vo-dml --> |
162 |
|
<!-- Description: Translate model(s) from XMI to vo-dml/xml --> |
163 |
<property name="xsd" location="./xsd" /> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
164 |
<property name="xsd.gen" location="./models-xsd" /> |
<target name="run_xmi2vo-dml" depends="set-ant-contrib" |
165 |
<property name="build" location="./build"/> |
description="generate VO-DML/XML from XMI for all indicated models, requires ant-contrib"> |
166 |
<property name="build.jaxb" location="${build}/jaxb" /> |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
167 |
<property name="build.jaxb.jar" value="vo-dml.jaxb.jar" /> |
<for list="${models}" param="model"> |
168 |
<property name="build.src" location="${build}/src" /> |
<sequential> |
169 |
<property name="build.src.jar" value="vo-dml.src.jar" /> |
<ant target="xmi2vo-dml" inheritall="false"> |
170 |
<property name="build.gen" location="${build}/gen" /> |
<property name="model" value="@{model}" /> |
171 |
<property name="build.gen.jar" value="vo-dml.models.jar" /> |
</ant> |
172 |
|
</sequential> |
173 |
<property name="graphviz.gvd" value="${dm.filename.prefix}.gvd" /> |
</for> |
174 |
<property name="graphviz.png" value="${dm.filename.prefix}.png" /> |
</target> |
175 |
<property name="graphviz.map" value="${dm.filename.prefix}.cmap" /> |
|
176 |
<property name="graphviz.map.placeholder" value="___GRAPHVIZ_MAP___" /> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
177 |
|
<!-- Target: run_validate_vo-dml --> |
178 |
|
<!-- Description: validate vo-dml/xml model(s) --> |
179 |
<fileset id="jarfiles" dir="${libs}"> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
180 |
<!-- eclipselink (2.2.0) JPA 2.0 reference implementation --> |
<target name="run_validate_vo-dml" depends="set-ant-contrib" |
181 |
<include name="eclipselink.jar" /> |
description="validate all VO-MDL/XML models in the list of input models"> |
182 |
<include name="kxml2-2.3.0.jar" /> |
<fail unless="ant.contrib.jar" message="ant.contrib.jar is not specified, use validate_vo-dml instead with single model in input variable"/> |
183 |
<include name="mongo-java-driver-2.9.3.jar" /> |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
184 |
</fileset> |
<for list="${models}" param="model"> |
185 |
|
<sequential> |
186 |
|
<ant target="validate_vo-dml" inheritall="false"> |
187 |
<!-- target about : --> |
<property name="model" value="@{model}"/> |
188 |
<target name="about" depends="init" description="show information for public targets"> |
</ant> |
189 |
<echo>available ant targets : </echo> |
</sequential> |
190 |
<echo>-------------------------------------------------------------------------------</echo> |
</for> |
191 |
<echo> - updateSpec : make all transformations (uml -> metaModel -> others) </echo> |
</target> |
192 |
<echo> required for the specification </echo> |
|
193 |
<echo>-------------------------------------------------------------------------------</echo> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
194 |
</target> |
<!-- Target: run_vo-dml2html --> |
195 |
|
<!-- Description: generate HTML documentation for model(s) --> |
196 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
197 |
|
<target name="run_vo-dml2html" depends="set-ant-contrib" |
198 |
|
description="generate HTML documentation for all indicated models, requires ant-contrib"> |
199 |
<!-- target init : timestamp --> |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
200 |
<target name="init"> |
<for list="${models}" param="model"> |
201 |
<echo>-------------------------------------------------------------------------------</echo> |
<sequential> |
202 |
<echo> project name : ${dm.filename.prefix} </echo> |
<ant target="vo-dml2html" inheritall="false"> |
203 |
<echo>-------------------------------------------------------------------------------</echo> |
<property name="model" value="@{model}"/> |
204 |
</target> |
</ant> |
205 |
|
</sequential> |
206 |
|
</for> |
207 |
|
</target> |
208 |
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
209 |
vo-dml generation |
|
210 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
211 |
<!-- run all vo-dml targets --> |
<target name="run_vo-dml2rdf" depends="set-ant-contrib" |
212 |
|
description="generate HTML documentation for all indicated models, requires ant-contrib"> |
213 |
<target name="run_xmi2vo-dml" depends="set-ant-contrib" |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
214 |
description="generate VO-DML/XML from XMI for all indicated models, requires ant-contrib"> |
<for list="${models}" param="model"> |
215 |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
<sequential> |
216 |
|
<ant target="vo-dml2rdf" inheritall="false"> |
217 |
<for list="${models}" param="model"> |
<property name="model" value="@{model}"/> |
218 |
<sequential> |
</ant> |
219 |
<ant target="xmi2vo-dml" inheritall="false"> |
</sequential> |
220 |
<property name="model" value="@{model}" /> |
</for> |
221 |
</ant> |
</target> |
222 |
</sequential> |
|
223 |
</for> |
|
224 |
</target> |
<!-- =========================================================================================== --> |
225 |
|
<!-- Targets to be run when ant.contrib,jar is not set and input parameter in build.properties MUST identify a single model --> |
226 |
<target name="run_vo-dml2html" depends="set-ant-contrib" |
<!-- =========================================================================================== --> |
227 |
description="generate HTML documentation for all indicated models, requires ant-contrib"> |
|
228 |
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
229 |
<for list="${models}" param="model"> |
<!-- Target: schematron-compile --> |
230 |
<sequential> |
<!-- Description: --> |
231 |
<ant target="vo-dml2html" inheritall="false"> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
232 |
<property name="model" value="@{model}"/> |
<target name="schematron-compile"> |
233 |
</ant> |
<xslt2 basedir="." style="./schematron/iso_svrl_for_xslt2.xsl" in="${xsd}/vo-dml.v1.0.sch.xml" out="${xslt}/vo-dml.sch.xsl" /> |
234 |
</sequential> |
</target> |
235 |
</for> |
|
236 |
</target> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
237 |
|
<!-- Target: xmi2vo-dml --> |
238 |
|
<!-- Description: Translate single model from XMI to vo-dml/xml --> |
239 |
<target name="vo-dml2html" depends="vo-dml2gvd" if="model" > |
<!-- then generate vodml-ids --> |
240 |
<echo>run_vo-dml2html : starting generate HTML from file ${model}/${dm.filename.prefix}</echo> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
241 |
<xslt2 in="${model}/${vo-dml.source}" out="${model}/${html.target}" style="${xslt}/vo-dml2html.xsl"> |
<target name="xmi2vo-dml" if="xmi.source"> |
242 |
<param name="project_name" expression="${dm.filename.prefix}" /> |
<fail unless="model" message="Must define property 'model' in build.properties !" /> |
243 |
<param name="graphviz_png" if="graphviz.path" expression="${graphviz.png}" /> |
<fail unless="xmi.source.profile" message="Must define property 'xmi.source.profile' in ${model}/vo-dml.properties (the profile according to which XMI file is structured) !" /> |
244 |
<param name="graphviz_map" if="graphviz.path" expression="${graphviz.map.placeholder}" /> |
<echo> Running xmi2vo-dml for ${model}/${xmi.source}</echo> |
245 |
<param name="preamble" expression="${html.preamble}" /> |
<xslt2 in="${model}/${xmi.source}" out="${vo-dml.dir}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/> |
246 |
</xslt2> |
<xslt2 in="${vo-dml.dir}/__TEMP__.vo-dml.xml" out="${vo-dml.dir}/${vo-dml.source}" style="${xslt}/generate-utypes4vo-dml.xsl"/> |
247 |
<ant target="postGenerateHTML" /> |
</target> |
248 |
<echo>run_vo-dml2html : done.</echo> |
|
249 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
250 |
|
<!-- Target: validate_vo-dml --> |
251 |
|
<!-- Description: validate vo-dml file using schematron schema --> |
252 |
|
<!-- TODO add validation by schema itself --> |
253 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
254 |
|
<target name="validate_vo-dml" depends="schematron-compile" if="model"> |
255 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
256 |
|
<echo>Validating against schema, writing :</echo> |
257 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
258 |
|
<echo>Validating against schematron, output written to ${vo-dml.dir}/${vo-dml.source}.svrlt:</echo> |
259 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
260 |
|
<xslt2 basedir="${xslt}" style="${xslt}/vo-dml.sch.xsl" in="${vo-dml.dir}/${vo-dml.source}" out="${vo-dml.dir}/${vo-dml.source}.svrlt" /> |
261 |
|
|
262 |
|
<!-- find errors --> |
263 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
264 |
|
<xslt2 basedir="." |
265 |
|
style="${xslt}/inspect-validation-result.xsl" |
266 |
|
in="${vo-dml.dir}/${vo-dml.source}.svrlt" |
267 |
|
out="${vo-dml.dir}/validation.log"> |
268 |
|
<param name="outputfile" expression="${vo-dml.source}.validation-report.txt" /> |
269 |
|
</xslt2> |
270 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
271 |
|
<record name="${vo-dml.dir}/${vo-dml.source}.validation-report.txt" action="start" append="yes"/> |
272 |
|
<schemavalidate file="${vo-dml.dir}/${vo-dml.source}" failonerror="false" > |
273 |
|
<schema namespace="http://www.ivoa.net/xml/VODML/v1.0" file="${xsd}/vo-dml-v1.0.xsd"/> |
274 |
|
</schemavalidate> |
275 |
|
<record name="${vo-dml.dir}/${vo-dml.source}.validation-report.txt" action="stop"/> |
276 |
|
<delete file="${vo-dml.dir}/validation.log" /> |
277 |
|
</target> |
278 |
|
|
279 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
280 |
|
<!-- Target: vo-dml2html --> |
281 |
|
<!-- Description: generate HTML documentation for a single model --> |
282 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
283 |
|
<target name="vo-dml2html" depends="vo-dml2gvd" if="model" > |
284 |
|
<echo>run_vo-dml2html : starting generate HTML from file ${model}/${dm.filename.prefix}</echo> |
285 |
|
<xslt2 in="${vo-dml.dir}/${vo-dml.source}" out="${html.dir}/${html.target}" style="${xslt}/vo-dml2html.xsl"> |
286 |
|
<param name="project_name" expression="${dm.filename.prefix}" /> |
287 |
|
<param name="graphviz_png" if="graphviz.path" expression="${graphviz.png}" /> |
288 |
|
<param name="graphviz_map" if="graphviz.path" expression="${graphviz.map.placeholder}" /> |
289 |
|
<param name="preamble" expression="${html.preamble}" /> |
290 |
|
</xslt2> |
291 |
|
<ant target="postGenerateHTML" /> |
292 |
|
<echo>run_vo-dml2html : done.</echo> |
293 |
|
</target> |
294 |
|
|
295 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
296 |
|
<!-- Target: vo-dml2gvd --> |
297 |
|
<!-- Description: generates Object Graphs (graphviz tool) for a single --> |
298 |
|
<!-- vo-dml model, then generate model diagrams and a cmap --> |
299 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
300 |
|
<target name="vo-dml2gvd" if="graphviz.path"> |
301 |
|
<fail unless="model" message="Must define property 'model' !" /> |
302 |
|
<echo>run_vo-dml2gvd : starting generate GraphViz from file ${vo-dml.dir}/${vo-dml.source}</echo> |
303 |
|
<xslt2 in="${vo-dml.dir}/${vo-dml.source}" out="${html.dir}/${graphviz.gvd}" style="${xslt}/vo-dml2gvd.xsl" /> |
304 |
|
<exec executable="${graphviz.path}" dir="${html.dir}"> |
305 |
|
<arg value="-Tcmapx" /> |
306 |
|
<arg value="-o${graphviz.map}" /> |
307 |
|
<arg value="-Tpng" /> |
308 |
|
<arg value="-o${graphviz.png}" /> |
309 |
|
<arg value="${graphviz.gvd}" /> |
310 |
|
</exec> |
311 |
|
<echo>run_vo-dml2gvd : done.</echo> |
312 |
|
</target> |
313 |
|
|
314 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
315 |
|
<!-- Target: postGenerateHTML --> |
316 |
|
<!-- Description: --> |
317 |
|
<!-- if a cmap file is created, insert it in the HTML file --> |
318 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
319 |
|
<target name="postGenerateHTML" if="graphviz.path"> |
320 |
|
<loadfile property="map" srcfile="${html.dir}/${graphviz.map}" /> |
321 |
|
<replace file="${html.dir}/${html.target}" token="${graphviz.map.placeholder}" value="${map}" /> |
322 |
</target> |
</target> |
323 |
|
|
324 |
|
|
325 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
326 |
|
<target name="validate_vo-dml-instance" > |
327 |
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
328 |
|
<echo>Validating against schema, writing :</echo> |
329 |
|
<schemavalidate file="${vo-dml-instance.file}" failonerror="false" > |
330 |
|
<schema namespace="http://volute.g-vo.org/dm/vo-dml-instance/v0.x" file="${xsd}/vo-dml-instance.xsd"/> |
331 |
|
</schemavalidate> |
332 |
|
</target> |
333 |
|
|
334 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
335 |
|
<target name="validateVOTable" description="For testing an annotated VOTable file against the updated VOTable schema"> |
336 |
|
<schemavalidate file="${votable.file}" failonerror="false" > |
337 |
|
<schema namespace="http://www.ivoa.net/xml/VOTable/v1.4_vodml" |
338 |
|
file="${xsd}/ext/VOTable-1.4_vodml.xsd"/> |
339 |
|
</schemavalidate> |
340 |
|
</target> |
341 |
|
|
342 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
343 |
|
<target name="vo-dml2rdf" if="model"> |
344 |
|
<echo>vo-dml2html : starting generate RDF from file ${model}/${dm.file.prefix}</echo> |
345 |
|
<xslt2 in="${model}/${vo-dml.source}" out="${model}/${rdf.target}" style="${xslt}/vo-dml2rdf.xsl"/> |
346 |
|
<echo>run_vo-dml2rdf : done.</echo> |
347 |
|
</target> |
348 |
|
|
349 |
|
|
350 |
|
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
351 |
<target name="run_vo-dml2pojo" description="Generate POJO java classes for all models identified in mapping.file"> |
<target name="run_vo-dml2pojo" description="Generate POJO java classes for all models identified in mapping.file"> |
352 |
<fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" /> |
<fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" /> |
353 |
<echo>run_vo-dml2pojo : starting generate Java code for all models in mapping file ${mapping.file}</echo> |
<echo>run_vo-dml2pojo : starting generate Java code for all models in mapping file ${mapping.file}</echo> |
|
|
|
354 |
<xslt2 in="${mapping.file}" out="${java.gen}/run_pojo.txt" style="${xslt}/vo-dml2pojo.xsl"> |
<xslt2 in="${mapping.file}" out="${java.gen}/run_pojo.txt" style="${xslt}/vo-dml2pojo.xsl"> |
355 |
<param name="mapping_file" expression="${mapping.file}" /> |
<param name="mapping_file" expression="${mapping.file}" /> |
356 |
<param name="vo-dml_package" expression="${vodml.package}" /> |
<param name="vo-dml_package" expression="${vodml.package}" /> |
357 |
</xslt2> |
</xslt2> |
358 |
|
<ant target="format"/> |
359 |
<ant target="format"/> |
</target> |
360 |
<!-- |
|
361 |
--> |
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
|
</target> |
|
|
|
|
|
<target name="run_vo-dml2rdf" depends="set-ant-contrib" |
|
|
description="generate HTML documentation for all indicated models, requires ant-contrib"> |
|
|
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
|
|
<for list="${models}" param="model"> |
|
|
<sequential> |
|
|
<ant target="vo-dml2rdf" inheritall="false"> |
|
|
<property name="model" value="@{model}"/> |
|
|
</ant> |
|
|
</sequential> |
|
|
</for> |
|
|
</target> |
|
|
|
|
|
|
|
|
<target name="run_vo-dml" depends="set-ant-contrib" description="generate VO-DML/XML, validate it and generate HTML for all generated model, requires ant-contrib"> |
|
|
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
|
|
<for list="${models}" param="model"> |
|
|
<sequential> |
|
|
<ant target="run_xmi2vo-dml" inheritAll="true"/> |
|
|
<ant target="run_validate_vo-dml" inheritAll="true"/> |
|
|
<ant target="run_vo-dml2html" inheritAll="true"/> |
|
|
</sequential> |
|
|
</for> |
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
<target name="run_validate_vo-dml" depends="set-ant-contrib" |
|
|
description="validate all VO-MDL/XML models in the list of input models"> |
|
|
<fail unless="ant.contrib.jar" message="ant.contrib.jar is not specified, use validate_vo-dml instead with single model in input variable"/> |
|
|
<fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" /> |
|
|
<for list="${models}" param="model"> |
|
|
<sequential> |
|
|
<ant target="validate_vo-dml" inheritall="false"> |
|
|
<property name="model" value="@{model}"/> |
|
|
</ant> |
|
|
</sequential> |
|
|
</for> |
|
|
</target> |
|
|
|
|
|
|
|
|
<!-- =========================================================================================== --> |
|
|
<!-- Targets to be run when ant.contrib,jar is not set and input parameter in build.properties MUST identify a single model --> |
|
|
<!-- =========================================================================================== --> |
|
|
|
|
|
<!-- target run_xmi2vo-dml : transform the source model (xmi) to the vo-dml model |
|
|
then generate the utype-s--> |
|
|
<target name="xmi2vo-dml" if="xmi.source"> |
|
|
<fail unless="model" message="Must define property 'model' in build.properties !" /> |
|
|
<fail unless="xmi.source.profile" message="Must define property 'xmi.source.profile' in ${model}/vo-dml.properties (the profile according to which XMI file is structured) !" /> |
|
|
<echo> Running xmi2vo-dml for ${model}/${xmi.source}</echo> |
|
|
<ant target="xmi2vo-dml_${xmi.source.profile}"/> |
|
|
<xslt2 in="${model}/__TEMP__.vo-dml.xml" out="${model}/${vo-dml.source}" style="${xslt}/generate-utypes4vo-dml.xsl"/> |
|
|
<!-- |
|
|
<delete file="${model}/__TEMP__.vo-dml.xml" /> |
|
|
--> |
|
|
</target> |
|
|
<!-- TODO as all the concrete targets below have ame content we can remove them. --> |
|
|
<target name="xmi2vo-dml_MD_CE_12.1" if="model"> |
|
|
<xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"> |
|
|
</xslt2> |
|
|
</target> |
|
|
|
|
|
<target name="xmi2vo-dml_MD17.0.5_Arnold" if="model"> |
|
|
<xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"> |
|
|
</xslt2> |
|
|
</target> |
|
|
|
|
|
<target name="xmi2vo-dml_Altova_UML2.0" if="model"> |
|
|
<xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/> |
|
|
</target> |
|
|
|
|
|
<target name="xmi2vo-dml_Altova_UML2.1.2" if="model"> |
|
|
<xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/> |
|
|
</target> |
|
|
|
|
|
<target name="xmi2vo-dml_Modelio_UML2.4.1" if="model"> |
|
|
<xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/> |
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
<!-- validate vo-dml file using schematron schema --> |
|
|
<!-- TODO add validation by schema itself --> |
|
|
<target name="validate_vo-dml" depends="schematron-compile" if="model"> |
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<echo>Validating against schema, writing :</echo> |
|
|
|
|
|
|
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<echo>Validating against schematron, output written to ${model}/${vo-dml.source}.svrlt:</echo> |
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<xslt2 basedir="./xslt" style="./xslt/vo-dml.sch.xsl" in="${model}/${vo-dml.source}" out="${model}/${vo-dml.source}.svrlt" /> |
|
|
<!-- |
|
|
<schematron schema="./xsd/vo-dml.sch.xml" failonerror="false" file="${model}/${vo-dml.source}" |
|
|
queryLanguageBinding="xslt2" outputFilename="${model}/${vo-dml.source}.svrlt" debugMode="true" |
|
|
resolver="net.sf.saxon.StandardURIResolver"/> |
|
|
--> |
|
|
<!-- find errors --> |
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<xslt2 basedir="." style="./xslt/inspect-validation-result.xsl" |
|
|
in="${model}/${vo-dml.source}.svrlt" |
|
|
out="${model}/validation.log"> |
|
|
<param name="outputfile" expression="${vo-dml.source}.validation-report.txt" /> |
|
|
</xslt2> |
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<record name="${models}/${vo-dml.source}.validation-report.txt" action="start" append="yes"/> |
|
|
<schemavalidate file="${model}/${vo-dml.source}" failonerror="false" > |
|
|
<schema namespace="http://www.ivoa.net/xml/VODML/v1.0" file="./xsd/vo-dml-v1.0.xsd"/> |
|
|
</schemavalidate> |
|
|
<record name="${models}/${vo-dml.source}.validation-report.txt" action="stop"/> |
|
|
|
|
|
<delete file="${model}/validation.log" /> |
|
|
</target> |
|
|
|
|
|
<target name="validate_vo-dml-instance" > |
|
|
<echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo> |
|
|
<echo>Validating against schema, writing :</echo> |
|
|
|
|
|
<schemavalidate file="${vo-dml-instance.file}" failonerror="false" > |
|
|
<schema namespace="http://volute.g-vo.org/dm/vo-dml-instance/v0.x" file="./xsd/vo-dml-instance.xsd"/> |
|
|
</schemavalidate> |
|
|
</target> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<target name="validateVOTable" description="For testing an annotated VOTable file against the updated VOTable schema"> |
|
|
<schemavalidate file="${votable.file}" failonerror="false" > |
|
|
<schema namespace="http://www.ivoa.net/xml/VOTable/v1.4_vodml" |
|
|
file="./xsd/ext/VOTable-1.4_vodml.xsd"/> |
|
|
</schemavalidate> |
|
|
</target> |
|
|
|
|
|
<target name="schematron-compile"> |
|
|
<xslt2 basedir="." style="./xslt/schematron/iso_svrl_for_xslt2.xsl" in="./xsd/vo-dml.sch.xml" out="./xslt/vo-dml.sch.xsl" /> |
|
|
</target> |
|
|
|
|
|
<target name="vo-dml2rdf" if="model"> |
|
|
<echo>vo-dml2html : starting generate RDF from file ${model}/${dm.file.prefix}</echo> |
|
|
|
|
|
<xslt2 in="${model}/${vo-dml.source}" out="${model}/${rdf.target}" style="${xslt}/vo-dml2rdf.xsl"> |
|
|
</xslt2> |
|
|
<echo>run_vo-dml2rdf : done.</echo> |
|
|
</target> |
|
|
|
|
362 |
<target name="run_vo-dml2xsd" description="Generate XML schema files for all models identified in mapping.file"> |
<target name="run_vo-dml2xsd" description="Generate XML schema files for all models identified in mapping.file"> |
363 |
<fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" /> |
<fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" /> |
364 |
<echo>run_vo-dml2xsd : starting generate XML schema files for all models in mapping file ${mapping.file}</echo> |
<echo>run_vo-dml2xsd : starting generate XML schema files for all models in mapping file ${mapping.file}</echo> |
|
|
|
365 |
<xslt2 in="${mapping.file}" out="${xsd.gen}/run_xsd.txt" style="${xslt}/vo-dml2xsd.xsl"> |
<xslt2 in="${mapping.file}" out="${xsd.gen}/run_xsd.txt" style="${xslt}/vo-dml2xsd.xsl"> |
366 |
<param name="mapping_file" expression="${mapping.file}" /> |
<param name="mapping_file" expression="${mapping.file}" /> |
367 |
<param name="schemalocation_root" expression="${schemalocation_root}" /> |
<param name="schemalocation_root" expression="${schemalocation_root}" /> |
368 |
</xslt2> |
</xslt2> |
369 |
</target> |
</target> |
370 |
|
|
371 |
<!-- target run_vo-dml2gvd : generates Object Graphs (graphviz tool) from vo-dml model |
|
|
then generate model diagrams from GVD file and a cmap |
|
|
--> |
|
|
<target name="vo-dml2gvd" if="graphviz.path"> |
|
|
<fail unless="model" message="Must define property 'model' !" /> |
|
|
<echo>run_vo-dml2gvd : starting generate GraphViz from file ${model}/${vo-dml.source}</echo> |
|
|
|
|
|
<xslt2 in="${model}/${vo-dml.source}" out="${model}/${graphviz.gvd}" style="${xslt}/vo-dml2gvd.xsl" /> |
|
|
|
|
|
<exec executable="${graphviz.path}" dir="${model}"> |
|
|
<arg value="-Tcmapx" /> |
|
|
<arg value="-o${graphviz.map}" /> |
|
|
<arg value="-Tpng" /> |
|
|
<arg value="-o${graphviz.png}" /> |
|
|
<arg value="${graphviz.gvd}" /> |
|
|
</exec> |
|
|
<echo>run_vo-dml2gvd : done.</echo> |
|
|
|
|
|
</target> |
|
|
|
|
|
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
|
|
<!-- if a cmap file is created, insert it in the HTML file --> |
|
|
<target name="postGenerateHTML" if="graphviz.path"> |
|
|
<loadfile property="map" srcfile="${model}/${graphviz.map}" /> |
|
|
|
|
|
<replace file="${model}/${html.target}" token="${graphviz.map.placeholder}" value="${map}" /> |
|
|
</target> |
|
|
|
|
|
|
|
372 |
<!-- transformation from XSD to Java classes suited for XmlPullParser --> |
<!-- transformation from XSD to Java classes suited for XmlPullParser --> |
373 |
<target name="run_vo-dml-xsd2java" description="Generate Java classes form XML schema"> |
<target name="run_vo-dml-xsd2java" description="Generate Java classes form XML schema"> |
374 |
<echo>run_xsd2java : starting generate XML schema files for all models in mapping file ${mapping.file}</echo> |
<echo>run_xsd2java : starting generate XML schema files for all models in mapping file ${mapping.file}</echo> |
|
|
|
375 |
<xslt2 in="${xsd}/vo-dml-v1.0.xsd" out="${sources}/log_xsd2pojo.txt" style="${xslt}/xsd2pojo.xsl"> |
<xslt2 in="${xsd}/vo-dml-v1.0.xsd" out="${sources}/log_xsd2pojo.txt" style="${xslt}/xsd2pojo.xsl"> |
376 |
<param name="dir" expression="org/ivoa/vodml/xml/gen" /> |
<param name="dir" expression="org/ivoa/vodml/xml/gen" /> |
377 |
<param name="package" expression="org.ivoa.vodml.xml.gen" /> |
<param name="package" expression="org.ivoa.vodml.xml.gen" /> |
378 |
</xslt2> |
</xslt2> |
379 |
</target> |
</target> |
380 |
|
|
381 |
|
|
|
|
|
|
|
|
|
|
|
382 |
<!-- include java realated targets for compiling generated code and generating some infrastructure classes |
<!-- include java realated targets for compiling generated code and generating some infrastructure classes |
383 |
using JAXB. Latter targets require value for jaxb.dir property in build.properties --> |
using JAXB. Latter targets require value for jaxb.dir property in build.properties --> |
384 |
<!-- |
<!-- |
385 |
--> |
--> |
386 |
&buildJava; |
&buildJava; |
387 |
|
|
|
|
|
|
|
|
388 |
</project> |
</project> |