logic_mapping_population.rb revision b082ee0b1778a9f417c67d89247f4c3b4a29e9ba
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale# A logic_mapping propulation procedure.
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale# TODO Transform this code in an iterator to enable unit testing
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale# Author: Daniel Couto Vale <danielvale@uni-bremen.de>
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale # A triple store with logic_mappings
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale type_iri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale label_iri = 'http://www.w3.org/2000/01/rdf-schema#label'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale comment_iri = 'http://www.w3.org/2000/01/rdf-schema#comment'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale defined_iri = 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_type_iri = 'http://purl.net/dol/1.0/rdf#LogicMapping'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale default_iri = 'http://purl.net/dol/1.0/rdf#DefaultMapping'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale maps_from_iri = 'http://purl.net/dol/1.0/rdf#mapsFrom'
b082ee0b1778a9f417c67d89247f4c3b4a29e9baChristian Clausen maps_to_iri = 'http://purl.net/dol/1.0/rdf#mapsTo'
592ea9c0e6e3018d9ef6d89e256efc0de70c71daDaniel Couto Vale status_iri = 'http://purl.net/dol/1.0/standardization#standardizationStatus'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#UnfaithfulMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#FaithfulMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#ModelExpansiveMapping',
592ea9c0e6e3018d9ef6d89e256efc0de70c71daDaniel Couto Vale 'http://purl.net/dol/1.0/rdf#ModelBijectiveMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#EmbeddingMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#PlainMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#SimpleTheoroidalMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#TheoroidalMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#GeneralizedMapping'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#InexactMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#WeaklyMonoExactMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#WeaklyExactMapping',
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale 'http://purl.net/dol/1.0/rdf#ExactMapping'
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_iris = @store.subjects(type_iri, mapping_type_iri);
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_names = @store.objects(mapping_iri, label_iri)
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_defis = @store.objects(mapping_iri, defined_iri)
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_source_ids = @store.objects(mapping_iri, maps_from_iri)
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_target_ids = @store.objects(mapping_iri, maps_to_iri)
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_types = @store.objects(mapping_iri, type_iri)
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_name = mapping_names == [] ? mapping_iri : mapping_names[0]
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_defi = mapping_defis == [] ? mapping_iri : mapping_defis[0]
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_source = mapping_source_ids == [] ? nil : @logic_map[mapping_source_ids[0]]
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale mapping_target = mapping_target_ids == [] ? nil : @logic_map[mapping_target_ids[0]]
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale default = type == default_iri ? true : default
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale faithfulness_i = index != nil ? index : faithfulness_i
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale theoroidalness_i = index != nil ? index : theoroidalness_i
56eec2b208d9de8883ab7be46027e358b99347a0Daniel Couto Vale exactness_i = index != nil ? index : exactness_i
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen :faithfulness => LogicMapping::FAITHFULNESSES[faithfulness_i],
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen :theoroidalness => LogicMapping::THEOROIDALNESSES[theoroidalness_i],