Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metadata load format #181

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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