Skip to content

Example of how to select based on blank nodes #5

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

Open
adynata opened this issue Mar 28, 2016 · 1 comment
Open

Example of how to select based on blank nodes #5

adynata opened this issue Mar 28, 2016 · 1 comment

Comments

@adynata
Copy link

adynata commented Mar 28, 2016

I'm trying to retrieve attributes of an item that I need to reach by way of a blank node:

var resource = store.statementsMatching($rdf.sym(key), VRA("placeOfPublication") , undefined); for (var i=0; i < resource.length; i++) { res = resource[i]; var locName = store.statementsMatching($rdf.sym(res.object.value), undefined, undefined); }

This would be used to traverse data that looks like this in xml/rdf:

<vra:placeOfPublication> <rdf:Description> <rdf:type rdf:resource="http://purl.org/vra/Place"/> <vra:containedIn> <rdf:Description rdf:about="http://vocab.getty.edu/tgn/7014406"> <rdf:type rdf:resource="http://purl.org/vra/Place"/> <vra:name>Philadelphia</vra:name> </rdf:Description> </vra:containedIn> <vra:name>published: Philadelphia, Pa.</vra:name> <vra:description/> </rdf:Description> </vra:placeOfPublication>

The first pass through returns blank nodes. For other similar queries (that don't return blank nodes) I am using the result of the first call to drill down to the information I need. For this particular section in my data, that won't work. I'm wondering if there's a more depth-first approach to this sort of query, and also how to get data associated with these specific blank nodes using wildcards.

Example of BlankNode:

BlankNode {id: 19, value: "19"}

@ludwigschub
Copy link

To get email-addresses from a Solid Pod i also first retrieved the blank nodes that were objects, and then used them as subjects in the next query (using two consecutive forEach calls):

fetcher.load(profile).then(response => {
    store.each(me, VCARD("hasEmail")).forEach((emailBlankId) => {
      store.each($rdf.sym(emailBlankId), VCARD("value")).forEach((emailAddress) => {
        emailAddress = emailAddress.value;
      })
    });
};

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

2 participants