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

When converting nq to ntriples with context, nabu assumes the context is shared #19

Open
C-Loftus opened this issue Feb 10, 2025 · 1 comment

Comments

@C-Loftus
Copy link
Member

Currently (comes from the previous upstream code) conversion is done in such a way that the context of the first quad is returned as the context for the full conversion. As noted by the TODO, this is error prone

        // loop on tr and make a set of triples
	triples := []rdf.Triple{}
	for _, quad := range quads {
		triples = append(triples, quad.Triple)
	}

	// Assume context of first triple sis context of all triples
	// TODO..   this is stupid if not dangers, at least return []string of all the contexts
	// that were in the graph.
	ctx := quads[0].Ctx
	quadContext := ctx.String()
@C-Loftus
Copy link
Member Author

this seems to actually be ok. as of right now this function is only called once at nTriples, _, err = common.QuadsToTripleWithCtx(string(rawJsonldOrNqBytes)) and the context graph name is ignored. So for the time being, this behavior is not even being used.

rather instead when nabu upserts graph data it uses the URN that is generated from the prefix as it does here:

func (synchronizer *SynchronizerClient) upsertDataForGraph(rawJsonldOrNqBytes []byte, objectName string) error {

	graphResourceIdentifier, err := common.MakeURN(objectName)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant