Practical Semantic Web and Linked Data Applications by Mark Watson - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Preface

xi

1.

Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

xi

2.

Portable Common Lisp Code Book Examples . . . . . . . . . . . . . xii

3.

Using the Common Lisp ASDF Package Manager . . . . . . . . . . . xii

4.

Information on the Companion Edition to this Book that Covers Java

and JVM Languages

. . . . . . . . . . . . . . . . . . . . . . . . . . xiii

5.

AllegroGraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

6.

Software License for Example Code in this Book . . . . . . . . . . . xiv

1. Introduction

1

1.1. Who is this Book Written For? . . . . . . . . . . . . . . . . . . . . .

1

1.2. Why a PDF Copy of this Book is Available Free on the Web . . . . .

3

1.3. Book Software

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

1.4. Why Graph Data Representations are Better than the Relational Database

Model for Dealing with Rapidly Changing Data Requirements . . . .

4

1.5. What if You Use Other Programming Languages Other Than Lisp? . .

4

2. AllegroGraph Embedded Lisp Quick Start

7

2.1. Starting AllegroGraph

. . . . . . . . . . . . . . . . . . . . . . . . .

7

2.2. Working with RDF Data Stores . . . . . . . . . . . . . . . . . . . . .

8

2.2.1.

Creating Repositories . . . . . . . . . . . . . . . . . . . . . .

9

2.2.2.

AllegroGraph Lisp Reader Support for RDF . . . . . . . . . . 10

2.2.3.

Adding Triples . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.2.4.

Fetching Triples by ID . . . . . . . . . . . . . . . . . . . . . 11

2.2.5.

Printing Triples . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.2.6.

Using Cursors to Iterate Through Query Results . . . . . . . . 13

2.2.7.

Saving Triple Stores to Disk as XML, N-Triples, and N3 . . . 14

2.3. AllegroGraph’s Extensions to RDF . . . . . . . . . . . . . . . . . . . 14

2.3.1.

Examples Using Triple and Graph IDs . . . . . . . . . . . . . 15

2.3.2.

Support for Geo Location

. . . . . . . . . . . . . . . . . . . 16

2.3.3.

Support for Free Text Indexing . . . . . . . . . . . . . . . . . 19

2.3.4.

Comparing AllegroGraph With Other Semantic Web Frame-

works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.4. AllegroGraph Quickstart Wrap Up . . . . . . . . . . . . . . . . . . . 21

iii

Contents

I.

Semantic Web Technologies

23

3. RDF

25

3.1. RDF Examples in N-Triple and N3 Formats . . . . . . . . . . . . . . 27

3.2. The RDF Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.2.1.

rdf:type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.2.2.

rdf:Property . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.3. Dereferenceable URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.4. RDF Wrap Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4. RDFS

33

4.1. Extending RDF with RDF Schema . . . . . . . . . . . . . . . . . . . 33

4.2. Modeling with RDFS . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.3. AllegroGraph RDFS++ Extensions . . . . . . . . . . . . . . . . . . . 36

4.3.1.

owl:sameAs . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.3.2.

owl:inverseOf . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4.3.3.

owl:TransitiveProperty . . . . . . . . . . . . . . . . . . . . . 38

4.4. RDFS Wrapup

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

5. The SPARQL Query Language

41

5.1. Example RDF Data in N3 Format

. . . . . . . . . . . . . . . . . . . 41

5.2. Example SPARQL SELECT Queries . . . . . . . . . . . . . . . . . . 44

5.3. Example SPARQL CONSTRUCT Queries . . . . . . . . . . . . . . . 46

5.4. Example SPARQL ASK Queries . . . . . . . . . . . . . . . . . . . . 46

5.5. Example SPARQL DESCRIBE Queries . . . . . . . . . . . . . . . . 46

5.6. Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

6. RDFS++ and OWL

49

6.1. Properties Supported In RDFS++ . . . . . . . . . . . . . . . . . . . . 49

6.1.1.

owl:sameAs . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.1.2.

owl:inverseOf . . . . . . . . . . . . . . . . . . . . . . . . . . 50

6.1.3.

owl:TransitiveProperty . . . . . . . . . . . . . . . . . . . . . 51

6.2. RDF, RDFS, and RDFS++ Modeling Wrap Up

. . . . . . . . . . . . 51

II. AllegroGraph Extended Tutorial

53

7. SPARQL Queries Using AllegroGraph APIs

55

7.1. Using Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

7.2. Reading RDF Data From Files . . . . . . . . . . . . . . . . . . . . . 56

7.3. Lisp APIs for Queires . . . . . . . . . . . . . . . . . . . . . . . . . . 56

7.4. Wrap Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

8. AllegroGraph Reasoning System

59

8.1. Enabling RDFS++ Reasoning on a Triple Store . . . . . . . . . . . . 59

iv

Contents

8.2. Inferring New Triples: rdf:type vs. rdfs:subClassOf Example . . . . . 60

8.3. Using Inverse Properties . . . . . . . . . . . . . . . . . . . . . . . . 61

8.4. Using the Same As Property . . . . . . . . . . . . . . . . . . . . . . 63

8.5. Using the Transitive Property . . . . . . . . . . . . . . . . . . . . . . 63

8.6. Wrap Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

9. AllegroGraph Prolog Interface

67

III. Portable Common Lisp Utilities for Information Pro-

cessing

71

10. Linked Data and the World Wide Web

73

10.1. Linked Data Resources on the Web . . . . . . . . . . . . . . . . . . . 74

10.2. Publishing Linked Data . . . . . . . . . . . . . . . . . . . . . . . . . 74

10.3. Will Linked Data Become the Semantic Web? . . . . . . . . . . . . . 75

10.4. Linked Data Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . 75

11. Common Lisp Client Library for Open Calais

77

11.1. Open Calais Web Services Client . . . . . . . . . . . . . . . . . . . . 77

11.2. Storing Entity Data in an RDF Data Store . . . . . . . . . . . . . . . 80

11.3. Testing the Open Calais Demo System . . . . . . . . . . . . . . . . . 81

11.4. Open Calais Wrap Up . . . . . . . . . . . . . . . . . . . . . . . . . . 82

12. Common Lisp Client Library for Natural Language Processing

85

12.1. KnowledgeBooks.com Natural Language Processing Library . . . . . 85

12.2. KnowledgeBooks Natural Language Processing Library Wrapup . . . 87

13. Common Lisp Client Library for Freebase

89

13.1. Overview of Freebase . . . . . . . . . . . . . . . . . . . . . . . . . . 89

13.2. Accessing Freebase from Common Lisp . . . . . . . . . . . . . . . . 91

13.3. Freebase Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

14. Common Lisp Client Library for DBpedia

95

14.1. Interactively Querying DBpedia Using the Snorql Web Interface . . . 95

14.2. Interactively Finding Useful DBpedia Resources Using the gFacet

Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

14.3. The lookup.dbpedia.org Web Service . . . . . . . . . . . . . . . . . . 97

14.4. Using the AllegroGraph SPARQL Client Library to access DBpedia . 99

14.5. DBpedia Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

15. Library for GeoNames

101

15.1. Using the cl-geonames Library . . . . . . . . . . . . . . . . . . . . . 101

15.2. Geonames Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

v

Contents

IV. Example Semantic Web Application

105

16. Semantic Web Portal Back End Services

107

16.1. Implementing the Back End APIs

. . . . . . . . . . . . . . . . . . . 108

16.2. Unit Testing the Backend Code . . . . . . . . . . . . . . . . . . . . . 110

16.3. Backend Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

17. Semantic Web Portal User Interface

113

17.1. Portable AllegroServe . . . . . . . . . . . . . . . . . . . . . . . . . . 113

17.2. Layout of CLP files for Web Application . . . . . . . . . . . . . . . . 113

17.3. Common Lisp Code for Web Application . . . . . . . . . . . . . . . 114

17.4. Web Application Wrap Up . . . . . . . . . . . . . . . . . . . . . . . 118

vi

List of Figures

1.1. Example Semantic Web Application . . . . . . . . . . . . . . . . . .

2

14.1. DBpedia Snorql Web Interface . . . . . . . . . . . . . . . . . . . . . 96

14.2. DBpedia Graph Facet Viewer . . . . . . . . . . . . . . . . . . . . . . 98

14.3. DBpedia Graph Facet Viewer after selecting a resource . . . . . . . . 98

17.1. Example Semantic Web Application Login Page . . . . . . . . . . . . 114

17.2. Example File Upload Page . . . . . . . . . . . . . . . . . . . . . . . 116

17.3. Example Application Search Page . . . . . . . . . . . . . . . . . . . 118

vii

List of Tables

13.1. Subset of Freebase API Arguments . . . . . . . . . . . . . . . . . . . 90

ix

Find Your Next Great Read

Describe what you're looking for in as much detail as you'd like.
Our AI reads your request and finds the best matching books for you.

Showing results for ""

Popular searches:

Romance Mystery & Thriller Self-Help Sci-Fi Business