lapps / vocabulary-pages

DSL files and templates used to generate the LAPPS WS-EV pages.
Apache License 2.0
0 stars 0 forks source link

Data types in the vocabulary #96

Open marcverhagen opened 5 years ago

marcverhagen commented 5 years ago

The 1.3.0 snapshot has a new data type name Datatype#list_uri, see the Token type for an example. Until now, the type listed for the values of properties were things like String, Integer, String or URI, List of URI, List of IDs,Set of IDs, List of Strings, and maybe a few I missed. The new Datatype#list_uri is a datatype defined in the vocabulary and is associated with a URI which is printed here since the link is broken (this is somewhat simplified):

<xs:schema 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    attributeFormDefault="unqualified"
    elementFormDefault="qualified">
    <xs:simpleType name="list_uri" id="list_uri">
        <xs:restriction>
            <xs:simpleType>
                <xs:list itemType="xs:anyURI"/>
            </xs:simpleType>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="string_list" id="string_list">
        <xs:restriction>
            <xs:simpleType>
                <xs:list itemType="xs:string"/>
            </xs:simpleType>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

The reason appears to be that this is needed for generating RDF schema. Some general remarks and questions on this for discussion:

ksuderman commented 5 years ago

I think we discussed this during a tech call, but just to capture the reasoning here.

The reason for the Datatype#list_uri is as you assumed, we need an XML Schema type for the RDF representations and "List of URI" is not a Schema datatype like "List of IDs" (xs:IDREFS) is. However, is is easy enough to define our own XS types and Datatype#list_uri (and Datatype#string_list) is defined at the bottom of the lapps.vocabulary file. The Vocabulary DSL processor uses those definitions to generate the XML Schemas for the types that can then be deployed to vocab.lappsgrid.org. I have modified the DSL processor to recognize "List of URI" as a synonym for Datatype#list_uri, but such synonyms required modifying, recompiling, and redeploying the DSL processor. Whereas new datatypes can be used right away simply by defining them in the lapps.vocabulary file without any changes to the DSL processor.

ksuderman commented 5 years ago

I have tweaked the Vocabulary DSL so that human readable aliases can be defined for XML Schema types that are defined. This allows authors to use things like "List of URI" or "List of Strings" in the documentation/DSL that are translated into the correct XML Schema definitions in the RDF.

The main changes to the vocabulary files are:

  1. Move the Datatype definitions to the file Datatypes.schema.
  2. include the Datatypes.schema file at the top of the lapps.vocabulary.
  3. Add human readable aliases for the XML Schema types defined.

The Datatypes.schema file is just an XML Schema that uses Groovy MarkupBuilder syntax instead of XML. Refer to the XML Schema Datatype documentation (or any good XML Schema tutorial) for the elements and attributes that are allowed in XML Schema.