Skip to content

search example from README doesn't work#9

Merged
elf-pavlik merged 1 commit intolevelgraph:masterfrom
elf-pavlik:bugfix/search-example
Dec 9, 2013
Merged

search example from README doesn't work#9
elf-pavlik merged 1 commit intolevelgraph:masterfrom
elf-pavlik:bugfix/search-example

Conversation

@elf-pavlik
Copy link
Copy Markdown
Member

When I try to run it I get empty array in solutions... we need to make sure that we put in README only exact examples from test suite!
While not that familiar with LevelGraph joins I also don't find it obvious what exactly we search for here, adding one sentence about intended results will make it clearer for everyone.

var nested = {
    "@context": {
        "name": "http://xmlns.com/foaf/0.1/name"
      , "knows": "http://xmlns.com/foaf/0.1/knows"
    }
  , "@id": "http://matteocollina.com"
  , "name": "matteo"
  , "knows": [{
        "name": "daniele"
    }, {
        "name": "lucio"
    }]
};

db.jsonld.put(nested, function(err) {
  db.join([{
      subject: db.v("person")
    , predicate: "http://xmlns.com/foaf/0.1/knows"
    , object: db.v("friend")
  }, {
      subject: db.v("friend")
    , predicate: "http://xmlns.com/foaf/0.1/knows"
    , object: "daniele"
  }], function(err, solutions) {
    // The solutions will be:
    // 1. { person: "http://matteocollina.com", friend: "_:abcde" }
    // 1. { person: "http://matteocollina.com", friend: "_:efghi" }
  });
});

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 8, 2013

I've just checked. Something weird is going on, but I'm not sure what.

It is supposed to return all friend of 'person' named 'Daniele'.

@elf-pavlik
Copy link
Copy Markdown
Member Author

oh... in second part of join in predicate s/knows/name/ and still you get only one result since only you know her :)

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 8, 2013

Oooh, right! GOSH. Thanks a million!!

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 8, 2013

Daniele is a friend of mine (@dbottillo). I just hope he is not upset I used his name all over the place :P.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 8, 2013

Fix it, then!

@elf-pavlik
Copy link
Copy Markdown
Member Author

i made an example search based on what i regularly look for, nowadays still using faceboogle...

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 9, 2013

Can I merge?

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Dec 9, 2013

Or better, merge if you think it's fine. 👍 for me.

elf-pavlik pushed a commit that referenced this pull request Dec 9, 2013
search example from README doesn't work
@elf-pavlik elf-pavlik merged commit ba7b27b into levelgraph:master Dec 9, 2013
@elf-pavlik elf-pavlik deleted the bugfix/search-example branch December 9, 2013 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants