Commit 8f5638ff authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

la til kommentarer

parent a79f5c3a
......@@ -27,6 +27,7 @@ public class Main {
public Main() throws IOException {
model = ModelFactory.createDefaultModel();
// read csv files into lists of string arrays
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("employees.csv");
try (InputStreamReader reader = new InputStreamReader(is, "UTF-8")) {
CSVReader csvReader = new CSVReader(reader, ',');
......@@ -47,6 +48,7 @@ public class Main {
}
private Main doStuff() {
// set prefixes to get nice turtle output
model.setNsPrefix("foaf", FoafVocab.FOAF_NAMESPACE);
model.setNsPrefix("org", OrgVocab.ORG_NAMESPACE);
model.setNsPrefix("skos", skosNS);
......@@ -83,6 +85,8 @@ public class Main {
}
private Map<String, Resource> makeUnits() {
// generate rdf resources representing avdeling/seksjon and map them to their IDs
Map<String, Resource> unitMap = new HashMap<>();
for (String[] record : units) {
......@@ -93,8 +97,10 @@ public class Main {
Resource unit;
if (superUnit.isEmpty()) {
// NSD is the top level unit in this graph and is a legal entity
unit = model.createResource(name, OrgVocab.FormalOrganization);
} else {
// others are organisational units
unit = model.createResource(name, OrgVocab.OrganizationalUnit);
unit.addProperty(OrgVocab.unitOf, unitMap.get(superUnit));
}
......@@ -106,6 +112,8 @@ public class Main {
}
private Map<String, Resource> makeRoles() {
// generate rdf resources representing roles and map them to their IDs
Map<String, Resource> roleMap = new HashMap<>();
for (String[] record : roles) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment