File tree Expand file tree Collapse file tree 2 files changed +2079
-1775
lines changed Expand file tree Collapse file tree 2 files changed +2079
-1775
lines changed Original file line number Diff line number Diff line change 18
18
import datetime
19
19
import importlib # py3
20
20
import sys
21
+ from rdflib import Graph
21
22
22
23
# set UTF8 as default
23
24
importlib .reload (sys ) # py3
72
73
lines .append ("samian:loc_pc_" + str (row ['id' ]) + " " + "prov:wasAttributedTo" + " samian:ImportPythonScript_Samian ." )
73
74
lines .append ("samian:loc_pc_" + str (row ['id' ]) + " " + "prov:wasDerivedFrom" + " <http://www.wikidata.org/entity/Q90412636> ." )
74
75
lines .append ("samian:loc_pc_" + str (row ['id' ]) + " " + "prov:wasGeneratedBy" + " samian:activity_loc_pc_" + str (row ['id' ]) + " ." )
75
- lines .append ("samian:activity_loc_pc_" + str (row ['id' ]) + " " + "rdf:type" + " <http://www.w3.org/ns/ prov# Activity> ." )
76
+ lines .append ("samian:activity_loc_pc_" + str (row ['id' ]) + " " + "rdf:type" + " prov: Activity ." )
76
77
lines .append ("samian:activity_loc_pc_" + str (row ['id' ]) + " " + "prov:startedAtTime '" + starttime + "'^^xsd:dateTime ." )
77
78
lines .append ("samian:activity_loc_pc_" + str (row ['id' ]) + " " + "prov:endedAtTime '" + datetime .datetime .now ().strftime ("%Y-%m-%dT%H:%M:%S.%fZ" ) + "'^^xsd:dateTime ." )
78
79
lines .append ("samian:activity_loc_pc_" + str (row ['id' ]) + " " + "prov:wasAssociatedWith" + " samian:ImportPythonScript_Samian ." )
109
110
print ("Yuhu! > " + fileprefix + strX + ".ttl" )
110
111
file .close ()
111
112
113
+ # format rdf to nice turtle
114
+ g = Graph ()
115
+ filename_tmp = dir_path .replace ("\\ py" , "\\ ttl" ) + "\\ " + "loc_productioncentre_1.ttl"
116
+ g .parse (filename_tmp )
117
+ g .serialize (destination = filename_tmp )
118
+
112
119
print ("*****************************************" )
113
120
print ("SUCCESS" )
114
121
print ("closing script" )
You can’t perform that action at this time.
0 commit comments