Skip to content

Commit

Permalink
update to prediction integration script (image_material only for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschleider committed Jun 18, 2021
1 parent 7cde263 commit 90da526
Show file tree
Hide file tree
Showing 8 changed files with 81,309 additions and 81,402 deletions.
20 changes: 13 additions & 7 deletions predictions/image/prov_o_material.py
Expand Up @@ -2,14 +2,15 @@
from rdflib import Graph
import pandas as pd
import glob
import uuid

counter_pred = 0
counter_act = 0
for file_name in glob.glob('sys_integration_pred_material.csv'):
x = pd.read_csv(file_name)
for index, row in x.iterrows():
score = row[' class_score'].strip()
predicted = row[' predicted_class'].strip()
predicted = "http://data.silknow.org/vocabulary/facet/"+row[' predicted_class'].strip()
obj = row['obj_uri'].strip()
img = row[' image_name'].strip()
counter_pred = counter_pred + 1
Expand All @@ -25,7 +26,7 @@

a = """
prefix silk: <http://data.silknow.org/ontology/>
prefix silk: <http://data.silknow.org/ontology/property>
prefix crmsci: <http://www.ics.forth.gr/isl/CRMsci/>
prefix crmdig: <http://www.ics.forth.gr/isl/CRMext/CRMdig.rdfs/>
prefix prov: <http://www.w3.org/ns/prov#>
Expand All @@ -43,9 +44,14 @@
c = """
?statement rdf:predicate ecrm:P126_employed .
?production ecrm:P126_employed """
d = "<"+str(predicted)+"> ."

e = """
?statement silk:L18
"""
f = '"'+str(score) +'" .'
f = '"'+str(float(score.strip('%'))/100) +'"'+"^^xsd:float ."
g = """
?activity a prov:Activity ;
prov:AtTime "2021-02-10"^^xsd:dateTime;
Expand All @@ -67,17 +73,17 @@
?production ecrm:P108_has_produced ?object .
?object rdfs:comment ?text .
BIND(URI(REPLACE(CONCAT(STR(?object), "/image/material/"""
n = str(counter_pred)
BIND(URI(REPLACE(CONCAT("http://data.silknow.org", "/image/material/"""
n = str(uuid.uuid5(uuid.NAMESPACE_DNS, str(str(obj)+str(img)+str(predicted))))
o = """"), "object", "prediction", "i")) AS ?statement)
BIND(URI(REPLACE(CONCAT(STR(?object), "/actor/luh-image-analysis/"""
BIND(URI(REPLACE(CONCAT("http://data.silknow.org", "/actor/luh-image-analysis/"""
p = str(counter_act)
r = """"), "object", "prediction", "i")) AS ?actor)
BIND(URI(CONCAT(STR(?statement), "/generation")) AS ?activity)
} """


q = a + b + c + f + g + x + y + j + k + l + m + n + o + p + r
q = a + b + c + d + e + f + g + x + y + j + k + l + m + n + o + p + r
print(q.strip())


Expand Down
86,097 changes: 43,030 additions & 43,067 deletions predictions/image/sys_integration_pred_depiction.csv

Large diffs are not rendered by default.

9,873 changes: 5,015 additions & 4,858 deletions predictions/image/sys_integration_pred_material.csv

Large diffs are not rendered by default.

17,479 changes: 8,534 additions & 8,945 deletions predictions/image/sys_integration_pred_place.csv

Large diffs are not rendered by default.

42,011 changes: 21,056 additions & 20,955 deletions predictions/image/sys_integration_pred_technique.csv

Large diffs are not rendered by default.

7,229 changes: 3,661 additions & 3,568 deletions predictions/image/sys_integration_pred_timespan.csv

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion predictions/text/.~lock.place.csv#

This file was deleted.

1 change: 0 additions & 1 deletion predictions/text/.~lock.technique.csv#

This file was deleted.

0 comments on commit 90da526

Please sign in to comment.