neontribe / Linked_Development

Linked Development
1 stars 1 forks source link

RDF end points for items/assets etc #39

Closed tobybatch closed 11 years ago

tobybatch commented 11 years ago

Does virtuoso expose an RDF endpoint for atomic items held in the store?

If you look at this example (line 58):

https://github.com/njh/easyrdf/blob/0.7.2/examples/artistinfo.php#L58

This URI appears to contain all data about a given musician (born in the USA). Can we expose this for individual items?

practicalparticipation commented 11 years ago

This is linked to #36. Virtuoso does have some means to provide this, but we may want to do it via other scripts resolving the URIs for us.

tobybatch commented 11 years ago

I'll keep this open and leave get item/asset for now as it seems a partial duplicate.

practicalparticipation commented 11 years ago

Also:

In terms of getting all that is known about a given item, we can use DESCRIBE queries against the SPARQL endpoint.

By default I believe virtuoso finds all incoming and ongoing links for a URI given in a describe query.

tobybatch commented 11 years ago

I'm looking to fulfil the get/item/FOOO/[short|full] route and currently I'm using:

select distinct ?a ?b where { <http://linked-development.org/eldis/output/__ID__/> ?a ?b . }

Which gives a number of rows but the parsing of it is rather clumsy, I'd prefer to hit the RDF item directly and let easyRdf do the leg work. If the sparql is easy then can you update the src/LD/APIBundle/Resources/config/services.yml file?

practicalparticipation commented 11 years ago

Just working on queries for this now.

Unfortunately we might not be able to get all we need with a straight DESCRIBE or <> ?a ?b. query pattern, as some of the contents is a few more links away.

On Fri, May 17, 2013 at 11:18 AM, tobybatch notifications@github.comwrote:

I'm looking to fulfil the get/item/FOOO/[short|full] route and currently I'm using:

select distinct ?a ?b where { http://linked-development.org/eldis/output/__ID__/ ?a ?b . }

Which gives a number of rows but the parsing of it is rather clumsy, I'd prefer to hit the RDF item directly and let easyRdf do the leg work. If the sparql is easy then can you update the src/LD/APIBundle/Resources/config/services.yml file?

— Reply to this email directly or view it on GitHubhttps://github.com/neontribe/Linked_Development/issues/39#issuecomment-18053840 .

http://www.timdavies.org.uk 07834 856 303. @timdavies

Co-director of Practical Participation:

http://www.practicalparticipation.co.uk

Practical Participation Ltd is a registered company in England and Wales -

5381958.

practicalparticipation commented 11 years ago

For getting a document it looks like using a CONSTRUCT query is going to give the nicest formed graphs - as it avoids having to parse duplicated rows and lets you navigate using property names in easyRDF.

The query below is an example building a graph for a given document. The document is specified using the filter at the bottom of the WHERE clause. The construct, and select components should be re-usable across /search/ and /get/ queries (i.e. get is really search, but with a single document ID specified).

I've placed this in sparqls.txt - but because of the construct rather than select form I couldn't put it into the YAML file.

I've got some more work to do on this to cater for slight differences between files and to add more optional clauses for when certain documents don't have full details in the store - but it should work as a start...

 PREFIX dcterms: <http://purl.org/dc/terms/>
   PREFIX bibo:    <http://purl.org/ontology/bibo/>
   PREFIX foaf:    <http://xmlns.com/foaf/0.1/>

   CONSTRUCT {
       ?resource a bibo:Article.
       ?resource dcterms:title ?title.
       ?resource dcterms:abstract ?abstract.
       ?resource dcterms:creator ?creator.
       ?resource dcterms:subject ?subject.
       ?subject rdfs:label ?subjectTitle.
       ?resource dcterms:coverage ?coverage.
       ?coverage rdfs:label ?coverageTitle.
       ?resource dcterms:language ?language.
       ?resource dcterms:identifier ?identifier.
       ?resource rdfs:seeAlso ?document.
       ?resource dcterms:date ?date. 
       ?resource dcterms:publisher ?publisher.
       ?publisher foaf:name ?publisherName.
   }
       WHERE {
       ?resource a bibo:Article.
       ?resource dcterms:title ?title.
       ?resource dcterms:abstract ?abstract.
       ?resource dcterms:creator ?creator.
       OPTIONAL { ?resource dcterms:subject ?subject. }
       ?subject rdfs:label ?subjectTitle.
       ?resource dcterms:coverage ?coverage.
       ?coverage rdfs:label ?coverageTitle.
       ?resource dcterms:language ?language.
       ?resource dcterms:identifier ?identifier.
       ?resource rdfs:seeAlso ?document.
       ?resource dcterms:date ?date. 
       OPTIONAL { ?resource dcterms:publisher ?publisher. 
                  OPTIONAL { ?publisher foaf:name ?publisherName. }
        }

       FILTER(?resource = <http://linked-development.org/eldis/output/A64898/>)
   }
tobybatch commented 11 years ago

Really top work, and very useful. Thanks Tim.