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

RDF output for SELECT/ASK queries #39

Open
enridaga opened this issue Oct 14, 2015 · 5 comments
Open

RDF output for SELECT/ASK queries #39

enridaga opened this issue Oct 14, 2015 · 5 comments

Comments

@enridaga
Copy link
Contributor

The reason is to have a uniform support for all APIs, independently from the nature of the query.

@enridaga
Copy link
Contributor Author

While this is not usually supported by endpoint, it is useful to hide this property from the user and offer an RDF representation of the result set (select) or boolean (ask) responses.

@enridaga
Copy link
Contributor Author

Jena has all we need to perform this operation.
Here is the formalism:

However I am not 100% sure that this would be the more intuitive way for doing so. Another option would be to serve it as RDF using the CSV vocabulary.

@enridaga
Copy link
Contributor Author

Here is an example of the output that the Jena library produces for a ResultSet of 5 rows in RDF:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rs="http://www.w3.org/2001/sw/DataAccess/tests/result-set#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > 
  <rdf:Description rdf:nodeID="A0">
    <rs:value rdf:resource="http://bnb.data.bl.uk/id/person/BorrowGeorgeHenry1803-1881"/>
    <rs:variable>person</rs:variable>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A1">
    <rs:binding rdf:nodeID="A2"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A2">
    <rs:value rdf:resource="http://bnb.data.bl.uk/id/person/BashkirtseffMarie1860-1884"/>
    <rs:variable>person</rs:variable>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A3">
    <rs:value rdf:resource="http://bnb.data.bl.uk/id/person/BlundenEdmund1896-1974"/>
    <rs:variable>person</rs:variable>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A4">
    <rs:binding rdf:nodeID="A0"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A5">
    <rs:size rdf:datatype="http://www.w3.org/2001/XMLSchema#int">5</rs:size>
    <rs:solution rdf:nodeID="A4"/>
    <rs:solution rdf:nodeID="A6"/>
    <rs:solution rdf:nodeID="A7"/>
    <rs:solution rdf:nodeID="A8"/>
    <rs:solution rdf:nodeID="A1"/>
    <rs:resultVariable>person</rs:resultVariable>
    <rdf:type rdf:resource="http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A8">
    <rs:binding rdf:nodeID="A9"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A9">
    <rs:value rdf:resource="http://bnb.data.bl.uk/id/person/BernsteinLeonard"/>
    <rs:variable>person</rs:variable>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A10">
    <rs:value rdf:resource="http://bnb.data.bl.uk/id/person/BirdJohn1954-"/>
    <rs:variable>person</rs:variable>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A6">
    <rs:binding rdf:nodeID="A3"/>
  </rdf:Description>
  <rdf:Description rdf:nodeID="A7">
    <rs:binding rdf:nodeID="A10"/>
  </rdf:Description>
</rdf:RDF>

One part I don't like in this representation is that the order of the rows is lost.

@enridaga
Copy link
Contributor Author

Another candidate is a recent W3C candidate recommendation:

@enridaga
Copy link
Contributor Author

About how to implement it, I opened a question to SO as things are not very clear... http://stackoverflow.com/questions/33136916/streaming-a-resultset-as-rdf-using-a-custom-vocabulary

enridaga added a commit that referenced this issue Nov 6, 2015
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

1 participant