Exemplo n.º 1
0
        print(f"Name: {field.name}, Rule: {field.rule}")
    print("")

    # Possible rules are:
    # - min n
    # - max n
    # - exactly n
    # - some (equals min 1)
    # - all

    # A field can have multiple rules that all need to be fulfilled for the
    # field to be treated as valid. An instance is valid if all its fields
    # are valid

    print("\u0332".join("my_building is currently valid:"))
    print(my_building.are_rule_fields_valid())
    print("")

    # To make the instance valid we need to add values to our rule fields. We
    # look herefore at the subtypes of RuleFields.

    # ### 3.1.1 DataFields:
    #
    # Each ComplexDataProperty in our vocabulary with the
    # type "simple" was converted to this field type. (All for normal classes)
    # As values it takes basic types as string, int, bool,..

    my_building.goalTemperature.add(23)
    my_building.name.add("Main Building")

    # we can check again if all DataFields are now valid: