Skip to content

Commit

Permalink
add in the generic sys to the testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pahjbo committed Nov 29, 2024
1 parent 2309548 commit 5e6ee0c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 14 deletions.
14 changes: 13 additions & 1 deletion models/sample/test/like_coords.vo-dml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title></title>
<author>Arnold Rots, Mark Cresitello-Dittmar, Omar Laurino</author>
<version>1.0</version>
<lastModified>2024-11-28T11:52:20Z</lastModified>
<lastModified>2024-11-29T09:02:40Z</lastModified>
<import>
<name>ivoa</name>
<version>1.0</version>
Expand Down Expand Up @@ -1051,5 +1051,17 @@
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
<composition>
<vodml-id>AnObject.sys</vodml-id>
<name>sys</name>
<description>the system</description>
<datatype>
<vodml-ref>coords:GenericSys</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</composition>
</objectType>
</vo-dml:model>
1 change: 1 addition & 0 deletions models/sample/test/like_coords.vodsl
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,5 @@ otype CartesianCoordSpace -> PhysicalCoordSpace "Spatial domain, three-dimensio
otype AnObject "example content" {
position:LonLatPoint "the position";
time:MJD "The time";
sys: GenericSys as composition "the system";
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class CoordsModelDbTest extends AutoDBRoundTripTest<CoordsModel,Long,AnObject> {
/** logger for this class */
private static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(CoordsModelDbTest.class);

private AnObject a;

@Override
public CoordsModel createModel() {
// see
// https://github.com/mcdittmar/ivoa-dm-examples/blob/master/assets/examples/coords/current/instances/astrocoordsys.jovial for jovial version of this test.
Unit deg = new Unit("deg");
Unit kms = new Unit("kms");
SpaceSys ICRS_SYS =
new SpaceSys()
.withFrame(
Expand Down Expand Up @@ -62,7 +64,10 @@ public CoordsModel createModel() {
p.lat = new RealQuantity(-16.716116, deg);
p.dist = new RealQuantity(8.6, new Unit("ly"));
p.coordSys = ICRS_SYS;
}));
}))
.withVelocity(new CartesianPoint(new RealQuantity(5.0,kms),
new RealQuantity(5.0,kms), new RealQuantity(5.0,kms), ICRS_SYS));//IMPL cartesianpoint for a velocity!

}));
GenericSys SPECSYS =
new GenericSys()
Expand All @@ -73,17 +78,14 @@ public CoordsModel createModel() {
f.planetaryEphem = "DE432";
}));


SpaceSys GENSYS = null;

// note that this cannot be added directly as it is a dtype...
LonLatPoint llp = new LonLatPoint(new RealQuantity(45.0, deg), new RealQuantity(15.0, deg), new RealQuantity(1.5, new Unit("Mpc")), ICRS_SYS);
MJD mjd = new MJD(60310.0, TIMESYS_TT);
a = new AnObject(llp,mjd);
a = new AnObject(llp,mjd, SPECSYS);
CoordsModel modelInstance = new CoordsModel();

modelInstance.addReference(TIMESYS_TT);
modelInstance.addReference(SPECSYS);
modelInstance.addReference(ICRS_SYS);
modelInstance.addContent(a);


Expand All @@ -107,9 +109,24 @@ public void testModel(CoordsModel coordsModel) {
List<AnObject> ts = coordsModel.getContent(AnObject.class);
assertNotNull(ts);
assertEquals(1, ts.size());
AnObject ts1 = ts.get(0);
SpaceSys ss = ts1.getPosition().getCoordSys();
AnObject ano = ts.get(0);
SpaceSys ss = ano.getPosition().getCoordSys();
assertNotNull(ss);
MJD mjd = ano.getTime();
assertNotNull(mjd);
TimeSys tcsys = mjd.getCoordSys();
assertNotNull(tcsys);
TimeFrame tframe = tcsys.getFrame();
CustomRefLocation rd = (CustomRefLocation)tframe.getRefDirection();
LonLatPoint pos = (LonLatPoint)rd.getPosition();
assertEquals(-16.716116, pos.getLat().getValue());
GenericSys sys = ano.getSys();
GenericFrame gframe = sys.getFrame();
StdRefLocation gref = (StdRefLocation) gframe.getRefPosition();
assertEquals("TOPOCENTER",gref.getPosition());




}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,9 @@ public CoordsModel createModel() {
// note that this cannot be added directly as it is a dtype...
LonLatPoint llp = new LonLatPoint(new RealQuantity(45.0, deg), new RealQuantity(15.0, deg), new RealQuantity(1.5, new Unit("Mpc")), ICRS_SYS);
MJD mjd = new MJD(60000.0, TIMESYS_TT);
AnObject a = new AnObject(llp, mjd);
AnObject a = new AnObject(llp, mjd, SPECSYS);
CoordsModel modelInstance = new CoordsModel();

modelInstance.addReference(TIMESYS_TT);
modelInstance.addReference(SPECSYS);
modelInstance.addReference(ICRS_SYS);
modelInstance.addContent(a);


Expand Down
3 changes: 2 additions & 1 deletion tools/xslt/jpa.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@
<xsl:param name="nillable"/>
@jakarta.persistence.Embedded
<xsl:variable name="attovers" as="xsd:string*">

<!-- IMPL - this code is a bit ugly - is attempting to deal with the case where a dataType has a dataType member (quite frequent as base model has quantities)
it probably can be refactored to be a bit more recursive -->
<xsl:variable name="atv" as="xsd:string*">
<xsl:apply-templates select="$models/key('ellookup',current()/datatype/vodml-ref)" mode="attrovercols"><xsl:with-param name="prefix" select="$name"/></xsl:apply-templates>
</xsl:variable>
Expand Down

0 comments on commit 5e6ee0c

Please sign in to comment.