From 5e2fcc9c5c2dba49adbf8bc481510def62b62436 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@DESKTOP-2S09UKA> Date: Thu, 10 Oct 2019 19:36:39 -0700 Subject: [PATCH] processScenes.turtle, clean.turtle --- build.xml | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 125 insertions(+), 4 deletions(-) diff --git a/build.xml b/build.xml index 7bc2f5b3a5..af28c8c22d 100644 --- a/build.xml +++ b/build.xml @@ -140,6 +140,9 @@ POSSIBILITY OF SUCH DAMAGE. <!-- TODO other OS variants needed? --> <property name="pyjnius.configurationPath" location="${env.JAVA_HOME}/jre/bin/server;${env.Path}"/><!-- help pyjnius find jvm.dll --> + <property name="arq" location="${env.JENA_HOME}/bat/arq.bat" description="executable invocation, bat/arq.bat or bin/arq"/> + <property name="semantics.dir" location="../../../../semantics"/> + <!-- ======================================== --> <!-- Xj3D internal paths for finding OS-specific /natives files, adapted from from NPS-branch build_nps.xml and build.properties --> @@ -533,7 +536,7 @@ Key references: </fail> </target> - <target name="clean.all" depends="clean.backups,clean.duplicates,clean.Canonical.xml,clean.htmlListings,clean.java,clean.schematron,clean.SVG,clean.wrl,clean.json,clean.x3dv,clean.x3db,clean.X3domXhtml,clean.X_ITE.html,clean.slideshowTools,clean.catalog.pages,clean.X3dTidy" description="clean out autogenerated files (only)"> + <target name="clean.all" depends="clean.backups,clean.duplicates,clean.Canonical.xml,clean.htmlListings,clean.java,clean.schematron,clean.SVG,clean.wrl,clean.json,clean.x3dv,clean.x3db,clean.X3domXhtml,clean.X_ITE.html,clean.slideshowTools,clean.catalog.pages,clean.X3dTidy,clean.python,clean.turtle" description="clean out autogenerated files (only)"> <echo message="clean/delete autogenerated ${archive.name} catalog pages and files matching *.x3d scenes: *.html *.wrl *.x3db *.x3dv *Canonical.xml (but do not clean autogenerated images under version control)"/> <!-- delete autogenerated directories, but not _archive directory --> <delete dir="_svg" quiet="true" includeemptydirs="true" failonerror="false"/> @@ -1695,7 +1698,8 @@ ignoreSetupDownloadErrors=true <Saxon9 scene="HelloWorld" stylesheet="${stylesheet.dir}/X3dToPython" extension="py" - expand="on"/> + expand="on" + parameterPair1="insertPackagePrefix=false"/> <!-- expand:on since DTD defaults needed --> <if> @@ -1849,7 +1853,8 @@ ignoreSetupDownloadErrors=true <Saxon9 scene="newScene" stylesheet="${stylesheet.dir}/X3dToPython" extension="py" - expand="on"/> + expand="on" + parameterPair1="insertPackagePrefix=false"/> <!-- expand:on since DTD defaults needed --> <if> @@ -3806,6 +3811,18 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos </delete> </target> + <target name="clean.turtle"> + <echo message="ensuring any prior converted turtle source files are cleared out..."/> + <delete verbose="true" failonerror="false"> + <fileset dir="."> + <include name="**/*.ttl"/> + <include name="**/*.rq.txt"/> + <exclude name="_archive/*"/> + <exclude name="**/originals/**/*"/> + </fileset> + </delete> + </target> + <target name="processScenes.X3DJSAIL.DomLoaderTests" description="test DOM-based scene loading by X3DJSAIL.X3DLoader" depends=""> <echo message="test DOM-based scene loading by X3DJSAIL.X3DLoader"/> <echo message="Verifying Apache Ant XML Catalog resolver classpath: ${resolver.dir}/resolver.jar (${resolver.jar.length} bytes)"/> @@ -4080,7 +4097,7 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos <Saxon9 scene="${relative.path1}/${relative.path2}/${name.short}" stylesheet="${stylesheet.dir}/X3dToPython" extension="py" - parameterPair1="insertPackagePrefix=true" + parameterPair1="insertPackagePrefix=false" expand="on"/> <!-- expand:on since DTD defaults needed --> <!-- Default options: @@ -4114,6 +4131,110 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos <echo message="==============================================================="/> </target> + <target name="processScenes.turtle" description="generate turtle source, run validation test" depends="clean.RoundTrip"> + <echo message="Verifying Apache Ant XML Catalog resolver classpath: ${resolver.dir}/resolver.jar (${resolver.jar.length} bytes)"/> + <echo message="==================================="/> + <for param="file.path.name"> + <path> + <fileset refid="x3dScenes"/> + </path> + <sequential> + <propertyregex + property="name.short" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)[\\/]([^\n]*)\.x3d" + select="\2"/> + <propertyregex + property="relative.path1" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)Savage[\\/]([^\n^\\^/]*)[\\/]([^\n]*)\.x3d" + select="\2"/> + <propertyregex + property="relative.path2" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)Savage[\\/]([^\n^\\^/]*)[\\/]([^\n^\\^/]*)([\\/][^\n]*)\.x3d" + select="\3"/> + <!-- trace + <echo></echo> + <echo>@file.path.name = @{file.path.name}</echo> + <echo>$archive.path = ${archive.path}</echo> + <echo>$relative.path1 = ${relative.path1}</echo> + <echo>$relative.path2 = ${relative.path2}</echo> + <echo>$name.short = ${name.short}</echo> + --> + <outofdate> + <sourcefiles> + <filelist> + <file name="@{file.path.name}"/> + </filelist> + </sourcefiles> + <mapper dir="." type="glob" from="*.x3d" to="*.ttl"/> + <sequential> + <!-- process individual files here. show full path to facilitate user loading, editing of reported files --> + <!-- see ../semantics/build.xml --> + <!-- + <echo message="validate original source: ${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d"/> + <java classname="org.web3d.x3d.jsail.CommandLine" classpath="${x3djsail.stylesheets.dir}//${jsai.full.archive.jar.name};." fork="${fork}"> + <arg value="-validate"/> + <arg value="${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d"/>< ! - - input model - - > + </java> + <echo message="- - - - - - - - - - -"/> + --> + <echo message="create turtle:"/> + <!-- process individual files here. show full path to facilitate user loading, editing of reported files --> + <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dToTurtle stylesheet...</echo> + <!-- Saxon9 is locally defined macro --> + <Saxon9 scene="${relative.path1}/${relative.path2}/${name.short}" + stylesheet="${stylesheet.dir}/X3dToTurtle" + extension="ttl" + parameterPair1="defaultModelPrefix=" + expand="on"/> + <!-- + expand:on since DTD defaults needed --> + <!-- Default options: + parameterPair1="defaultModelPrefix=" + --> + <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.ttl self-validation test:</echo> + <if> + <!-- https://ant.apache.org/manual/Tasks/conditions.html --> + <contains string="${name.short}" substring="{name.short}" /><!-- undefined --> + <then> + <echo message="filename not found"/> <!-- in order to get a filename --> + </then> + <else> + <!-- verbose output of converted .ttl file + <loadfile property="turtleFileContents" srcFile="${relative.path1}/${relative.path2}/${name.short}.ttl" /> + <echo message="${turtleFileContents}" /> + <echo /> --> + <!-- create query output file --> + <copy file="${semantics.dir}/queries/X3dHelloWorldQuery_03.rq" tofile="${relative.path1}/${relative.path2}/${name.short}.rq.txt"/> + <echo message="${arq} --data ${semantics.dir}/ontologies/X3dOntology4.0.ttl --query ${semantics.dir}/queries/X3dHelloWorldQuery_03.rq --graph ${relative.path1}/${relative.path2}/${name.short}.ttl"/> + <exec executable="${arq}" dir="." vmlauncher="false"> + <arg value="--data"/> + <arg value="${semantics.dir}/ontologies/X3dOntology4.0.ttl"/> + <arg value="--query"/> + <arg value="${semantics.dir}/queries/X3dHelloWorldQuery_03.rq"/> + <arg value="--graph"/> + <arg value="${relative.path1}/${relative.path2}/${name.short}.ttl"/> + <redirector output="${relative.path1}/${relative.path2}/${name.short}.rq.txt" alwayslog="true" append="true"/> + </exec> + <echo message="test.X3dToTurtle.xslt.one conversion of ${name.short}.x3d to ${name.short}.ttl complete."/> + </else> + </if> + <echo message="==================================="/> + </sequential> + </outofdate> + </sequential> + </for> + <antcall target="echo.timestamp"/> + <echo>processScenes.turtle complete.</echo> + <!-- <antcall target="processScenes.javadoc"/> --> + <echo message="==============================================================="/> + </target> + <target name="processScenes.javadoc"> <property name="javadoc.windowtitle" value="${archive.name} Examples Archive Javadoc using X3DJSAIL, X3D Java Scene Access Interface Library"/> -- GitLab