|
@@ -528,11 +528,24 @@ end
|
|
|
|
|
|
M.generate_ll = function(s)
|
|
|
local res_gr = repo.get_rsrc(s)
|
|
|
- tdata = {}
|
|
|
+ local mconf = get_mconf(s)
|
|
|
+
|
|
|
+ local tdata = {
|
|
|
+ {
|
|
|
+ id = path.basename(s.data),
|
|
|
+ content_type = mconf.id,
|
|
|
+ },
|
|
|
+ }
|
|
|
for p, ots in pairs(res_gr:connections(s, term.LINK_OUTBOUND)) do
|
|
|
- pname = nsm.denormalize_uri(p.data)
|
|
|
+ local pname = model.uri_to_id[nsm.denormalize_uri(p.data)]
|
|
|
+ --if p == pkar.RDF_TYPE then goto skip_p end
|
|
|
+ if not pname then goto skip_p end
|
|
|
+ if pname == "content_type" then goto skip_p end
|
|
|
for _, o in pairs (ots) do
|
|
|
-- Find a row where the pname slot has not been occupied.
|
|
|
+ if (mconf.properties[pname] or {}).type == "resource" then
|
|
|
+ o = {data = o.data:gsub(nsm.get_ns("par"), "")}
|
|
|
+ end
|
|
|
for i = 1, math.huge do
|
|
|
if (tdata[i] or NT)[pname] then goto continue
|
|
|
else
|
|
@@ -543,11 +556,12 @@ M.generate_ll = function(s)
|
|
|
::continue::
|
|
|
end
|
|
|
end
|
|
|
+ ::skip_p::
|
|
|
end
|
|
|
-- FIXME ftcsv encodes nil values as `"nil"`. See
|
|
|
-- https://github.com/FourierTransformer/ftcsv/issues/46
|
|
|
|
|
|
- return csv.encode(tdata)
|
|
|
+ return csv.encode(tdata, {encodeNilAs = ""})
|
|
|
end
|
|
|
|
|
|
|