1 / 21

How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project

How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project. Linyun Fu 2013-03-06. Linked Data API. ELDA Stands for Epimorphics Linked Data API Java open-source implementation

march
Download Presentation

How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project Linyun Fu 2013-03-06

  2. Linked Data API • ELDA Stands for Epimorphics Linked Data API • Java open-source implementation • Linked Data API Specification: http://code.google.com/p/linked-data-api/wiki/Specification • http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocabs • http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims • http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/term/0008 • http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/terms • http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/term/0008/narrower

  3. ELDA • Linked data API introduction by Epimorphics Ltd.: http://www.epimorphics.com/web/projects/linked-data-api • Downloadable from http://code.google.com/p/elda/downloads/list • java -jar elda-VERSION.jar • Quick start doc: http://elda.googlecode.com/hg/deliver-elda/src/main/webapp/lda-assets/docs/E1.2.19-index.html • Installing CMSPV Vocabulary Service: http://tw.rpi.edu/web/project/CMSPV/InstallingVocabularyService

  4. System architecture

  5. Next steps • Identifying an endpoint • Binding variables • Selecting resources • Viewing resources • Formatting graphs • All done with spec files

  6. Spec files • samplespec file: https://scm.escience.rpi.edu/svn/public/projects/cmspv/branches/elda/specs/cmspv.spec.ttl • in /{path/to}/Elda_standalone_{version}/webapps/elda/WEB-INF/web.xml: <servlet> <servlet-name>loader-init</servlet-name> <servlet-class>com.epimorphics.lda.routing.Loader</servlet-class> <init-param> <param-name>com.epimorphics.api.initialSpecFile</param-name> <param-value>cmspv::specs/cmspv.spec.ttl </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>

  7. Identifying an endpoint spec:api a api:API; ... api:sparqlEndpoint <http://localhost:3030/cmspv/query>; #api:sparqlEndpoint <local:data/example-data.ttl> api:base "http://aquarius.tw.rpi.edu:8047/elda/cmspv"; ... api:variable [api:name "base"; api:value "http://cmspv.tw.rpi.edu/rdf"], ...

  8. Binding variables spec:api a api:API; ... api:sparqlEndpoint <http://localhost:3030/cmspv/query>; #api:sparqlEndpoint <local:data/example-data.ttl> api:base "http://aquarius.tw.rpi.edu:8047/elda/cmspv"; ... api:variable [api:name "base"; api:value "http://cmspv.tw.rpi.edu/rdf"], ...

  9. Selecting resources spec:vocabulariesEndpoint a api:ListEndpoint; api:uriTemplate "/vocabs"; api:exampleRequestPath "/vocabs"; api:selector [ api:where "?item rdf:typeskos:ConceptScheme. ?item skos:prefLabel ?label."; api:orderBy "?label"; ]; . http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocabs api:base is "http://aquarius.tw.rpi.edu:8047/elda/cmspv"

  10. More examples spec:vocabularyEndpoint a api:ItemEndpoint; api:uriTemplate "/vocab/{vocabulary}"; api:itemTemplate "{base}/vocab/{vocabulary}"; api:exampleRequestPath "/vocab/nims"; . http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims shows resource: http://cmspv.tw.rpi.edu/rdf/vocab/nims {base} = http://cmspv.tw.rpi.edu/rdf; {vocabulary} = nims

  11. spec:termEndpoint a api:ItemEndpoint; api:uriTemplate "/vocab/{vocabulary}/term/{term}"; api:itemTemplate "{base}/vocab/{vocabulary}/term/{term}"; api:exampleRequestPath "/vocab/nims/term/0008"; . http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/term/0008

  12. spec:vocabularyTermsEndpoint a api:ListEndpoint; rdfs:comment "I am making an assumption that I can easily map the scheme URI based on the Linked Data URI"; api:uriTemplate "/vocab/{vocabulary}/terms"; api:exampleRequestPath "/vocab/nims/terms"; api:variable [ api:name "scheme"; api:value "{base}/vocab/{vocabulary}"; api:typerdfs:Resource; ] ; api:selector [ api:where "?item skos:inScheme?scheme. ?item skos:prefLabel ?label."; api:orderBy "?label"; ] ; . http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/terms

  13. spec:NarrowerTermsEndpoint a api:ListEndpoint; api:uriTemplate "/vocab/{vocabulary}/term/{term}/narrower"; api:exampleRequestPath "/vocab/nims/term/0008/narrower"; api:variable [ api:name "concept"; api:value "{base}/vocab/{vocabulary}/term/{term}"; api:typerdfs:Resource; ] ; api:selector [ api:where "?conceptskos:narrower ?item. ?item skos:prefLabel ?label."; api:orderBy "?label"; ] ; . http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/term/0008/narrower

  14. Viewing resources, formatting graphs spec:SKOSViewer a api:Viewer; api:name "SKOS Viewer"; api:includeapi:labelledDescribeViewer; extras:describeAllLabelskos:prefLabel; . spec:htmlFormatter a api:XsltFormatter; api:name "html"; api:mimeType "text/html; charset=utf-8"; api:stylesheet "lda-assets/xslt/cmspv.xsl"; .

  15. A broader chain viewer spec:broaderChainViewer a api:Viewer; api:name "Broader Chain Viewer"; api:includeapi:describeViewer; api:properties "prefLabel, broader.prefLabel, broader.broader.prefLabel, broader.broader.broader.prefLabel" . … spec:broaderChainEndpoint a api:ItemEndpoint; api:uriTemplate "/vocab/{vocabulary}/term/{term}/broaderChain"; api:itemTemplate "{base}/vocab/{vocabulary}/term/{term}"; api:exampleRequestPath "/vocab/nims/term/0038/broaderChain"; api:defaultViewerspec:broaderChainViewer; .

  16. Don’t forget spec:api a api:API; … api:viewer spec:broaderChainViewer, … api:endpoint spec:broaderChainEndpoint, … skos:broader a rdf:Property; api:label "broader"; . skos:prefLabel a rdf:Property; api:label "prefLabel"; .

  17. /vocab/nims/term/0032/broaderChain

  18. Using Fuseki assembler cmspv-assembler.ttl: @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . <#dataset> a ja:RDFDataset ; ja:defaultGraph [ a ja:OntModel ; ja:ontModelSpecja:OWL_MEM_MICRO_RULE_INF ; ja:content [ja:externalContent <http://www.w3.org/2009/08/skos-reference/skos.rdf>, <file:////projects/cmspv/branches/initial_rdf/skos/nims.ttl>] ] . Run fuseki with: fuseki-server --desc=cmspv-assembler.ttl /cmspv

  19. Cherry-pick the rules @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix : <#> . <#dataset> a ja:RDFDataset ; ja:graph :inf . :inf a ja:InfModel ; ja:baseModel :data ; ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; ja:rulesFrom <file:////projects/cmspv/branches/fuseki/skos.rules> ] . :data a ja:MemoryModel ; ja:content [ja:externalContent <http://www.w3.org/2009/08/skos-reference/skos.rdf>, <file:////projects/cmspv/branches/initial_rdf/skos/nims.ttl>] .

  20. The rules file # RDFS Closure rules [rdfs6: (?p rdfs:subPropertyOf ?q), notEqual(?p,?q) -> table(?p, ?q), [ (?a ?q ?b) <- (?a ?p ?b)] ] # inverseOf [inverseOf1: (?P owl:inverseOf ?Q) -> (?Q owl:inverseOf ?P) ] [inverseOf2: (?P owl:inverseOf ?Q) -> table(?P), table(?Q), [inverseOf2b: (?X ?P ?Y) <- (?Y ?Q ?X)] ] # TransitiveProperty [transitiveProperty1: (?P rdf:typeowl:TransitiveProperty) -> table(?P), [transitiveProperty1b: (?A ?P ?C) <- bound (?C), (?B ?P ?C), (?A ?P ?B)] [transitiveProperty1b: (?A ?P ?C) <- unbound (?C), (?A ?P ?B) (?B ?P ?C)] ] # SymmetricProperty [symmetricProperty1: (?P rdf:typeowl:SymmetricProperty) -> table(?P), [symmetricProperty1b: (?X ?P ?Y) <- (?Y ?P ?X)] ]

  21. Direct access • SPARQL endpoint: http://aquarius.tw.rpi.edu:3047/post.html • RDF file: https://scm.escience.rpi.edu/svn/public/projects/cmspv/branches/initial_rdf/skos/nims.ttl

More Related