+ All Categories
Home > Documents > How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary...

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

Date post: 14-Dec-2015
Category:
Upload: macie-bathurst
View: 220 times
Download: 0 times
Share this document with a friend
Popular Tags:
21
How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project Linyun Fu 2013-03-06
Transcript
Page 1: How We Use Epimorphics Linked Data API (ELDA) in Costal and Marine Spatial Planning Vocabulary project Linyun Fu 2013-03-06.

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

Linyun Fu2013-03-06

Page 2: 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

• 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/t

erm/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

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

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

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

System architecture

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

Next steps

• Identifying an endpoint• Binding variables• Selecting resources• Viewing resources• Formatting graphs

• All done with spec files

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

Spec files• sample spec 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>

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

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"],

...

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

Binding variablesspec: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"],

...

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

Selecting resources

spec:vocabulariesEndpointa api:ListEndpoint;api:uriTemplate "/vocabs";api:exampleRequestPath "/vocabs";api:selector [

api:where "?item rdf:type skos: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"

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

More examples

spec:vocabularyEndpointa 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

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

spec:termEndpointa 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

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

spec:vocabularyTermsEndpointa 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:type rdfs: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

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

spec:NarrowerTermsEndpointa 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:type rdfs:Resource;

] ;api:selector [

api:where "?concept skos:narrower ?item. ?item skos:prefLabel ?label.";

api:orderBy "?label";] ;.

http://aquarius.tw.rpi.edu:8047/elda/cmspv/vocab/nims/term/0008/narrower

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

Viewing resources, formatting graphs

spec:SKOSViewera api:Viewer;api:name "SKOS Viewer";api:include api:labelledDescribeViewer;extras:describeAllLabel skos:prefLabel;.

spec:htmlFormattera api:XsltFormatter;api:name "html";api:mimeType "text/html; charset=utf-8";api:stylesheet "lda-assets/xslt/cmspv.xsl";.

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

A broader chain viewerspec:broaderChainViewer

a api:Viewer;api:name "Broader Chain Viewer";api:include api:describeViewer;api:properties "prefLabel, broader.prefLabel, broader.broader.prefLabel, broader.broader.broader.prefLabel" .

spec:broaderChainEndpointa api:ItemEndpoint;api:uriTemplate "/vocab/{vocabulary}/term/{term}/broaderChain";api:itemTemplate "{base}/vocab/{vocabulary}/term/{term}";api:exampleRequestPath "/vocab/nims/term/0038/broaderChain";api:defaultViewer spec:broaderChainViewer; .

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

Don’t forgetspec:api

a api:API;

api:viewerspec:broaderChainViewer,

api:endpoint

spec:broaderChainEndpoint,

skos:broadera rdf:Property;api:label "broader";.

skos:prefLabela rdf:Property;api:label "prefLabel";.

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

/vocab/nims/term/0032/broaderChain

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

Using Fuseki assemblercmspv-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:ontModelSpec ja: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

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

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>] .

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

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:type owl: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:type owl:SymmetricProperty) -> table(?P), [symmetricProperty1b: (?X ?P ?Y) <- (?Y ?P ?X)] ]

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

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


Recommended