Regardless of the format (here I'm using XML), structure is important for data exchange.
Also important is intelligibility of course. Does it make sense? If you look at a structure 6 months from now and go "huh??" then it's a failure. If others look at your structure and wonder what you've been smoking, then it's a failure.
So, my current preference is here. The reason I use XML here is that most people speaks it. We can fight over interchange formats later, elsewhere. Internally there's no difference, and popular formats have readers and writers that operate directly on internal memory structures, so it's a non-issue as far as I'm concerned.
I'll insert comments.
Or, here it is "inverted", with the source data as content:
Also important is intelligibility of course. Does it make sense? If you look at a structure 6 months from now and go "huh??" then it's a failure. If others look at your structure and wonder what you've been smoking, then it's a failure.
So, my current preference is here. The reason I use XML here is that most people speaks it. We can fight over interchange formats later, elsewhere. Internally there's no difference, and popular formats have readers and writers that operate directly on internal memory structures, so it's a non-issue as far as I'm concerned.
I'll insert comments.
Code:
[color=red]
System data exchange (SYS) informal proposal version 0.6
[/color]
[color=blue]
# The outer element for a system contains the data extracted
# from the "UWP line", aka a SEC 2.0 line. I'm not going to
# bother including derivable trade codes here. Special trade
# codes ought to go in their own tags under system, perhaps
# with a reference.
#
# Feel free to add (and ignore) "overview" text.
[/color]
<system allegiance="Na" bases="A" gasGiants="4" hex="0101" mainworld="Fetters
Alpha" planetoids="2" rockballs="4" stars="2" uwp="B373665-B" zone="R">
<overview>This is a boring system.</overview>
[color=red]
# [b]NOTE[/b]: Updated to include "milieu". If the data change is
# that important, it will affect the entire system.
#
# I consider this element optional, and perhaps even unneeded,
# assuming a program is serving data from an agreed-upon milieu
# to another program.
#
# In other words, milieu might be beyond the scope of this structure...
[/color]
<milieu>M1100</milieu>
[color=blue]
# I decided to group worlds (and close binary companions)
# by the star they orbit. Is this a bad idea?
[/color]
<primary type="M8 III">
<companion type="F D" />
<worlds>
<world>
<name>Fetters Alpha</name>
[color=blue]
# Under the UWP is a detailed breakdown for each element --
# if you have data to share, that is.
# Otherwise, feel free to ignore it. I suppose you don't even
# need the "code" attributes. So consider it all being optional
# but potentially useful.
#
# The descriptive text under the UWP elements is taken from
# Traveller's standard tables.
#
# The population text is in western-human-usable format,
# with commas separating thousands places. Is this acceptable?
#
# And feel free to add WorldBuilder elements and comment text,
# too, such as "vitals", "starport details", "physical description"
# and "social description".
[/color]
<UWP code="B373665-B">
<atmosphere code="7" />
<government code="6" />
<hydrographics code="3" />
<lawLevel code="5" />
>
<population code="6" popMult="9" >9,000,000</population>
<size code="3" />
<starport code="B" />
<techLevel code="B">11</techLevel>
</UWP>
<allegiance code="Na">Non-aligned</allegiance>
[color=blue]
# The bases are broken down in a manner similar to the UWP.
[/color]
<bases code="B">
<navy>Naval Base</navy>
<scouts>Scout Way Station</scouts>
</bases>
[color=blue]
# Orbit and trade codes have the "code" separated from the "value",
# just like with the UWP and Base code.
[/color]
<orbit code="5">2.5 AU</orbit>
<tradeCodes>
<tradeCode code="Ni">Non-industrial</tradeCode>
<tradeCode code="Ri" />
</tradeCodes>
<zone code="R">Interdicted</zone>
</world>
<world>
<name>Fetters Beta</name>
<UWP code="A888899-C">
<atmosphere code="8">
<density>Thick</density>
<taint>None</taint>
</atmosphere>
<government code="9" />
<hydrographics code="8">80%</hydrographics>
<lawLevel code="9" />
<population code="8" popMult="4">400,000,000</population>
<size code="8" />
<starport code="A" />
<techLevel code="C">12</techLevel>
</UWP>
<allegiance code="Im">Imperial</allegiance>
<bases code="A">
<navy>Naval Base</navy>
<scouts>Scout Base</scouts>
</bases>
<orbit>6</orbit>
<tradeCodes>
<tradeCode code="Ag">Agricultural</tradeCode>
<tradeCode code="Ri">Rich</tradeCode>
</tradeCodes>
</world>
</worlds>
</primary>
<secondary type="G D" />
</system>
Or, here it is "inverted", with the source data as content:
Code:
<system>
[color=blue]
# Basic metadata is tagged and available. Easy to get at.
[/color]
<mainworld>Fetters Alpha</mainworld>
<hex>0101</hex>
<uwp>B373665-B</uwp>
<bases>B</bases>
<zone>R</zone>
<planetoids>2</planetoids>
<gasGiants>4</gasGiants>
<rockballs>4</rockballs>
<allegiance>Na</allegiance>
<stars>2</stars>
<primary>
<companion>F D</companion>
<orbits>
[color=blue]
# World data is a bit flatter: the UWP digits
# are on the same level as the UWP itself.
[/color]
<world>
<name>Fetters Alpha</name>
<allegiance>Na</allegiance>
<atmosphere>7</atmosphere>
<bases>B</bases>
<codes>
<code>Ni</code>
<code>Ri</code>
</codes>
<government>6</government>
[color=blue]
# Derived, supplemental information are
# in attributes. The core data is the main content.
# How do you feel about that? Worried?
# Seems less flexible. Is it?
[/color]
<hydrographics display="30%">3</hydrographics>
<lawLevel>5</lawLevel>
<orbit>5</orbit>
<popMult>4</popMult>
<population display="4,000,000">6</population>
<size>3</size>
<starport>B</starport>
[color=blue]
# Still have a "decoded" tech level.
[/color]
<techLevel>11</techLevel>
<uwp>B373665-B</uwp>
<zone>R</zone>
</world>
<world>
<name>Fetters Beta</name>
<orbit>6</orbit>
</world>
</orbits>
<star>M8 III</star>
</primary>
</system>
Last edited: