Live data from Hacker News

SPARQL Protocol for RDF

w3.org

41–50 of 53 posts

Re: SPARQL Protocol for RDF

#41
post #38
post #35

Earlier quoted context omitted.

> And if you add the "standardized fields" thing it also matches the REST interface+RDBMS+SQL comparison the OP made. The standardization in REST is basically "read stuff" and "write stuff". For everything else you're supposed to look up the API docs and write a specialised client. I can query a SPARQL endpoint for a list of people and their friends, sorted by age - without knowing anything about that endpoint . I ca…

"Standardized fields" here meant columns in a relational database, things you can index and look up quickly. "Birth date" would be such a field that you'd hope would be standardized, for example. > I can query a SPARQL endpoint for a list of people and their friends, sorted by age - without knowing anything about that endpoint. No you can't. I am certain that you can't. To do this, you would need: - A social networki…

> "Standardized fields" here meant columns in a relational database, things you can index and look up quickly. "Age" would be such a field that you'd hope would be standardized, for example.

Then please point me to that standard. In RDF, that woukd be FOAF for example.

> A social networking service that uses SPARQL

- People to actually use that service

Yes, for querying an endpoint, I need an endpoint. No way.

My point is that even if I have such an endpoint as a REST API, I can't directly go on to query it because I'll first have to write a specific client tailored to its API and data model first, then think about how I convert it into my own. If I want to match up accounts from Facebook, Twitter and Mom-and-Pop-BBS, I'll have to deal with three different APIs and three different data models. If those sites provided SPARQL endpoints, I'd only have one of them.

> Knowing the schema that would represent things like "friend" and "age"

Defined by FOAF, see above.

> A model of permissions that indicates that somehow you're allowed to know the age of people's friends (seriously, how are you allowed to know this)

That's the responsibility of the endpoint, not mine. I don't see why that would be a hard problem (I figure you'd define permissions on different RDF properties and types) but I admit I don't know much about it.

>A way to express that permission in your SPARQL query

I send my (authenticated) query and if I don't have sufficient permissions, the server will hopefully return "nope". Why would I need to send more?

Yes, some sort of authentication is obviously needed, but there are enough standards to use for that (any sort if HTTP auth method, OAuth, OpenID etc)

Note my point wasn't that I can query endpoint X out of the blue and expect to get all the data - but that I don't have to write specific code to deal with endpoint X. Obviously I have to get permission somehow, but ideally, the only endpoint-specific thing I have to do is to fill out a registration form.

Depending on the use-case, you might not even need auth at all if your endpoint is restricted. We also have authless, restricted REST endpoints today that seem to work well: They're called web pages.

Re: SPARQL Protocol for RDF

#42
One of the benefit of SPARQL is that you can extract a subset of a given dataset as RDF. And can inject it into another RDF graph.

Eventually, you can build-up your dataset by picking subsets of other datasets, and link your own data graph with all that.

(The top of the top is to use SPARQL federated query, so you can do all that a query-time).

If you consider SPARQL as a way to implement REST API, it is the most flexible API a data producer can provide: you can run whatever query on my dataset, I force nothing.

What I see as a failure in the SPARQL ecosystem, it is the lack of SPARQL query repositories for all public datasets.

I tried to develop a tool for that (cf datao.net) but it never took off.

Re: SPARQL Protocol for RDF

#43
post #13

Earlier quoted context omitted.

The linked article is describing a world where you encode SPARQL in HTTP query parameters and get back RDF+XML. It really is attempting to be an API for querying everything, but querying nothing well. You can write reasonable REST APIs for RDF. You can even formalize it with JSON-LD if you care to.

You can write reasonable REST APIs for RDF. You can even formalize it with JSON-LD if you care to. True. It's unfortunate that many people have such a strong mental association with RDF and RDF+XML. The Semantic Web community largely moved on from emphasizing use of RDF+XML something like 10+ years ago, in favor of N3 or Turtle, and - more recently - JSON-LD. But people still hear "Semantic Web" and think "oh, that's…

When I hear "Semantic Web", I think:

That's the heavy weight XML bloated thing that has, something like 10+ years ago, moved towards N3 or Turtle, more recently to JSON-LD, and will, in due time, hopefully arrive at Prolog syntax as a very natural and convenient representation that is at the same time amenable for direct processing in a programming language that is eminently well suited for the domain of knowledge representation.

Which, I admit, may raise the question why Prolog syntax was not chosen all along, given that its syntax was invented and even standardized decades ago. By the way: A few members of the consortium were well aware that Prolog syntax would have been an excellent choice for RDF. Only a few though.

Re: SPARQL Protocol for RDF

#44
post #21

Earlier quoted context omitted.

comparing SPARQL queries against Jena TDB to SQL queries on MySQL or Postgres is like comparing apples and kangaroos. In the sense that apples rot and Kangraroos are amazing animals which can do just about anything? Because otherwise the comparison seems completely apt. Jena works for RDF data. But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for q…

> But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for querying it. SPARQL is an excellent choice for querying RDF data (SQL is usable but awkward for querying EAV structured data). > Note that the reply someone is about to write ("But RDF is a generalized self descriptive data model") means it is intended to solve the exact problem that a RDBMS+SQ…

> RDF/EAV is more graph than relational structured. It doesn't solve the exact same problem.

Yeah 100% this. Comparing a graph data model and a relational data model while obviously possible isn't really all that fruitful so long as each is being use to solve the problem that they're the best fit for.

Re: SPARQL Protocol for RDF

#45
post #21

Earlier quoted context omitted.

comparing SPARQL queries against Jena TDB to SQL queries on MySQL or Postgres is like comparing apples and kangaroos. In the sense that apples rot and Kangraroos are amazing animals which can do just about anything? Because otherwise the comparison seems completely apt. Jena works for RDF data. But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for q…

> But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for querying it. SPARQL is an excellent choice for querying RDF data (SQL is usable but awkward for querying EAV structured data). > Note that the reply someone is about to write ("But RDF is a generalized self descriptive data model") means it is intended to solve the exact problem that a RDBMS+SQ…

SPARQL is an excellent choice for querying RDF data

It's really not!

There's a reason why Tinkerpop is what most graph databases standardize on, and why things like Neo4J, DGraph, Caley, TitanDB etc (ie, all the graph DBs which people use when they want to build something and not "do the semantic web") don't use SPARQL.

Re: SPARQL Protocol for RDF

#46
post #35
post #21

Earlier quoted context omitted.

comparing SPARQL queries against Jena TDB to SQL queries on MySQL or Postgres is like comparing apples and kangaroos. In the sense that apples rot and Kangraroos are amazing animals which can do just about anything? Because otherwise the comparison seems completely apt. Jena works for RDF data. But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for q…

> And if you add the "standardized fields" thing it also matches the REST interface+RDBMS+SQL comparison the OP made. The standardization in REST is basically "read stuff" and "write stuff". For everything else you're supposed to look up the API docs and write a specialised client. I can query a SPARQL endpoint for a list of people and their friends, sorted by age - without knowing anything about that endpoint . I ca…

I've actually built this exact thing (it was for a question-answering over linked data thing).

It worked, sort of. But only after I mapped the many different representations of "age" used by the different end points.

I don't remember the specifics, but even in DBPedia alone you have to deal with the properties and the ontology namespace. Then YAGO uses that but brings in other sources and puts them in their own fields. Freebase does (did) its own things.. etc etc.

It was a long, long way from the "you don't need to know anything" utopia you describe.

In summary, there really is no advantage over mapping from a REST endpoint.

Plus, the database endpoints are slow (and even worst - have high variance in performance). I ended up downloading the dumps and hosting them all myself because the servers were so slow and unreliable.

Re: SPARQL Protocol for RDF

#47

Earlier quoted context omitted.

> But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for querying it. SPARQL is an excellent choice for querying RDF data (SQL is usable but awkward for querying EAV structured data). > Note that the reply someone is about to write ("But RDF is a generalized self descriptive data model") means it is intended to solve the exact problem that a RDBMS+SQ…

> RDF/EAV is more graph than relational structured. It doesn't solve the exact same problem. Yeah 100% this. Comparing a graph data model and a relational data model while obviously possible isn't really all that fruitful so long as each is being use to solve the problem that they're the best fit for.

Two points:

Firstly: RDF is an inadequate expression of most graphs, and SPARQL is a bad way to query graphs. See my comment here on this: https://news.ycombinator.com/item?id=14603090

Secondly: graphs storage is something which is very tempting in theory but very hard to get right in practice. I'm not going to say it is never appropriate (that is clearly untrue), but for most production applications it isn't the right choice.

I'd note for example that most social applications use a RDMS to store a single layer of friends (and then perhaps have a second graph DB for batch/stream processing of graph functions).

Re: SPARQL Protocol for RDF

#48
post #45

Earlier quoted context omitted.

> But the OP is correct in their broader point that RDF is rarely a good choice and SPARQL is a pretty horrible solution for querying it. SPARQL is an excellent choice for querying RDF data (SQL is usable but awkward for querying EAV structured data). > Note that the reply someone is about to write ("But RDF is a generalized self descriptive data model") means it is intended to solve the exact problem that a RDBMS+SQ…

SPARQL is an excellent choice for querying RDF data It's really not! There's a reason why Tinkerpop is what most graph databases standardize on, and why things like Neo4J, DGraph, Caley, TitanDB etc (ie, all the graph DBs which people use when they want to build something and not "do the semantic web") don't use SPARQL.

> There's a reason why Tinkerpop is what most graph databases standardize on

Tinkerpop is a Java API, not an independent query language, and RDF data (while it is a way of modeling a graph) is not the model of most graph databases (it's a lower-level model than most graph databases expose, and is about as far from them as it is from the table model of SQL databases.)

An optimal Java API for graph databases with a more typical model is not an optimal query language for RDF data, for pretty much the same reason SQL isn't.

Now, what you describe is probably a sign may that RDF isn't the right exposed data model for many use cases (EAV-style representations are often used for deep internals, but there's probably a reason that outside of RDF most systems which use the model internally expose something more similar to the conventional relational or graph model to application developers), not that SPARQL isn't the right language for querying RDF data.

Re: SPARQL Protocol for RDF

#49
post #43

Earlier quoted context omitted.

You can write reasonable REST APIs for RDF. You can even formalize it with JSON-LD if you care to. True. It's unfortunate that many people have such a strong mental association with RDF and RDF+XML. The Semantic Web community largely moved on from emphasizing use of RDF+XML something like 10+ years ago, in favor of N3 or Turtle, and - more recently - JSON-LD. But people still hear "Semantic Web" and think "oh, that's…

When I hear "Semantic Web", I think: That's the heavy weight XML bloated thing that has, something like 10+ years ago, moved towards N3 or Turtle, more recently to JSON-LD, and will, in due time, hopefully arrive at Prolog syntax as a very natural and convenient representation that is at the same time amenable for direct processing in a programming language that is eminently well suited for the domain of knowledge re…

Which, I admit, may raise the question why Prolog syntax was not chosen all along, given that its syntax was invented and even standardized decades ago. By the way: A few members of the consortium were well aware that Prolog syntax would have been an excellent choice for RDF. Only a few though.

Good point.

Re: SPARQL Protocol for RDF

#50
post #45

Earlier quoted context omitted.

SPARQL is an excellent choice for querying RDF data It's really not! There's a reason why Tinkerpop is what most graph databases standardize on, and why things like Neo4J, DGraph, Caley, TitanDB etc (ie, all the graph DBs which people use when they want to build something and not "do the semantic web") don't use SPARQL.

> There's a reason why Tinkerpop is what most graph databases standardize on Tinkerpop is a Java API, not an independent query language, and RDF data (while it is a way of modeling a graph) is not the model of most graph databases (it's a lower-level model than most graph databases expose, and is about as far from them as it is from the table model of SQL databases.) An optimal Java API for graph databases with a mor…

Yes, Tinkerpop is a Java API which is unfortunate. But the Tinkerpop set of technologies isn't Java specific. There are Python and Javascript version of Gremlin (the rough equivalent of SPARQL).

Gremlin is very widely supported across graph databases.

what you describe is probably a sign may that RDF isn't the right exposed data model for many use cases

Well. that's exactly what my claim is, so that's good!

not that SPARQL isn't the right language for querying RDF data.

Have you ever tried one of the alternatives? Try GraphQL on DGraph (Or Gizmo/Gremlin on Cayley) against a Freebase or DBPedia import. That's exactly the equivalent of SPARQL against RDF, and it's so much better.

Post reply on HN