Skip to content
Snippets Groups Projects
Select Git revision
  • 85ece1d0c3e634becdf67478da1f0ef0ee449e89
  • main default protected
2 results

input_test.py

Blame
  • Forked from Ockenden, Samuel / CiS Projekt
    214 commits behind the upstream repository.
    user avatar
    Malte Schokolowski authored
    e89b7c0a
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    input_test.py 4.05 KiB
    class Publication:
        def __init__(self, doi_url, title, contributors, journal, publication_date, references, citations, group):
            self.doi_url = doi_url
            self.title = title
            self.contributors = contributors
            self.journal = journal
            self.publication_date = publication_date
            if references is None:
                self.references = []
            else:
                self.references = ref(references)
            if citations is None:
                self.citations = []
            else: 
                self.citations = cit(citations)
            self.group = group
    
    
    class Citation:
        def __init__(self,doi_url, title, contributors, journal, publication_date):
            self.doi_url = doi_url
            self.title = title
            self.contributors = contributors
            self.journal = journal
            self.publication_date = publication_date
    
    class Reference:
        def __init__(self,doi_url, title, contributors, journal, publication_date):
            self.doi_url = doi_url
            self.title = title
            self.contributors = contributors
            self.journal = journal
            self.publication_date = publication_date
    
    def input_test_func(pub_doi):
        for array in list_of_arrays:
            if pub_doi == array[0]:
                pub = Publication(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7])
                return pub
    
    
    def cit(list_doi):
        cits = []
        for doi_url in list_doi:
            for array in list_of_arrays:
                if doi_url == array[0]:
                    cits.append(Citation(array[0], array[1], array[2], array[3], array[4]))
        return cits
    
    def ref(list_doi):
        refs = []
        for doi_url in list_doi:
            for array in list_of_arrays:
                if doi_url == array[0]:
                    refs.append(Citation(array[0], array[1], array[2], array[3], array[4]))
        return refs
    
    
    beispiel1 = ['doi1', 'title1', ['contributor1'], 'journal1', 'date1', ['doi2'], ['doi3'], '']
    beispiel2 = ['doi2', 'title2', ['contributor2'], 'journal2', 'date2', [], ['doi1'], '']
    beispiel3 = ['doi3', 'title3', ['contributor3'], 'journal3', 'date3', ['doi1'], [], '']
    
    zyklus1 = ['doiz1', 'titlez1', ['contributorz1.1', 'contributorz1.2'], 'journalz1', 'datez1', ['doiz2'], ['doiz2'], '']
    zyklus2 = ['doiz2', 'titlez2', ['contributorz2.1', 'contributorz2.2'], 'journalz2', 'datez2', ['doiz1'], ['doiz1'], '']
    
    inner_edge1 = ['doi_ie1', 'title_ie1', ['contributor_ie1.1', 'contributor_ie1.2'], 'journal_ie1', 'date_ie1', ['doi_ie2'], ['doi_ie3'], '']
    inner_edge2 = ['doi_ie2', 'title_ie2', ['contributor_ie2.1', 'contributor_ie2.2'], 'journal_ie2', 'date_ie2', [], ['doi_ie1','doi_ie3'], '']
    inner_edge3 = ['doi_ie3', 'titlez_ie3', ['contributor_ie3.1', 'contributor_ie3.2'], 'journal_ie3', 'date_ie3', ['doi_ie1','doi_ie2'], [], '']
    
    right_height01 = ['doi_h01', 'title_h01', ['contributor_h01'], 'journal_h01', 'date_h01', [], [], '']
    right_height02 = ['doi_h02', 'title_h02', ['contributor_h02'], 'journal_h02', 'date_h02', [], ['doi_h1'], '']
    right_height1 = ['doi_h1', 'title_h1', ['contributor_h1'], 'journal_h1', 'date_h1', [], ['doi_h2'], '']
    right_height2 = ['doi_h2', 'title_h2', ['contributor_h2'], 'journal_h2', 'date_h2', [], ['doi_h3'], '']
    right_height3 = ['doi_h3', 'title_h3', ['contributor_h3'], 'journal_h3', 'date_h3', [], [], '']
    
    right_depth01 = ['doi_d01', 'title_d01', ['contributor_d01'], 'journal_d01', 'date_d01', [], [], '']
    right_depth02 = ['doi_d02', 'title_d02', ['contributor_d02'], 'journal_d02', 'date_d02', ['doi_d1'], [], '']
    right_depth1 = ['doi_d1', 'title_d1', ['contributor_d1'], 'journal_d1', 'date_d1', ['doi_d2'], [], '']
    right_depth2 = ['doi_d2', 'title_d2', ['contributor_d2'], 'journal_d2', 'date_d2', ['doi_d3'], [], '']
    right_depth3 = ['doi_d3', 'title_d3', ['contributor_d3'], 'journal_d3', 'date_d3', [], [], '']
    
    list_of_arrays = [beispiel1, beispiel2, beispiel3, zyklus1, zyklus2, inner_edge1, inner_edge2, inner_edge3, right_height01, right_height02, right_height1, right_height2, right_height3, right_depth01, right_depth02, right_depth1, right_depth2, right_depth3]