-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
54 lines (46 loc) · 1.39 KB
/
web.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Generate skills within a development context. All skills and occupations under the 'ICT development' node
of the ESCO skill classification tree are used.
"""
from mycompany import Mycompany
from employee import Employee
from occupation import Occupation
from skill import Skill
import random
company = Mycompany()
@app.route('/generate-company/')
def job_pool():
""" Generate a company with 20 employees and persist the company. """
for _ in range(0, 20):
company.add_employee(generate_employee())
company.persist()
return company.get_company_state().replace("\n", "<br>")
@app.route('/hire-person/')
def hirePerson():
emp = Employee()
for _ in range(0, random.randint(10, 20)):
Skill(emp)
Occupation(emp)
emp.add_company(company)
emp.persist()
return emp.get_name() + " Is hired!"
@app.route('/add-labels/')
def label_concepts():
q = """
PREFIX skosxl: <http://www.w3.org/2008/05/skos-xl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
INSERT {
GRAPH <http://mu.semte.ch/application> {
?s skos:prefLabel ?text.
}
} WHERE {
?s skosxl:prefLabel / skosxl:literalForm ?text.
FILTER (lang(?text) = "en")
}"""
helpers.update(q)
def generate_employee():
emp = Employee()
for _ in range(0, random.randint(10, 20)):
Skill(emp)
Occupation(emp)
return emp