def create_same_as_file(self):
        """ creates a local data file with all of the owl:sameAs tags """

        def find_preferred_uri(uri_list):
            index = None
            for i, uri in enumerate(uri_list):
                if uri.startswith("<http://id.loc.gov/authorities/subjects/"):
                        index = i
                        print(uri)
                        break
            if not index:
                for i, uri in enumerate(uri_list):
                    if uri.startswith(\
                            "<http://id.loc.gov/authorities/childrensSubjects/"):
                        index = i
                        print(uri)
                        break
            if not index:
                index = 0
            return (uri_list.pop(index), uri_list)


        with open(os.path.join(CFG.LOCAL_DATA_PATH, self.local_filename),
                  "w") as file_obj:
            file_obj.write(NSM.prefix("turtle"))
            for item in self.uri_list:
                uris = item['uris']['value'].split(",")
                new_list = find_preferred_uri(uris)
                uris = uris[1:]
                for uir in new_list[1]:
                    file_obj.write("%s kds:mergeWith %s .\n" % (uir,
                                                                new_list[0]))
def create_same_as_file ( self ) : def find_preferred_uri ( uri_list ) : index = None for i , uri in enumerate ( uri_list ) : if uri . startswith ( "<http://id.loc.gov/authorities/subjects/" ) : index = i print ( uri ) break if not index : for i , uri in enumerate ( uri_list ) : if uri . startswith ( "<http://id.loc.gov/authorities/childrensSubjects/" ) : index = i print ( uri ) break if not index : index = 0 return ( uri_list . pop ( index ) , uri_list ) with open ( os . path . join ( CFG . LOCAL_DATA_PATH , self . local_filename ) , "w" ) as file_obj : file_obj . write ( NSM . prefix ( "turtle" ) ) for item in self . uri_list : uris = item [ 'uris' ] [ 'value' ] . split ( "," ) new_list = find_preferred_uri ( uris ) uris = uris [ 1 : ] for uir in new_list [ 1 ] : file_obj . write ( "%s kds:mergeWith %s .\n" % ( uir , new_list [ 0 ] ) )
creates a local data file with all of the owl:sameAs tags