Skip to content

Commit

Permalink
Fix metadata load format
Browse files Browse the repository at this point in the history
  • Loading branch information
cybermaggedon committed Nov 28, 2024
1 parent b2f7b34 commit d7b14c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
15 changes: 12 additions & 3 deletions trustgraph-cli/scripts/tg-load-pdf
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,18 @@ class Loader:
id=id,
metadata=[
Triple(
s=Value(value=t["s"]["v"], is_uri=t["s"]["e"]),
p=Value(value=t["p"]["v"], is_uri=t["p"]["e"]),
o=Value(value=t["o"]["v"], is_uri=t["o"]["e"])
s=Value(
value=t["s"],
is_uri=isinstance(t["s"], Uri)
),
p=Value(
value=t["p"],
is_uri=isinstance(t["p"], Uri)
),
o=Value(
value=t["o"],
is_uri=isinstance(t["o"], Uri)
),
)
for t in triples
],
Expand Down
17 changes: 13 additions & 4 deletions trustgraph-cli/scripts/tg-load-text
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import uuid
from trustgraph.schema import TextDocument, text_ingest_queue
from trustgraph.schema import Metadata, Triple, Value
from trustgraph.log_level import LogLevel
from trustgraph.knowledge import hash, to_uri
from trustgraph.knowledge import hash, to_uri, Literal, Uri
from trustgraph.knowledge import PREF_PUBEV, PREF_DOC, PREF_ORG
from trustgraph.knowledge import Organization, PublicationEvent
from trustgraph.knowledge import DigitalDocument
Expand Down Expand Up @@ -80,9 +80,18 @@ class Loader:
id=id,
metadata=[
Triple(
s=Value(value=t["s"]["v"], is_uri=t["s"]["e"]),
p=Value(value=t["p"]["v"], is_uri=t["p"]["e"]),
o=Value(value=t["o"]["v"], is_uri=t["o"]["e"])
s=Value(
value=t["s"],
is_uri=isinstance(t["s"], Uri)
),
p=Value(
value=t["p"],
is_uri=isinstance(t["p"], Uri)
),
o=Value(
value=t["o"],
is_uri=isinstance(t["o"], Uri)
),
)
for t in triples
],
Expand Down

0 comments on commit d7b14c5

Please sign in to comment.