Trying to load a RDF graph into a Grax schema #23
-
Hi all, my goal is to load a Grax schema from an RDF Graph as described here: This is what I did so far:
But I see all I wonder what am I doing wrong. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You're actually trying to load the class instead of the resource described in your data. The challenge here is that we can't see the actual node identifier when using Turtle's blank node description syntax (
alias Foo.Vocabs.SchemaOrg
graph
|> RDF.Graph.query({:job_posting_id?, RDF.type(), SchemaOrg.JobPosting})
|> Enum.map(fn %{job_posting_id?: job_posting_id} ->
# This uses the shorter load/2 function generated on schema modules,
# which sets the schema argument implicitly
Foo.Schema.Job.load!(graph, job_posting_id)
end) |
Beta Was this translation helpful? Give feedback.
You're actually trying to load the class instead of the resource described in your data.
The challenge here is that we can't see the actual node identifier when using Turtle's blank node description syntax (
[ ]
), which means there's no direct subject node reference we can use for loading. Here's how to handle this:Preferred approach: If you control the data, use proper URIs for your job postings instead of blank nodes.
Solution for unknown blank nodes: To work with the current structure, you'll need to find the job posting nodes in your graph first: