[Volute] r3604 - in trunk/projects/dm/vo-dml: mapping xslt

Volute commit messages volutecommits at g-vo.org
Wed Oct 26 18:05:21 CEST 2016


Author: gerard.lemson
Date: Thu Oct  6 21:32:20 2016
New Revision: 3604

Log:
updates to improve formatting of vo-dml-i representaiton of interpreted VOTable.

Modified:
   trunk/projects/dm/vo-dml/mapping/test3.votable.xml
   trunk/projects/dm/vo-dml/mapping/test3.votable.xml.vo-dml.xml
   trunk/projects/dm/vo-dml/xslt/vo-dml.sch.xsl
   trunk/projects/dm/vo-dml/xslt/vo-dml2pojo.xsl

Modified: trunk/projects/dm/vo-dml/mapping/test3.votable.xml
==============================================================================
--- trunk/projects/dm/vo-dml/mapping/test3.votable.xml	Thu Oct  6 17:35:53 2016	(r3603)
+++ trunk/projects/dm/vo-dml/mapping/test3.votable.xml	Thu Oct  6 21:32:20 2016	(r3604)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Standalore instances from sample/Filter data model. Secial features: - standalone instances of objecttype - ivoa:quantity.RealQuantity 
+<!-- Standalore instances from sample/Filter data model. Secial features: - standalone instances of objecttype - ivoa:RealQuantity 
 	serializing to PARAM (implicit use of PARAM at unit) and explicitly to GROUP -->
 <VOTABLE xmlns="http://www.ivoa.net/xml/VOTable/v1.3_vodml">
 	<!-- Declaration of VO-DML modes that are used in this annotated VOTable. See $7.1. -->
@@ -130,17 +130,17 @@
 				<GROUP>
 					<VODML>
 						<ROLE>filter:PhotometryFilter.spectralLocation</ROLE>
-						<TYPE>ivoa:quantity.RealQuantity</TYPE>
+						<TYPE>ivoa:RealQuantity</TYPE>
 					</VODML>
 					<PARAM name="unit" datatype="char" arraysize="*" value="nm">
 						<VODML>
-							<ROLE>ivoa:quantity.Quantity.unit</ROLE>
-							<TYPE>ivoa:quantity.Unit</TYPE>
+							<ROLE>ivoa:Quantity.unit</ROLE>
+							<TYPE>ivoa:Unit</TYPE>
 						</VODML>
 					</PARAM>
 					<PARAM name="value" datatype="float" value="1662">
 						<VODML>
-							<ROLE>ivoa:quantity.RealQuantity.value</ROLE>
+							<ROLE>ivoa:RealQuantity.value</ROLE>
 							<TYPE>ivoa:real</TYPE>
 						</VODML>
 					</PARAM>

Modified: trunk/projects/dm/vo-dml/mapping/test3.votable.xml.vo-dml.xml
==============================================================================
--- trunk/projects/dm/vo-dml/mapping/test3.votable.xml.vo-dml.xml	Thu Oct  6 17:35:53 2016	(r3603)
+++ trunk/projects/dm/vo-dml/mapping/test3.votable.xml.vo-dml.xml	Thu Oct  6 21:32:20 2016	(r3604)
@@ -1,73 +1,74 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<vodmli:instance xmlns:vodmli="http://volute.googlecode.com/dm/vo-dml-instance/v0.x">
-	<model>
-		<vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/ivoa/IVOA.vo-dml.xml</vodmlURL>
-		<utypePrefix>ivoa</utypePrefix>
-	</model>
-	<model>
-		<vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/vodml-map/vodml-map.vo-dml.xml</vodmlURL>
-		<utypePrefix>vodml-map</utypePrefix>
-	</model>
-	<model>
-		<vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/photdm-alt/PhotDM-alt.vo-dml.xml</vodmlURL>
-		<utypePrefix>photdm-alt</utypePrefix>
-	</model>
-	<!-- +++++++++ START GROUP[rank=13|vodmlref=(role=|type=filter:PhotometricSystem):id=_2mass]: -->
-	<object vodmlref="filter:PhotometricSystem">
-		<identifier>
-			<transientID>-1</transientID>
-			<altID>
-				<field>_2mass</field>
-				<source>GROUP/@ID</source>
-			</altID>
-		</identifier>
-		<attribute vodmlref="filter:PhotometricSystem.description" name="description">
-			<primitiveValue vodmlref="ivoa:string">The 2MASS phtometric system, consisting of 3 bands</primitiveValue>
-		</attribute>
-		<collection vodmlref="filter:PhotometricSystem.photometryFilter" name="photometryFilter">
-			<object vodmlref="filter:PhotometryFilter">
-				<identifier>
-					<transientID>-2</transientID>
-				</identifier>
-				<attribute vodmlref="filter:PhotometryFilter.name" name="name">
-					<primitiveValue vodmlref="ivoa:string">J</primitiveValue>
-				</attribute>
-				<attribute vodmlref="filter:PhotometryFilter.bandName" name="bandName">
-					<primitiveValue vodmlref="ivoa:string">2mass:J</primitiveValue>
-				</attribute>
-				<attribute vodmlref="filter:PhotometryFilter.spectralLocation" name="spectralLocation">
-					<dataObject vodmlref="ivoa:quantity.RealQuantity">
-						<attribute vodmlref="ivoa:quantity.Quantity.unit" name="unit">
-							<primitiveValue vodmlref="ivoa:quantity.Unit">nm</primitiveValue>
-						</attribute>
-						<attribute vodmlref="ivoa:quantity.RealQuantity.value" name="value">
-							<primitiveValue vodmlref="ivoa:real">1235.0</primitiveValue>
-						</attribute>
-					</dataObject>
-				</attribute>
-			</object>
-			<object vodmlref="filter:PhotometryFilter">
-				<identifier>
-					<transientID>-3</transientID>
-				</identifier>
-				<attribute vodmlref="filter:PhotometryFilter.name" name="name">
-					<primitiveValue vodmlref="ivoa:string">H</primitiveValue>
-				</attribute>
-				<attribute vodmlref="filter:PhotometryFilter.bandName" name="bandName">
-					<primitiveValue vodmlref="ivoa:string">2mass:H</primitiveValue>
-				</attribute>
-				<attribute vodmlref="filter:PhotometryFilter.spectralLocation" name="spectralLocation">
-					<dataObject vodmlref="ivoa:quantity.RealQuantity">
-						<attribute vodmlref="ivoa:quantity.Quantity.unit" name="unit">
-							<primitiveValue vodmlref="ivoa:quantity.Unit">nm</primitiveValue>
-						</attribute>
-						<attribute vodmlref="ivoa:quantity.RealQuantity.value" name="value">
-							<primitiveValue vodmlref="ivoa:real">1662.0</primitiveValue>
-						</attribute>
-					</dataObject>
-				</attribute>
-			</object>
-		</collection>
-	</object>
-	<!-- +++++++++ END GROUP[rank=13|vodmlref=(role=|type=filter:PhotometricSystem):id=_2mass] -->
+<vodmli:instance xmlns:vodmli="http://volute.g-vo.rg/dm/vo-dml-instance/v0.x">
+  <model>
+    <vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/ivoa/IVOA.vo-dml.xml</vodmlURL>
+    <vodmlrefPrefix>ivoa</vodmlrefPrefix>
+  </model>
+  <model>
+    <vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/vodml-map/vodml-map.vo-dml.xml</vodmlURL>
+    <vodmlrefPrefix>vodml-map</vodmlrefPrefix>
+  </model>
+  <model>
+    <vodmlURL>http://volute.g-vo.org/svn/trunk/projects/dm/vo-dml/models/sample/filter/Filter.vo-dml.xml</vodmlURL>
+    <vodmlrefPrefix>filter</vodmlrefPrefix>
+  </model>
+<!-- +++++++++ START GROUP[rank=13|vodmlref=(role=|type=filter:PhotometricSystem):id=_2mass]: -->
+  <object vodmlref="filter:PhotometricSystem">
+    <identifier>
+      <transientID>-1</transientID>
+      <altID>
+        <field>_2mass</field>
+        <source>GROUP/@ID</source>
+      </altID>
+    </identifier>
+    <attribute vodmlRef="filter:PhotometricSystem.description" name="description">
+      <primitiveValue vodmlref="ivoa:string">The 2MASS phtometric system, consisting of 3 bands</primitiveValue>
+    </attribute>
+    <collection vodmlRef="filter:PhotometricSystem.photometryFilter" name="photometryFilter">
+      <object vodmlref="filter:PhotometryFilter">
+        <identifier>
+          <transientID>-2</transientID>
+        </identifier>
+        <attribute vodmlRef="filter:PhotometryFilter.name" name="name">
+          <primitiveValue vodmlref="ivoa:string">J</primitiveValue>
+        </attribute>
+        <attribute vodmlRef="filter:PhotometryFilter.bandName" name="bandName">
+          <primitiveValue vodmlref="ivoa:string">2mass:J</primitiveValue>
+        </attribute>
+        <attribute vodmlRef="filter:PhotometryFilter.spectralLocation" name="spectralLocation">
+          <dataObject vodmlref="ivoa:RealQuantity">
+            <attribute vodmlRef="ivoa:Quantity.unit" name="unit">
+              <primitiveValue vodmlref="ivoa:Unit">nm</primitiveValue>
+            </attribute>
+            <attribute vodmlRef="ivoa:RealQuantity.value" name="value">
+              <primitiveValue vodmlref="ivoa:real">1235.0</primitiveValue>
+            </attribute>
+          </dataObject>
+        </attribute>
+      </object>
+
+      <object vodmlref="filter:PhotometryFilter">
+        <identifier>
+          <transientID>-3</transientID>
+        </identifier>
+        <attribute vodmlRef="filter:PhotometryFilter.name" name="name">
+          <primitiveValue vodmlref="ivoa:string">H</primitiveValue>
+        </attribute>
+        <attribute vodmlRef="filter:PhotometryFilter.bandName" name="bandName">
+          <primitiveValue vodmlref="ivoa:string">2mass:H</primitiveValue>
+        </attribute>
+        <attribute vodmlRef="filter:PhotometryFilter.spectralLocation" name="spectralLocation">
+          <dataObject vodmlref="ivoa:RealQuantity">
+            <attribute vodmlRef="ivoa:Quantity.unit" name="unit">
+              <primitiveValue vodmlref="ivoa:Unit">nm</primitiveValue>
+            </attribute>
+            <attribute vodmlRef="ivoa:RealQuantity.value" name="value">
+              <primitiveValue vodmlref="ivoa:real">1662.0</primitiveValue>
+            </attribute>
+          </dataObject>
+        </attribute>
+      </object>
+    </collection>
+  </object>
+<!-- +++++++++   END GROUP[rank=13|vodmlref=(role=|type=filter:PhotometricSystem):id=_2mass] -->
 </vodmli:instance>

Modified: trunk/projects/dm/vo-dml/xslt/vo-dml.sch.xsl
==============================================================================
--- trunk/projects/dm/vo-dml/xslt/vo-dml.sch.xsl	Thu Oct  6 17:35:53 2016	(r3603)
+++ trunk/projects/dm/vo-dml/xslt/vo-dml.sch.xsl	Thu Oct  6 21:32:20 2016	(r3604)
@@ -558,9 +558,9 @@
           <svrl:text> 
   Attribute <xsl:text/>
             <xsl:value-of select="./../vodml-id"/>
-            <xsl:text/> has illegal multiplicity <xsl:text/>
+            <xsl:text/> has multiplicity <xsl:text/>
             <xsl:value-of select="concat($minOccurs,'..',$maxOccurs)"/>
-            <xsl:text/>.
+            <xsl:text/> which is STRONLY DISCOURAGED.
   </svrl:text>
         </svrl:failed-assert>
       </xsl:otherwise>

Modified: trunk/projects/dm/vo-dml/xslt/vo-dml2pojo.xsl
==============================================================================
--- trunk/projects/dm/vo-dml/xslt/vo-dml2pojo.xsl	Thu Oct  6 17:35:53 2016	(r3603)
+++ trunk/projects/dm/vo-dml/xslt/vo-dml2pojo.xsl	Thu Oct  6 21:32:20 2016	(r3604)
@@ -51,6 +51,7 @@
   <!-- main pattern : processes for root node model -->
   <xsl:template match="/">
   <xsl:for-each select="map:mappedModels/todo/model">
+  <xsl:message >Model: <xsl:value-of select="."/></xsl:message>
   <xsl:variable name="prefix" select="."/>
   <xsl:for-each select="/map:mappedModels/model[name=$prefix]">
   <xsl:choose>
@@ -1056,8 +1057,9 @@
        * @return stringbuffer the given string buffer filled with the string representation
        */
       @Override
-      public void attributesToString(final StringBuilder sb) {
-        super.attributesToString(sb);
+      public void attributesToString(final StringBuilder sb, String offset) {
+        super.attributesToString(sb, offset);
+        String newoffset = offset+"  ";
         Object v = null;
         <xsl:for-each select="attribute">
             <xsl:variable name="name">
@@ -1074,16 +1076,17 @@
           v = get<xsl:value-of select="$name"/>();
           if(v != null)
           {
-        sb.append("<attribute&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\">");
+        sb.append(offset).append("<attribute&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\">").append(NEWLINE);
           <xsl:choose>
             <xsl:when test="$element/name() = 'primitiveType' or $element/name() = 'enumeration'">
-              atomicToString("<xsl:value-of select="datatype/vodml-ref"/>",v, sb);
+              atomicToString("<xsl:value-of select="datatype/vodml-ref"/>",v, sb,newoffset);
+              sb.append(NEWLINE);
             </xsl:when>            
             <xsl:otherwise>
-            ((<xsl:value-of select="$vo-dml_package"/>.DataTypeInstance)v).deepToString(sb.append(NEWLINE));
+            ((<xsl:value-of select="$vo-dml_package"/>.DataTypeInstance)v).deepToString(sb, newoffset);
             </xsl:otherwise>
           </xsl:choose> 
-        sb.append("</attribute>").append(NEWLINE);
+        sb.append(offset).append("</attribute>").append(NEWLINE);
         }
         </xsl:for-each>
       }
@@ -1097,8 +1100,9 @@
        * @return stringbuffer the given string buffer filled with the string representation
        */
       @Override
-      public void referencesToString(final StringBuilder sb) {
-        super.referencesToString(sb);
+      public void referencesToString(final StringBuilder sb, String offset) {
+        super.referencesToString(sb, offset);
+        String newoffset = offset+"  ";
         Object v = null;
         <xsl:for-each select="reference[not(subsets)]">
           <xsl:variable name="element" as="element()">
@@ -1110,11 +1114,11 @@
           v = getProperty("<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>");
           if(v != null)
           {
-            sb.append("<reference&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\"");
+            sb.append(offset).append("<reference&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\"");
             sb.append(" type=\"").append(((<xsl:value-of select="$vo-dml_package"/>.ObjectTypeInstance)v).vodmlRef()).append("\">");
             ObjectID id = ((<xsl:value-of select="$vo-dml_package"/>.ObjectTypeInstance)v).get_ID();
             if(id != null)
-              id.deepToString(sb);
+              id.deepToString(sb, newoffset);
             sb.append("</reference>").append(NEWLINE);
           }
         </xsl:for-each>
@@ -1130,8 +1134,9 @@
        * @return stringbuffer the given string buffer filled with the string representation
        */
       @Override
-      public void collectionsToString(final StringBuilder sb) {
-        super.collectionsToString(sb);
+      public void collectionsToString(final StringBuilder sb, String offset) {
+        super.collectionsToString(sb, offset);
+        String newoffset = offset+"  ";
         <xsl:for-each select="collection[not(subsets)]">
           <xsl:variable name="element" as="element()">
             <xsl:call-template name="Element4vodml-ref" >
@@ -1141,10 +1146,12 @@
           </xsl:variable>
           if(<xsl:value-of select="name"/> != null)
           {
-            sb.append("<collection&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\">");
-            for(<xsl:value-of select="$vo-dml_package"/>.ObjectTypeInstance o: <xsl:value-of select="name"/>)
-                o.deepToString(sb);
-            sb.append("</collection>").append(NEWLINE);
+            sb.append(offset).append("<collection&bl;vodmlRef=\"<xsl:apply-templates select="vodml-id" mode="asvodml-ref"/>\" name=\"<xsl:value-of select="name"/>\">");
+            for(<xsl:value-of select="$vo-dml_package"/>.ObjectTypeInstance o: <xsl:value-of select="name"/>){
+                sb.append(NEWLINE);
+                o.deepToString(sb, newoffset);
+            }
+            sb.append(offset).append("</collection>").append(NEWLINE);
           }
         </xsl:for-each>
       }


More information about the Volutecommits mailing list