<commit_before>from utility import *
from rdflib import Graph
import re
from prefixes import *


class Person():
    def __init__(self, gw_id, personal_statement=None, home_department=None, research_areas=None):
        self.gw_id = gw_id
        self.personal_statement = personal_statement
        self.home_department = home_department
        self.research_areas = research_areas

        self.uri = D[to_hash_identifier(PREFIX_PERSON, (self.gw_id,))]

    def to_graph(self):
        #Create an RDFLib Graph
        g = Graph()

        #Overview
        if self.personal_statement:
            g.add((self.uri, VIVO.overview, Literal(self.personal_statement)))

        ##Research areas
        if self.research_areas:
            #Split on ; then ,
            research_area_split = re.split("; *", self.research_areas)
            if len(research_area_split) == 1:
                research_area_split = re.split(", *", self.research_areas)
            for research_area in research_area_split:
                research_area_uri = D[to_hash_identifier(PREFIX_RESEARCH_AREA, [research_area, ])]
                g.add((research_area_uri, RDF.type, SKOS.concept))
                g.add((research_area_uri, RDFS.label, Literal(research_area[0].capitalize() + research_area[1:])))
                g.add((self.uri, VIVO.hasResearchArea, research_area_uri))

        ##Home Department
        if self.home_department:
            g.add((self.uri, LOCAL.homeDept, self.home_department.uri))

        return g


class Organization():

    def __init__(self, name, organization_type="Organization", is_gw=False, part_of=None):
        self.name = name<commit_msg>Another fix to research areas.<commit_after>from utility import *
from rdflib import Graph
import re
from prefixes import *


class Person():
    def __init__(self, gw_id, personal_statement=None, home_department=None, research_areas=None):
        self.gw_id = gw_id
        self.personal_statement = personal_statement
        self.home_department = home_department
        self.research_areas = research_areas

        self.uri = D[to_hash_identifier(PREFIX_PERSON, (self.gw_id,))]

    def to_graph(self):
        #Create an RDFLib Graph
        g = Graph()

        #Overview
        if self.personal_statement:
            g.add((self.uri, VIVO.overview, Literal(self.personal_statement)))

        ##Research areas
        if self.research_areas:
            #Split on ; then ,
            research_area_split = re.split("; *", self.research_areas)
            if len(research_area_split) == 1:
                research_area_split = re.split(", *", self.research_areas)
            for research_area in research_area_split:
                if research_area:
                    research_area_uri = D[to_hash_identifier(PREFIX_RESEARCH_AREA, [research_area, ])]
                    g.add((research_area_uri, RDF.type, SKOS.concept))
                    g.add((research_area_uri, RDFS.label, Literal(research_area[0].capitalize() + research_area[1:])))
                    g.add((self.uri, VIVO.hasResearchArea, research_area_uri))

        ##Home Department
        if self.home_department:
            g.add((self.uri, LOCAL.homeDept, self.home_department.uri))

        return g


class Organization():

    def __init__(self, name, organization_type="Organization", is_gw=False, part_of=None):
        self.name = name
{'fraction_non_alphanumeric': 0.10097431355181577, 'fraction_numerical': 0.001771479185119575, 'mean_word_length': 2.6666666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2916115', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1019, 'n_words': 199}