Quick Introduction to SADL 3

Last revised 05/23/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. To install, do the following:

  1. If not already installed, install Java 1.8 from http://www.java.com  (Java 1.8 required!). (See How to check Java Version.)
  2. Download and install Eclipse Standard Kepler SR2 (Eclipse 4.3.x) from http://www.eclipse.org/downloads/packages/eclipse-standard-432/keplersr2.
  3. Download the com.ge.research.sadl.update-3.x.x.xxxxxxxxx.zip file and expand to a local directory.
  4. Then do an Eclipse update or install of new software from this newly created update location.
  5. Note: if you get an error containing "requires 'bundle org.junit 4.12.0' but it could not be found" do the following:

Note that SADL source code is now hosted on http://github.com/crapo/sadlos2.

Known 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, between elements of a rule 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. External Models (Models External to a Project)

    SADL 3 supports the inclusion of imported models that are not in the current project in two ways.

    1. The current project can make reference to another SADL project, making the models of the other project assessable for use in this project as if they were defined in this project.

      To make a SADL project reference another project:

      1. open the Project Properties dialog
      2. select Project References in the left side of the dialog
      3. check the project(s) this project should reference.
         
      4. A project can include external OWL files, making them available for import into SADL models.

        To make an external OWL file available for import in a SADL project:

        1. select the project in the Project Explorer
        2. select New -> Other
        3. expand (if necessary) SADL Model URL List Wizards
        4. select SADL Model URL List file
        5. click on Next
        6. select a project subfolder if desired, change the filename if desired (do not change the ".url" file extension).

        This will create a ".url" file if it doesn't exist and open it in the External URL editor. If it does already exist it can be opened directly from the Project Explorer. Once the ".url" file is open:

        1. add the desired URL(s) (the actual URL from which the OWL file can be downloaded; this can be a "file:/..." URL for OWL files on the local file system or "http://...")
        2. change the editor view from the tab (below the editor) with the name of the ".url" file to the tab Download.
        3. click on Download to download and index the external OWL files, dealing with any errors
          • the OWL files must be valid and parsable
          • Eclipse must be configured so that any "http://..." URL's can be retrieved programmatically through any existing firewalls.
             
        4. 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