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

improve usability of Literals - matching, searching, indexing #18

Open
elf-pavlik opened this issue Jan 31, 2014 · 9 comments
Open

improve usability of Literals - matching, searching, indexing #18

elf-pavlik opened this issue Jan 31, 2014 · 9 comments

Comments

@elf-pavlik
Copy link
Member

Shortly for now just to capture it!

In a way we store literals currently. One needs to make extremely precise matching while using raw LevelGraph db.get(), as well as raw db.search() since currently we don't provide any kind of db.jsonld.search()

Having for example number stored as

"1.2345E1"^^<http://www.w3.org/2001/XMLSchema#double>

While we run our search query we need to match given literal very exactly, and make sure not to confuse for example #double with #float

Also searching literals with language tags seems sub-optimal, having stored:

"Big Buck Bunny"@en

Currently would not get matches if searched for

"Big Buck Bunny"

Plus most people may need to get N3Util to work with data in a convenient way... We could at least expose one included in LevelGraph-JSONLD somehow? Still on its own it won't address issues with searching and matching a Literal

@ghost ghost assigned elf-pavlik Jan 31, 2014
@mcollina
Copy link
Collaborator

mcollina commented Feb 1, 2014

For searching a substring of a triple, you can use the new filter option in
LevelGraph's get and search. I think it's the best solution to this issue.

If you want, you can put an example in README or in the examples/ folder.

@mcollina
Copy link
Collaborator

mcollina commented Feb 1, 2014

For N3Util, what functions are you using?

I think we might copy those in here and remove the dependency, or we might
want to flag them as 'levelgraph-semantic-web-utils'. Is this too crazy?

@elf-pavlik
Copy link
Member Author

Filter may not solve troubles related to searching double/float numbers which get stored in form "1.2345E1". I would like to brainstorm implementing some intuitive APIs with db.rdf.get() and db.rdf.search(). Possibly also db.n3.search() and db.jsonld.search(), where the last could return something similar to expanded JSON-LD so people don't need to use N3Util for working with search results... seeAlso levelgraph/levelgraph-n3#7
maybe also relevant: "SPARQL and JSON-LD" http://lists.w3.org/Archives/Public/public-linked-json/2014Jan/0049.html especially one of replies:"http://lists.w3.org/Archives/Public/public-linked-json/2014Jan/0057.html

@mcollina
Copy link
Collaborator

mcollina commented Feb 2, 2014

You are right, you can use filter to run a test over the triples, e.g. a x > 42, but it's useless in selecting a specific triple.
You can always specify a filter like function filter(triple) { return x.object === 12345 }, but I think it's quite inefficient.

@ahdinosaur
Copy link

+1

@elf-pavlik
Copy link
Member Author

@ahdinosaur I could give it a try in next 2 weeks, do you have any feedback which could help us meet your needs? some failing test cases by any chance?! 😄

@ahdinosaur
Copy link

@elf-pavlik sure, i can work on that.

@elf-pavlik
Copy link
Member Author

awesome! thanks @ahdinosaur 🎈

@ahdinosaur
Copy link

@elf-pavlik to describe what i have so far, if you were to add an object to the graph, you should be able to query it with the same properties that you added it with.

db.jsonld.put({
  '@context': "http://vocab.org",
  '@type': "Person",
  name: "ahdinosaur",
}, function (err) {
  db.jsonld.put({
    '@context': "http://vocab.org",
    '@type': "Person",
    name: "elf-pavlik",
  }, function (err) {
    db.jsonld.search({
      '@type': "Person",
    }, function (err, results) {
      // results should be both people
      db.jsonld.search({
        name: "ahdinosaur",
      }, function (err, results) {
        // results should be first person
      });
    });
  });
});

i achieved this by using the code from within levelgraph, although i didn't properly add the functionality to db.jsonld.search.

@elf-pavlik elf-pavlik removed their assignment Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants