Quick Introduction to SADL 3

Last revised 04/20/2017. Send comments to mailto:crapo@research.ge.com.

Current Status

An alpha release of SADL Version 3 is available at https://github.com/crapo/sadlos2/releases. Note that SADL source code is now hosted on github.com.

Know limitations

  1. Translation of rules, tests, and queries is not complete
  2. The syntax for rules, tests, and queries are not entirely backwards compatible. In particular, an explicit "and" is required between elements of a rule condition or conclusion and between query elements.

What's New or Different

Grammar

  1. Properties
    1. rdf:Property: properties that are not given a range as part of their definition are created as rdf:Property in the ontology OWL file. These properties are colored a lighter green in the SADL editor.
      • causes is a property.
    2. Properties without range: properties can be forced to be an owl:ObjectProperty or an owl:DatatypeProperty using the range statements "with values of type class" or "with values of type data", respectively. No range is given to the class but the specified OWL property type is created.
      • likes is a property with values of type class.

      • size is a property with values of type data.

  2. User-defined datatypes
    1. syntax for user-defined datatypes has changed to be more consistent with the rest of the grammar
      • <user-defined-datatype-name> is a type of <xsd-data-type(s)> <facets>
      • Examples

        over12 is a type of int [12,]. // an int >= 12
        clothingsize
        is a type of {int or string}. // either an int or a string
        enumeratedheight
        is a type of string {"short", "medium", "tall"}. // enumeration of 3 possible string values
        SSN
        is a type of string "[0-9]{3}-[0-9]{2}-[0-9]{4}".
        year
        is a type of int length 4 .
        Airport_Ident
        is a type of string length 1-4 .

    2. now implemented as RDFS Datatypes

      Latitude is a type of float [-90, 90].

      <rdfs:Datatype rdf:ID="Latitude">
          <owl:equivalentClass>
              <rdfs:Datatype>
                  <owl:withRestrictions rdf:parseType="Collection">
                      <rdf:Description>
                          <xsd:maxInclusive>90</xsd:maxInclusive>
                          <xsd:minInclusive>-90</xsd:minInclusive>
                      </rdf:Description>
                  </owl:withRestrictions>
                  <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#float"/>
              </rdfs:Datatype>
          </owl:equivalentClass>
      </rdfs:Datatype>

  3. Typed lists
    1. Example

      Person is a class described by children with values of type Person List.
       

    2. What's happening behind the scenes
      • In SADL list model

      ^List is a class
             
      described by ^first,
             
      described by rest with values of type ^List,
             
      described by lengthRestriction with values of type int,
             
      described by minLengthRestriction with values of type int,
             
      described by maxLengthRestriction with values of type int.

      • So ... children with values of type Person List creates

      <owl:ObjectProperty rdf:ID="children">
              <rdfs:domain rdf:resource="#Person"/>
              <rdfs:range rdf:nodeID="A0"/>
      </owl:ObjectProperty>
      <owl:Class rdf:nodeID="A0">
              <rdfs:subClassOf rdf:resource="sadllistmodel#List"/>
              <rdfs:subClassOf>
                      <owl:Restriction>
                              <owl:allValuesFrom>
                                      <owl:Class rdf:ID="Person"/>
                              </owl:allValuesFrom>
                              <owl:onProperty rdf:resource="sadllistmodel#first"/>
                      </owl:Restriction>
              </rdfs:subClassOf>
              <rdfs:subClassOf>
                      <owl:Restriction>
                              <owl:allValuesFrom rdf:nodeID="A0"/>
                              <owl:onProperty rdf:resource="sadllistmodel#rest"/>
                      </owl:Restriction>
              </rdfs:subClassOf>
      </owl:Class>

    3. List length restrictions are possible for named lists only. An "*" is used to represent no upper-bound on list length. A lower bound is required. (See Cardinality and List Length)

      SmallGroupType is a type of Person List length 0-6.

      LargeGroupType is a type of Person List length 7-*.

    4. An instance of a List can be initialized.

      MyFriends is the Person List [Mark, Samantha]. 

    5. List operations include:
      • "length of <list>"
      • "count of <element> in <list>"
      • "index of <element> in <list>"
      • "the sublist of <list> matching <conditions>"
        •  Items is (the sublist of list_of_items matching var1 is true and var2 is true and var3 is false).
        • OldPeople is (the sublist of all_people matching age > 65 years).
        • GoodGrades is (the sublist of all_grades matching value > 95).
      • "<list> contains <element>", "<list> does not contain <element>"
      • "<element> is unique in <list>", "<element> is not unique in <list>"
      • "element before <element> in <list>", "element after <element> in <list>"
      • "first element of <list>", "last element of <lilst>, "element <expr> in <list>"
    6. For more information, see
  4. Equations

    1. Internally defined (Equation)

      • Equation areaOfSquare(float s) returns float: s^2 .

      • Equation areaOfRectangle(float h, float w) returns float: h*w.

      • Equation areaOfCircle(float r) returns float: PI*r^2.

    2. Externally defined (External)
      • External min(float x, float y) returns float: "java.lang.Math.min".

      • External max(float x, float y) returns float: "java.lang.Math.max".

  5. UnittedQuantity
    1. Person is a class described by gender with a single value of type Gender,
          described
      by age with values of type UnittedQuantity,
          described
      by height with values of type UnittedQuantity,
          described
      by heightPercentile with values of type UnittedQuantity,
          described
      by weight with values of type UnittedQuantity.

      George is a Person with age 23 years, with weight 165 lbs, with height 70 inches, with heightPercentile 50 "%" .
       

    2. Underlying construct

      UnittedQuantity is a class,
             
      described by ^value with values of type decimal,
             
      described by unit with values of type string.
      //UnittedQuantity has impliedProperty ^value.

  6. Implied Properties (See Implied Properties)
    1. In English we say things like: "Martha is 26." "George is 185."
    2. The equivalent in SADL:

      Test: height of George < 70.
      Test: age of George > 21.


    3. Test:
      age of George < age of Joan.
      Test:
      age of George = age of Joan.From SRL

       

    i(1): Implied property 'value' used (left side of 'function') to pass type check

    i(2): Implied property 'value' used (left side of '/') to pass type check

    i(3): Multiple markers at this line
                - Implied property 'validity' added to both sides of 'set to' in translation
                - Implied property 'value' added to both sides of 'set to' in translation

    i(4): Implied property 'value' used (left side of '>') to pass type check

  7. SADL Implicit Models
    1. in OwlModels folder
      • SadlBaseModel.owl
      • Equation
      • External   
      • SadlListModel.owl (but only if List is used)
    2. in the ImplicitModel folder
      • SadlBuiltinFunctions.sadl (generated by selected translator)
      • SadlImplicitModel.sadl (content from SADL and from deriviative grammars, editable/extensible by user, edits preserved)

    • Lines 1 through 6 added by SADL plug-ins.
    • Lines 9 through 26 added by SRL plug-ins.
       
  8. Graphing (Graph files in the Graphs folder)
    1. Neighborhood graphs, anchored on class, individual, or property
    2. Complete ontology graph including graph of imports
    3. The SADL Xtext Grammar