def testAbstractGraphGeneration(self): fake_general_types = 'fake_resources/GeneralTypes.yaml' file_contents = rdf_helper.ReadFile(fake_general_types) yaml_general_types = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = rdflib.namespace.NamespaceManager(graph) namespace_manager.bind('owl', rdflib.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_general_types = rdflib_generaltypes_handler.GenerateGraph( yaml_general_types, graph) # Check that the following are present # EQUIPMENT: # id: "9693662434551660544" # description: "A piece of equipment." # is_abstract: true # opt_uses: # - manufacturer_label # - model_label # VAV: # id: "6599610325710929920" # description: "Tag for terminal units with variable volume control." # is_abstract: true # implements: # - EQUIPMENT # opt_uses: # - zone_use_label equipment = rdflib.URIRef(constants.DIGITAL_BUILDINGS_NS['Equipment']) vav = rdflib.URIRef(constants.HVAC_NS['Vav']) vav_description = 'Tag for terminal units with variable volume control.' # Main Classes equipment_class = (equipment, rdflib.RDF.type, rdflib.OWL.Class) vav_class = (vav, rdflib.RDF.type, rdflib.OWL.Class) # Assertions # Class assertions self.assertIn(equipment_class, g_general_types) self.assertIn(vav_class, g_general_types) self.assertIn((vav, rdflib.RDFS.comment, rdflib.Literal(vav_description)), g_general_types) # SubClasses assertions self.assertIn((vav, rdflib.RDFS.subClassOf, equipment), g_general_types)
def testStatesGraphGeneration(self): fake_states = 'fake_resources/states.yaml' file_contents = rdf_helper.ReadFile(fake_states) yaml_states = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = namespace.NamespaceManager(graph) namespace_manager.bind('owl', rdflib.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_states = rdflib_states_handler.GenerateGraph(yaml_states, graph) # Main Types state = rdflib.URIRef(constants.STATES_NS['State']) on = rdflib.URIRef(constants.STATES_NS['On']) off = rdflib.URIRef(constants.STATES_NS['Off']) on_desc = 'Powered on.' # Main Classes state_class = (state, rdflib.RDF.type, rdflib.OWL.Class) on_class = (on, rdflib.RDF.type, rdflib.OWL.Class) off_class = (off, rdflib.RDF.type, rdflib.OWL.Class) # Assertions # Class assertions self.assertIn(state_class, g_states) self.assertIn(on_class, g_states) self.assertIn(off_class, g_states) # SubClasses assertions self.assertIn((state, rdflib.RDFS.subClassOf, rdflib.OWL.Thing), g_states) self.assertIn((on, rdflib.RDFS.subClassOf, state), g_states) self.assertIn((off, rdflib.RDFS.subClassOf, state), g_states) # Relations assertions self.assertIn((on, rdflib.RDFS.comment, rdflib.Literal(on_desc)), g_states)
def testFacilitiesGraphGeneration(self): fake_fans = 'fake_resources/FAN.yaml' file_contents = rdf_helper.ReadFile(fake_fans) yaml_fans = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = namespace.NamespaceManager(graph) namespace_manager.bind('owl', rdflib.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_fan = rdflib_carson_types_handler.GenerateGraph( yaml_fans, graph, constants.HVAC_NS) # Main Types fan_ss_refm_csp = rdflib.URIRef(constants.HVAC_NS['Fan_ss_refm_csp']) fan_s_vscf = rdflib.URIRef(constants.HVAC_NS['Fan_s_vscf']) fan_ss_ffb = rdflib.URIRef(constants.HVAC_NS['Fan_ss_ffb']) # Main Classes fan_ss_refm_csp_class = (fan_ss_refm_csp, rdflib.RDF.type, rdflib.OWL.Class) fan_s_vscf_class = (fan_s_vscf, rdflib.RDF.type, rdflib.OWL.Class) fan_ss_ffb_class = (fan_ss_ffb, rdflib.RDF.type, rdflib.OWL.Class) # Assertions # Class assertions self.assertIn(fan_ss_refm_csp_class, g_fan) # Should not be created self.assertIsNot(fan_s_vscf_class, g_fan) self.assertIsNot(fan_ss_ffb_class, g_fan)
def testAbstractGraphGeneration(self): fake_abstract = 'fake_resources/Abstract.yaml' file_contents = rdf_helper.ReadFile(fake_abstract) yaml_abstract = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Generate the graph by the function handler graph = rdflib_function_handler.GenerateGraph(yaml_abstract, graph) # Build a second graph manually in order to compare it with the one above: # DD: # description: "Dual duct flow control (hot deck, cold deck)." # is_abstract: true # opt_uses: # - discharge_air_temperature_sensor # - run_command # uses: # - heating_air_flowrate_sensor # - heating_air_flowrate_setpoint # implements: # - CONTROL expected_graph = rdflib.Graph() # Main Types functionality = rdflib.URIRef(constants.HVAC_NS['Functionality']) entity_type = rdflib.URIRef( constants.DIGITAL_BUILDINGS_NS['EntityType']) dd_description = 'Dual duct flow control (hot deck, cold deck).' # Main Classes dd_expected = infixowl.Class(identifier=constants.HVAC_NS['Dd'], graph=expected_graph, subClassOf=[functionality]) expected_graph, _ = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Dd', class_description=dd_description, parent_clazz=functionality, entity_namespace=constants.HVAC_NS) infixowl.Class(identifier=constants.SUBFIELDS_NS['Point_type'], graph=expected_graph) uses_property = infixowl.Property( identifier=constants.DIGITAL_BUILDINGS_NS['uses'], baseType=infixowl.OWL_NS.ObjectProperty, graph=expected_graph) is_composed_of_property = infixowl.Property( identifier=constants.DIGITAL_BUILDINGS_NS['isComposedOf'], baseType=infixowl.OWL_NS.ObjectProperty, graph=expected_graph) uses_property_optionally = infixowl.Property( identifier=constants.DIGITAL_BUILDINGS_NS['usesOptional'], baseType=infixowl.OWL_NS.ObjectProperty, graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Air'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Flowrate'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Heating'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Run'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Command'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Discharge'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Temperature'], graph=expected_graph) infixowl.Class(identifier=constants.SUBFIELDS_NS['Sensor'], graph=expected_graph) infixowl.Class(identifier=constants.FIELDS_NS['Field'], graph=expected_graph) heating_air_flowrate_sensor = infixowl.Class( identifier=constants.FIELDS_NS['Heating_air_flowrate_sensor'], graph=expected_graph, subClassOf=[constants.FIELDS_NS['Field']]) heating_air_flowrate_setpoint = infixowl.Class( identifier=constants.FIELDS_NS['Heating_air_flowrate_setpoint'], graph=expected_graph, subClassOf=[constants.FIELDS_NS['Field']]) concat = heating_air_flowrate_sensor & heating_air_flowrate_setpoint dd_expected.subClassOf = [uses_property | infixowl.only | concat] discharge_air_temperature_sensor = infixowl.Class( identifier=constants.FIELDS_NS['Discharge_air_temperature_sensor'], graph=expected_graph, subClassOf=[constants.FIELDS_NS['Field']]) run_command = infixowl.Class( identifier=constants.FIELDS_NS['Run_command'], graph=expected_graph, subClassOf=[constants.FIELDS_NS['Field']]) concat2 = discharge_air_temperature_sensor | run_command dd_expected.subClassOf = [ uses_property_optionally | infixowl.some | concat2 ] list_composition = rdf_helper.DecomposeStandardFieldName( 'Discharge_air_temperature_sensor') expected_graph = rdf_helper.CreatesStandardFieldNameCompositionInGraph( graph=expected_graph, list_composition=list_composition, standard_field_name='Discharge_air_temperature_sensor', is_composed_of_property=is_composed_of_property) list_composition = rdf_helper.DecomposeStandardFieldName('Run_command') expected_graph = rdf_helper.CreatesStandardFieldNameCompositionInGraph( graph=expected_graph, list_composition=list_composition, standard_field_name='Run_command', is_composed_of_property=is_composed_of_property) list_composition = rdf_helper.DecomposeStandardFieldName( 'Heating_air_flowrate_sensor') expected_graph = rdf_helper.CreatesStandardFieldNameCompositionInGraph( graph=expected_graph, list_composition=list_composition, standard_field_name='Heating_air_flowrate_sensor', is_composed_of_property=is_composed_of_property) list_composition = rdf_helper.DecomposeStandardFieldName( 'Heating_air_flowrate_setpoint') expected_graph = rdf_helper.CreatesStandardFieldNameCompositionInGraph( graph=expected_graph, list_composition=list_composition, standard_field_name='Heating_air_flowrate_setpoint', is_composed_of_property=is_composed_of_property) expected_graph, functionality_class = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Functionality', class_description=None, parent_clazz=entity_type, entity_namespace=constants.HVAC_NS) expected_graph, application = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Application', class_description=None, parent_clazz=entity_type) expected_graph, control = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Control', class_description=None, parent_clazz=application[0]) expected_graph, _ = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Dd', class_description=dd_description, parent_clazz=functionality_class[0], entity_namespace=constants.HVAC_NS) expected_graph, _ = rdf_helper.CreateClassInGraph( graph=expected_graph, class_name='Dd', class_description=dd_description, parent_clazz=control[0], entity_namespace=constants.HVAC_NS) # Check if they are similar self.assertTrue(compare.similar(graph, expected_graph))
def testSubfieldsGraphGeneration(self): fake_units = 'fake_resources/subfields.yaml' file_contents = rdf_helper.ReadFile(fake_units) yaml_subfields = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = namespace.NamespaceManager(graph) namespace_manager.bind('owl', namespace.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_subfields = rdflib_subfields_handler.GenerateGraph( yaml_subfields, graph) # Main Types subfield_type = rdflib.URIRef(constants.SUBFIELDS_NS['SubField']) point_type = rdflib.URIRef(constants.SUBFIELDS_NS['Point_type']) capacity = rdflib.URIRef(constants.SUBFIELDS_NS['Capacity']) capacity_description = ( 'A design parameter quantity. Ex: design motor ' 'power capacity. Is always a maximum limit.') point_type_class = (point_type, rdflib.RDF.type, rdflib.OWL.Class) capacity_class = (capacity, rdflib.RDF.type, rdflib.OWL.Class) measurement_descriptor = rdflib.URIRef( constants.SUBFIELDS_NS['Measurement_descriptor']) absolute = rdflib.URIRef(constants.SUBFIELDS_NS['Absolute']) absolute_description = ( 'Quality of media with respect to non-relativistic ' 'boudaries (e.g. absolute temperature).') measurement_descriptor_class = (measurement_descriptor, rdflib.RDF.type, rdflib.OWL.Class) absolute_class = (absolute, rdflib.RDF.type, rdflib.OWL.Class) measurement = rdflib.URIRef(constants.SUBFIELDS_NS['Measurement']) concentration = rdflib.URIRef(constants.SUBFIELDS_NS['Concentration']) concentration_description = ( 'Concentration of chemical (usually in parts ' 'per million or parts per billion).') measurement_class = (measurement, rdflib.RDF.type, rdflib.OWL.Class) concentration_class = (concentration, rdflib.RDF.type, rdflib.OWL.Class) descriptor = rdflib.URIRef(constants.SUBFIELDS_NS['Descriptor']) air = rdflib.URIRef(constants.SUBFIELDS_NS['Air']) air_description = 'Atmospheric air, either conditioned or unconditioned' descriptor_class = (descriptor, rdflib.RDF.type, rdflib.OWL.Class) air_class = (air, rdflib.RDF.type, rdflib.OWL.Class) component = rdflib.URIRef(constants.SUBFIELDS_NS['Component']) coil = rdflib.URIRef(constants.SUBFIELDS_NS['Coil']) coil_description = ('Component that exchanges heat between two media ' 'streams.') component_class = (component, rdflib.RDF.type, rdflib.OWL.Class) coil_class = (coil, rdflib.RDF.type, rdflib.OWL.Class) aggregation = rdflib.URIRef(constants.SUBFIELDS_NS['Aggregation']) max_ref = rdflib.URIRef(constants.SUBFIELDS_NS['Max']) min_ref = rdflib.URIRef(constants.SUBFIELDS_NS['Min']) max_description = 'Maximum value (e.g. Max_Cooling_Air_Flow_Setpoint)' aggregation_class = (aggregation, rdflib.RDF.type, rdflib.OWL.Class) max_class = (max_ref, rdflib.RDF.type, rdflib.OWL.Class) min_class = (min_ref, rdflib.RDF.type, rdflib.OWL.Class) # Assertions self.assertIn(capacity_class, g_subfields) self.assertIn(point_type_class, g_subfields) self.assertIn((capacity, rdflib.RDFS.comment, rdflib.Literal(capacity_description)), g_subfields) self.assertIn(measurement_descriptor_class, g_subfields) self.assertIn(absolute_class, g_subfields) self.assertIn((absolute, rdflib.RDFS.comment, rdflib.Literal(absolute_description)), g_subfields) self.assertIn(measurement_class, g_subfields) self.assertIn(concentration_class, g_subfields) self.assertIn((concentration, rdflib.RDFS.comment, rdflib.Literal(concentration_description)), g_subfields) self.assertIn(descriptor_class, g_subfields) self.assertIn(air_class, g_subfields) self.assertIn( (air, rdflib.RDFS.comment, rdflib.Literal(air_description)), g_subfields) self.assertIn(component_class, g_subfields) self.assertIn(coil_class, g_subfields) self.assertIn( (coil, rdflib.RDFS.comment, rdflib.Literal(coil_description)), g_subfields) self.assertIn(aggregation_class, g_subfields) self.assertIn(min_class, g_subfields) self.assertIn(max_class, g_subfields) self.assertIn( (max_ref, rdflib.RDFS.comment, rdflib.Literal(max_description)), g_subfields) # SubClasses assertions self.assertIn((point_type, rdflib.RDFS.subClassOf, subfield_type), g_subfields) self.assertIn((capacity, rdflib.RDFS.subClassOf, point_type), g_subfields) self.assertIn((aggregation, rdflib.RDFS.subClassOf, subfield_type), g_subfields) self.assertIn((min_ref, rdflib.RDFS.subClassOf, aggregation), g_subfields) self.assertIn((max_ref, rdflib.RDFS.subClassOf, aggregation), g_subfields)
def Generate(resource_path): """Generates the RDF from Yaml. Handles the overall orchestration of the process. Args: resource_path: the path where to find the yaml files. Returns: graph: the rdf graph """ # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = namespace.NamespaceManager(graph) namespace_manager.bind('owl', namespace.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) namespace_manager.bind('dcterms', 'http://purl.org/dc/terms/') graph.namespace_manager = namespace_manager # Initialize the ontology headers digital_building_ont = infixowl.Ontology(identifier=rdflib.URIRef( constants.DB), graph=graph) digital_building_ont.label = rdflib.Literal('Digital Buildings') graph.add((digital_building_ont.identifier, constants.DCTERMS['title'], rdflib.Literal('Digital Buildings Ontology'))) graph.add((digital_building_ont.identifier, constants.DCTERMS['license'], rdflib.Literal(constants.GITHUB_LICENSE))) graph.add((digital_building_ont.identifier, constants.DCTERMS['modified'], rdflib.Literal(rdf_helper.GetTimeNow()))) graph.add((digital_building_ont.identifier, rdflib.OWL['versionInfo'], rdflib.Literal(constants.ONT_VERSION))) graph.add((digital_building_ont.identifier, constants.DCTERMS['creator'], rdflib.Literal(constants.AUTHORS))) graph.add( (digital_building_ont.identifier, constants.DCTERMS['contributor'], rdflib.Literal(constants.CONTRIBUTORS))) graph.add((digital_building_ont.identifier, rdflib.OWL['seeAlso'], rdflib.Literal(constants.GITHUB))) graph.add( (digital_building_ont.identifier, constants.DCTERMS['description'], rdflib.Literal(constants.ONT_DESCRIPTION))) # Initialize the main classes graph = rdf_ont_init.GenerateGraph(graph) # Handle the Facilities file facilities_file = rdf_helper.ReadFile(resource_path + FACILITIES) yaml_facilities = yaml_handler.ImportYamlFiles(facilities_file) graph = rdflib_facilities_handler.GenerateGraph(yaml_facilities, graph) # Handle the Units file units_file = rdf_helper.ReadFile(resource_path + UNITS) yaml_units = yaml_handler.ImportYamlFiles(units_file) graph = rdflib_units_handler.GenerateGraph(yaml_units, graph) # Handle the Subfields file subfields_file = rdf_helper.ReadFile(resource_path + SUBFIELDS) yaml_subfields = yaml_handler.ImportYamlFiles(subfields_file) graph = rdflib_subfields_handler.GenerateGraph(yaml_subfields, graph) # # Handle the Abstract file abstract_file = rdf_helper.ReadFile(resource_path + ABSTRACT) yaml_abstract = yaml_handler.ImportYamlFiles(abstract_file) graph = rdflib_function_handler.GenerateGraph(yaml_abstract, graph) # # Handle the General Types file generaltypes_file = rdf_helper.ReadFile(resource_path + GENERALTYPES) yaml_generaltypes = yaml_handler.ImportYamlFiles(generaltypes_file) graph = rdflib_generaltypes_handler.GenerateGraph(yaml_generaltypes, graph) # Handle the states file states_file = rdf_helper.ReadFile(resource_path + STATES) yaml_states = yaml_handler.ImportYamlFiles(states_file) graph = rdflib_states_handler.GenerateGraph(yaml_states, graph) # Handle the HVAC files for hvac_type in carson_types: type_file = rdf_helper.ReadFile(resource_path + hvac_type) yaml_type = yaml_handler.ImportYamlFiles(type_file) graph = rdflib_carson_types_handler.GenerateGraph( yaml_type, graph, constants.HVAC_NS) return graph
def testFacilitiesGraphGeneration(self): fake_facilities = 'fake_resources/Facilities.yaml' file_contents = rdf_helper.ReadFile(fake_facilities) yaml_facilities = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the rdflib.OWL and Digital Buildings name spaces namespace_manager = rdflib.namespace.NamespaceManager(graph) namespace_manager.bind('owl', rdflib.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_facilities = rdflib_facilities_handler.GenerateGraph( yaml_facilities, graph) # Main Types entity_type = rdflib.URIRef(constants.DIGITAL_BUILDINGS_NS['EntityType']) physical_location = rdflib.URIRef( constants.FACILITIES_NS['PhysicalLocation']) building = rdflib.URIRef(constants.FACILITIES_NS['Building']) floor = rdflib.URIRef(constants.FACILITIES_NS['Floor']) room = rdflib.URIRef(constants.FACILITIES_NS['Room']) has_physical_location = rdflib.URIRef( constants.DIGITAL_BUILDINGS_NS['hasPhysicalLocation']) has_floor = rdflib.URIRef(constants.DIGITAL_BUILDINGS_NS['hasFloor']) has_room = rdflib.URIRef(constants.DIGITAL_BUILDINGS_NS['hasRoom']) # Main Classes physical_location_class = (physical_location, rdflib.RDF.type, rdflib.OWL.Class) building_class = (building, rdflib.RDF.type, rdflib.OWL.Class) floor_class = (floor, rdflib.RDF.type, rdflib.OWL.Class) room_class = (room, rdflib.RDF.type, rdflib.OWL.Class) # Assertions # Class assertions self.assertIn(physical_location_class, g_facilities) self.assertIn(building_class, g_facilities) self.assertIn(floor_class, g_facilities) self.assertIn(room_class, g_facilities) # SubClasses assertions self.assertIn((physical_location, rdflib.RDFS.subClassOf, entity_type), g_facilities) self.assertIn((building, rdflib.RDFS.subClassOf, physical_location), g_facilities) self.assertIn((floor, rdflib.RDFS.subClassOf, physical_location), g_facilities) self.assertIn((room, rdflib.RDFS.subClassOf, physical_location), g_facilities) # Relations assertions self.assertIn( (has_physical_location, rdflib.RDF.type, rdflib.OWL.ObjectProperty), g_facilities) self.assertIn((has_floor, rdflib.RDF.type, rdflib.OWL.ObjectProperty), g_facilities) self.assertIn((has_room, rdflib.RDF.type, rdflib.OWL.ObjectProperty), g_facilities)
def testUnitGraphGeneration(self): fake_units = 'fake_resources/units.yaml' file_contents = rdf_helper.ReadFile(fake_units) yaml_units = yaml_handler.ImportYamlFiles(file_contents) # Create global graph graph = rdflib.Graph() # Bind the OWL and Digital Buildings name spaces namespace_manager = rdflib.namespace.NamespaceManager(graph) namespace_manager.bind('owl', rdflib.OWL) namespace_manager.bind('db', constants.DIGITAL_BUILDINGS_NS) graph.namespace_manager = namespace_manager g_units = rdflib_units_handler.GenerateGraph(yaml_units, graph) # Main Types unit = rdflib.URIRef(constants.UNITS_NS['Unit']) temperature = rdflib.URIRef(constants.UNITS_NS['Temperature']) degrees_celsius = rdflib.URIRef(constants.UNITS_NS['degrees_celsius']) degrees_fahrenheit = rdflib.URIRef( constants.UNITS_NS['degrees_fahrenheit']) kelvins = rdflib.URIRef(constants.UNITS_NS['kelvins']) is_standard_unit = rdflib.URIRef( constants.DIGITAL_BUILDINGS_NS['is_standard_unit']) is_standard_unit_degrees_celsius = (degrees_celsius, is_standard_unit, rdflib.Literal(False)) is_standard_unit_degrees_fahrenheit = (degrees_fahrenheit, is_standard_unit, rdflib.Literal(False)) is_standard_unit_kelvin = (kelvins, is_standard_unit, rdflib.Literal(True)) # Classes Under Test unit_class = (unit, rdflib.RDF.type, rdflib.OWL.Class) temperature_class = (temperature, rdflib.RDF.type, rdflib.OWL.Class) # Data Properties Under Test is_standard_unit_object = (is_standard_unit, rdflib.RDF.type, rdflib.OWL.DatatypeProperty) # Instances Under Test degrees_celsius_object = (degrees_celsius, rdflib.RDF.type, rdflib.OWL.NamedIndividual) degrees_fahrenheit_object = (degrees_fahrenheit, rdflib.RDF.type, rdflib.OWL.NamedIndividual) kelvins_object = (kelvins, rdflib.RDF.type, rdflib.OWL.NamedIndividual) # Assertions # Class assertions self.assertIn(unit_class, g_units) self.assertIn(temperature_class, g_units) # SubClass assertions self.assertIn((unit, rdflib.RDFS.subClassOf, rdflib.OWL.Thing), g_units) self.assertIn((temperature, rdflib.RDFS.subClassOf, unit), g_units) # Instance assertions self.assertIn(degrees_celsius_object, g_units) self.assertIn(degrees_fahrenheit_object, g_units) self.assertIn(kelvins_object, g_units) self.assertIn((degrees_celsius, rdflib.RDF.type, temperature), g_units) self.assertIn((degrees_fahrenheit, rdflib.RDF.type, temperature), g_units) self.assertIn((kelvins, rdflib.RDF.type, temperature), g_units) # Data Property assertions self.assertIn(is_standard_unit_object, g_units) self.assertIn(is_standard_unit_degrees_celsius, g_units) self.assertIn(is_standard_unit_degrees_fahrenheit, g_units) self.assertIn(is_standard_unit_kelvin, g_units)