Semantics Developer's Guide

Total Page:16

File Type:pdf, Size:1020Kb

Semantics Developer's Guide MarkLogic Server Semantic Graph Developer’s Guide 2 MarkLogic 10 May, 2019 Last Revised: 10.0-8, October, 2021 Copyright © 2021 MarkLogic Corporation. All rights reserved. MarkLogic Server MarkLogic 10—May, 2019 Semantic Graph Developer’s Guide—Page 2 MarkLogic Server Table of Contents Table of Contents Semantic Graph Developer’s Guide 1.0 Introduction to Semantic Graphs in MarkLogic ..........................................11 1.1 Terminology ..........................................................................................................12 1.2 Linked Open Data .................................................................................................13 1.3 RDF Implementation in MarkLogic .....................................................................14 1.3.1 Using RDF in MarkLogic .........................................................................15 1.3.1.1 Storing RDF Triples in MarkLogic ...........................................17 1.3.1.2 Querying Triples .......................................................................18 1.3.2 RDF Data Model .......................................................................................20 1.3.3 Blank Node Identifiers ..............................................................................21 1.3.4 RDF Datatypes ..........................................................................................21 1.3.5 IRIs and Prefixes .......................................................................................22 1.3.5.1 IRIs ............................................................................................22 1.3.5.2 Prefixes ......................................................................................23 1.3.6 RDF Vocabulary .......................................................................................24 1.4 Example Datasets ..................................................................................................25 2.0 Getting Started with Semantic Graphs in MarkLogic ..................................27 2.1 Setting up MarkLogic Server ................................................................................27 2.1.1 Configuring the Database to Work with Triples .......................................27 2.1.2 Setting Up Additional Servers ..................................................................28 2.2 Loading Triples .....................................................................................................28 2.2.1 Downloading the Dataset ..........................................................................28 2.2.2 Importing Triples with mlcp .....................................................................29 2.2.3 Verifying the Import .................................................................................30 2.3 Querying Triples ...................................................................................................32 2.3.1 Querying with Native SPARQL ...............................................................32 2.3.2 Querying with the sem:sparql Functions ..................................................34 3.0 Loading Semantic Triples ............................................................................37 3.1 Loading Embedded RDF Triples ..........................................................................37 3.2 Loading Triples .....................................................................................................37 3.2.1 Supported RDF Triple Formats ................................................................38 3.2.2 Example RDF Formats .............................................................................39 3.2.2.1 RDF/XML .................................................................................39 3.2.2.2 Turtle .........................................................................................40 3.2.2.3 RDF/JSON ................................................................................40 3.2.2.4 N3 ..............................................................................................41 3.2.2.5 N-Triples ...................................................................................41 MarkLogic 10—May, 2019 Semantic Graph Developer’s Guide—Page 3 MarkLogic Server Table of Contents 3.2.2.6 N-Quads ....................................................................................43 3.2.2.7 TriG ...........................................................................................44 3.2.3 Loading Triples with mlcp ........................................................................44 3.2.3.1 Preparation ................................................................................45 3.2.3.2 Import Command Syntax ..........................................................46 3.2.3.3 Loading Triples and Quads .......................................................46 3.2.3.4 Import Options ..........................................................................47 3.2.3.5 Specifying Collections and a Directory ....................................49 3.2.4 Loading Triples with XQuery ...................................................................51 3.2.4.1 sem:rdf-insert ............................................................................52 3.2.4.2 sem:rdf-load ..............................................................................53 3.2.4.3 sem:rdf-get ................................................................................53 3.2.5 Loading Triples with JavaScript ...............................................................54 3.2.5.1 sem.rdfInsert ..............................................................................55 3.2.5.2 sem.rdfLoad ...............................................................................56 3.2.5.3 sem.rdfGet .................................................................................56 3.2.6 Loading Triples Using the REST API ......................................................56 3.2.6.1 Preparation ................................................................................57 3.2.6.2 Addressing the Graph Store ......................................................57 3.2.6.3 Specifying Parameters ...............................................................58 3.2.6.4 Supported Verbs ........................................................................58 3.2.6.5 Supported Media Formats .........................................................59 3.2.6.6 Loading Triples .........................................................................59 3.2.6.7 Response Errors .........................................................................60 3.2.7 Loading Triples Using the Java API .........................................................61 3.2.8 Loading Triples Using the Node.js API ....................................................61 4.0 Triple Index Overview ................................................................................63 4.1 Understanding the Triple Index and How It’s Used .............................................63 4.1.1 Triple Data and Value Caches ..................................................................63 4.1.1.1 Triple Cache and Triple Value Cache .......................................64 4.1.2 Triple Values and Type Information ........................................................64 4.1.3 Triple Positions .........................................................................................64 4.1.4 Index Files .................................................................................................65 4.1.5 Permutations .............................................................................................66 4.2 Enabling the Triple Index .....................................................................................66 4.2.1 Using the Database Configuration Pages ..................................................66 4.2.2 Using the Admin API ...............................................................................68 4.3 Other Considerations ............................................................................................69 4.3.1 Sizing Caches ............................................................................................69 4.3.2 Unused Values and Types .........................................................................70 4.3.3 Scaling and Monitoring ............................................................................71 5.0 Unmanaged Triples ......................................................................................73 5.1 Uses for Triples in XML Documents ...................................................................76 MarkLogic 10—May, 2019 Semantic Graph Developer’s Guide—Page 4 MarkLogic Server Table of Contents 5.1.1 Context from the Document .....................................................................76 5.1.2 Combination Queries ................................................................................77 5.1.3 Security with Unmanaged Triples ............................................................78 5.2 Bitemporal Triples ................................................................................................78 6.0 Semantic Queries .........................................................................................81 6.1 Querying Triples with SPARQL ...........................................................................82 6.1.1 Types of SPARQL Queries .......................................................................82
Recommended publications
  • Including Co-Referent Uris in a SPARQL Query
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Heriot Watt Pure Including Co-referent URIs in a SPARQL Query Christian Y A Brenninkmeijer1, Carole Goble1, Alasdair J G Gray1, Paul Groth2, Antonis Loizou2, and Steve Pettifer1 1 School of Computer Science, University of Manchester, UK. 2 Department of Computer Science, VU University of Amsterdam, The Netherlands. Abstract. Linked data relies on instance level links between potentially differing representations of concepts in multiple datasets. However, in large complex domains, such as pharmacology, the inter-relationship of data instances needs to consider the context (e.g. task, role) of the user and the assumptions they want to apply to the data. Such context is not taken into account in most linked data integration procedures. In this paper we argue that dataset links should be stored in a stand-off fashion, thus enabling different assumptions to be applied to the data links during query execution. We present the infrastructure developed for the Open PHACTS Discovery Platform to enable this and show through evaluation that the incurred performance cost is below the threshold of user perception. 1 Introduction A key mechanism of linked data is the use of equality links between resources across different datasets. However, the semantics of such links are often not triv- ial: as Halpin et al. have shown sameAs, is not always sameAs [12]; and equality is often context- and even task-specific, especially in complex domains. For ex- ample, consider the drug \Gleevec". A search over different chemical databases return records about two different chemical compounds { \Imatinib" and \Ima- tinib Mesylate" { which differ in chemical weight and other characteristics.
    [Show full text]
  • Provenance and Annotations for Linked Data
    Proc. Int’l Conf. on Dublin Core and Metadata Applications 2013 Provenance and Annotations for Linked Data Kai Eckert University of Mannheim, Germany [email protected] Abstract Provenance tracking for Linked Data requires the identification of Linked Data resources. Annotating Linked Data on the level of single statements requires the identification of these statements. The concept of a Provenance Context is introduced as the basis for a consistent data model for Linked Data that incorporates current best-practices and creates identity for every published Linked Dataset. A comparison of this model with the Dublin Core Abstract Model is provided to gain further understanding, how Linked Data affects the traditional view on metadata and to what extent our approach could help to mediate. Finally, a linking mechanism based on RDF reification is developed to annotate single statements within a Provenance Context. Keywords: Provenance; Annotations; RDF; Linked Data; DCAM; DM2E; 1. Introduction This paper addresses two challenges faced by many Linked Data applications: How to provide, access, and use provenance information about the data; and how to enable data annotations, i.e., further statements about the data, subsets of the data, or even single statements. Both challenges are related as both require the existence of identifiers for the data. We use the Linked Data infrastructure that is currently developed in the DM2E project as an example with typical use- cases and resulting requirements. 1.1. Foundations Linked Data, the publication of data on the Web, enables easy access to data and supports the reuse of data. The Hypertext Transfer Protocol (HTTP) is used to access a Uniform Resource Identifier (URI) and to retrieve data about the resource.
    [Show full text]
  • Versioning Linked Datasets
    Master’s Thesis Versioning Linked Datasets Towards Preserving History on the Semantic Web Author Paul Meinhardt 744393 July 13, 2015 Supervisors Magnus Knuth and Dr. Harald Sack Semantic Technologies Research Group Internet Technologies and Systems Chair Abstract Linked data provides methods for publishing and connecting structured data on the web using standard protocols and formats, namely HTTP, URIs, and RDF. Much like on the web of documents, linked data resources continuously evolve over time, but for the most part only their most recent state is accessible. In or- der to investigate the evolution of linked datasets and understand the impact of changes on the web of data it is necessary to make prior versions of such re- sources available. The lack of a common “self-service” versioning platform in the linked data community makes it more difficult for dataset maintainers to preserve past states of their data themselves. By implementing such a platform which also provides a consistent interface to historic information, dataset main- tainers can more easily start versioning their datasets while application develop- ers and researchers instantly have the possibility of working with the additional temporal data without laboriously collecting it on their own. This thesis, researches the possibility of creating a linked data versioning plat- form. It describes a basic model view for linked datasets, their evolution and presents a service approach to preserving the history of arbitrary linked datasets over time. Zusammenfassung Linked Data beschreibt Methoden für die Veröffentlichung und Verknüpfung strukturierter Daten im Web mithilfe standardisierter Protokolle und Formate, nämlich HTTP, URIs und RDF. Ähnlich wie andere Dokumente im World Wide Web, verändern sich auch Linked-Data-Resourcen stetig mit der Zeit.
    [Show full text]
  • V a Lida T in G R D F Da
    Series ISSN: 2160-4711 LABRA GAYO • ET AL GAYO LABRA Series Editors: Ying Ding, Indiana University Paul Groth, Elsevier Labs Validating RDF Data Jose Emilio Labra Gayo, University of Oviedo Eric Prud’hommeaux, W3C/MIT and Micelio Iovka Boneva, University of Lille Dimitris Kontokostas, University of Leipzig VALIDATING RDF DATA This book describes two technologies for RDF validation: Shape Expressions (ShEx) and Shapes Constraint Language (SHACL), the rationales for their designs, a comparison of the two, and some example applications. RDF and Linked Data have broad applicability across many fields, from aircraft manufacturing to zoology. Requirements for detecting bad data differ across communities, fields, and tasks, but nearly all involve some form of data validation. This book introduces data validation and describes its practical use in day-to-day data exchange. The Semantic Web offers a bold, new take on how to organize, distribute, index, and share data. Using Web addresses (URIs) as identifiers for data elements enables the construction of distributed databases on a global scale. Like the Web, the Semantic Web is heralded as an information revolution, and also like the Web, it is encumbered by data quality issues. The quality of Semantic Web data is compromised by the lack of resources for data curation, for maintenance, and for developing globally applicable data models. At the enterprise scale, these problems have conventional solutions. Master data management provides an enterprise-wide vocabulary, while constraint languages capture and enforce data structures. Filling a need long recognized by Semantic Web users, shapes languages provide models and vocabularies for expressing such structural constraints.
    [Show full text]
  • Binary RDF for Scalable Publishing, Exchanging and Consumption in the Web of Data
    WWW 2012 – PhD Symposium April 16–20, 2012, Lyon, France Binary RDF for Scalable Publishing, Exchanging and Consumption in the Web of Data Javier D. Fernández 1;2 Supervised by: Miguel A. Martínez Prieto 1 and Claudio Gutierrez 2 1 Department of Computer Science, University of Valladolid (Spain) 2 Department of Computer Science, University of Chile (Chile) [email protected] ABSTRACT era and hence they share a document-centric view, providing The Web of Data is increasingly producing large RDF data- human-focused syntaxes, disregarding large data. sets from diverse fields of knowledge, pushing the Web to In a typical scenario within the current state-of-the-art, a data-to-data cloud. However, traditional RDF represen- efficient interchange of RDF data is limited, at most, to com- tations were inspired by a document-centric view, which pressing the verbose plain data with universal compression results in verbose/redundant data, costly to exchange and algorithms. The resultant file has no logical structure and post-process. This article discusses an ongoing doctoral the- there is no agreed way to efficiently publish such data, i.e., sis addressing efficient formats for publication, exchange and to make them (publicly) available for diverse purposes and consumption of RDF on a large scale. First, a binary serial- users. In addition, the data are hardly usable at the time of ization format for RDF, called HDT, is proposed. Then, we consumption; the consumer has to decompress the file and, focus on compressed rich-functional structures which take then, to use an appropriate external tool (e.g.
    [Show full text]
  • PDF Formats; the XHTML Version Has Active Links That You Can Follow
    Semantic Web @ W3C: Activities, Recommendations and State of Adoption Athens, GA, USA, 2006-11-09 Ivan Herman, W3C Ivan Herman, W3C RDF(S), tools We have a solid specification since 2004: well defined (formal) semantics, clear RDF/XML syntax Lots of tools are available. Are listed on W3C’s wiki: RDF programming environment for 14+ languages, including C, C++, Python, Java, Javascript, Ruby, PHP,… (no Cobol or Ada yet ) 13+ Triple Stores, ie, database systems to store datasets 16+ general development tools (specialized editors, application builders, …) etc Ivan Herman, W3C RDF(S), tools (cont.) Note the large number of large corporations among the tool developers: Adobe, IBM, Software AG, Oracle, HP, Northrop Grumman, … …but the small companies and independent developers also play a major role! Some of the tools are Open Source, some are not; some are very mature, some are not : it is the usual picture of software tools, nothing special any more! Anybody can start developing RDF-based applications today Ivan Herman, W3C RDF(S), tools (cont.) There are lots of tutorials, overviews, or books around the wiki page on books lists 20+ (English) textbooks; 19+ proceedings for 2005 & 2006 alone… again, some of them good, some of them bad, just as with any other areas… Active developers’ communities Ivan Herman, W3C Large datasets are accumulating IngentaConnect bibliographic metadata storage: over 200 million triplets UniProt Protein Database: 262 million triplets RDF version of Wikipedia: more than 47 million triplets RDFS/OWL Representation
    [Show full text]
  • XSAMS: XML Schema for Atomic, Molecular and Solid Data
    XSAMS: XML Schema for Atomic, Molecular and Solid Data Version 0.1.1 Draft Document, January 14, 2011 This version: http://www-amdis.iaea.org/xsams/docu/v0.1.1.pdf Latest version: http://www-amdis.iaea.org/xsams/docu/ Previous versions: http://www-amdis.iaea.org/xsams/docu/v0.1.pdf Editors: M.L. Dubernet, D. Humbert, Yu. Ralchenko Authors: M.L. Dubernet, D. Humbert, Yu. Ralchenko, E. Roueff, D.R. Schultz, H.-K. Chung, B.J. Braams Contributors: N. Moreau, P. Loboda, S. Gagarin, R.E.H. Clark, M. Doronin, T. Marquart Abstract This document presents a proposal for an XML schema aimed at describing Atomic, Molec- ular and Particle Surface Interaction Data in distributed databases around the world. This general XML schema is a collaborative project between International Atomic Energy Agency (Austria), National Institute of Standards and Technology (USA), Universit´ePierre et Marie Curie (France), Oak Ridge National Laboratory (USA) and Paris Observatory (France). Status of this document It is a draft document and it may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use this document as reference materials or to cite them as other than “work in progress”. Acknowledgements The authors wish to acknowledge all colleagues and institutes, atomic and molecular database experts and physicists who have collaborated through different discussions to the building up of the concepts described in this document. Change Log Version 0.1: June 2009 Version 0.1.1: November 2010 Contents 1 Introduction 11 1.1 Motivation..................................... 11 1.2 Limitations..................................... 12 2 XSAMS structure, types and attributes 13 2.1 Atomic, Molecular and Particle Surface Interaction Data XML Schema Structure 13 2.2 Attributes ....................................
    [Show full text]
  • Rdfa in XHTML: Syntax and Processing Rdfa in XHTML: Syntax and Processing
    RDFa in XHTML: Syntax and Processing RDFa in XHTML: Syntax and Processing RDFa in XHTML: Syntax and Processing A collection of attributes and processing rules for extending XHTML to support RDF W3C Recommendation 14 October 2008 This version: http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014 Latest version: http://www.w3.org/TR/rdfa-syntax Previous version: http://www.w3.org/TR/2008/PR-rdfa-syntax-20080904 Diff from previous version: rdfa-syntax-diff.html Editors: Ben Adida, Creative Commons [email protected] Mark Birbeck, webBackplane [email protected] Shane McCarron, Applied Testing and Technology, Inc. [email protected] Steven Pemberton, CWI Please refer to the errata for this document, which may include some normative corrections. This document is also available in these non-normative formats: PostScript version, PDF version, ZIP archive, and Gzip’d TAR archive. The English version of this specification is the only normative version. Non-normative translations may also be available. Copyright © 2007-2008 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply. Abstract The current Web is primarily made up of an enormous number of documents that have been created using HTML. These documents contain significant amounts of structured data, which is largely unavailable to tools and applications. When publishers can express this data more completely, and when tools can read it, a new world of user functionality becomes available, letting users transfer structured data between applications and web sites, and allowing browsing applications to improve the user experience: an event on a web page can be directly imported - 1 - How to Read this Document RDFa in XHTML: Syntax and Processing into a user’s desktop calendar; a license on a document can be detected so that users can be informed of their rights automatically; a photo’s creator, camera setting information, resolution, location and topic can be published as easily as the original photo itself, enabling structured search and sharing.
    [Show full text]
  • RDF Query Languages Need Support for Graph Properties
    RDF Query Languages Need Support for Graph Properties Renzo Angles1, Claudio Gutierrez1, and Jonathan Hayes1,2 1 Dept. of Computer Science, Universidad de Chile 2 Dept. of Computer Science, Technische Universit¨at Darmstadt, Germany {rangles,cgutierr,jhayes}@dcc.uchile.cl Abstract. This short paper discusses the need to include into RDF query languages the ability to directly query graph properties from RDF data. We study the support that current RDF query languages give to these features, to conclude that they are currently not supported. We propose a set of basic graph properties that should be added to RDF query languages and provide evidence for this view. 1 Introduction One of the main features of the Resource Description Framework (RDF) is its ability to interconnect information resources, resulting in a graph-like structure for which connectivity is a central notion [GLMB98]. As we will argue, basic concepts of graph theory such as degree, path, and diameter play an important role for applications that involve RDF querying. Considering the fact that the data model influences the set of operations that should be provided by a query language [HBEV04], it follows the need for graph operations support in RDF query languages. For example, the query “all relatives of degree 1 of Alice”, submitted to a genealogy database, amounts to retrieving the nodes adjacent to a resource. The query “are suspects A and B related?”, submitted to a police database, asks for any path connecting these resources in the (RDF) graph that is stored in this database. The query “what is the Erd˝osnumber of Alberto Mendelzon”, submitted to (a RDF version of) DBLP, asks simply for the length of the shortest path between the nodes representing Erd˝osand Mendelzon.
    [Show full text]
  • Exercise Sheet 1
    Semantic Web, SS 2017 1 Exercise Sheet 1 RDF, RDFS and Linked Data Submit your solutions until Friday, 12.5.2017, 23h00 by uploading them to ILIAS. Later submissions won't be considered. Every solution should contain the name(s), email adress(es) and registration number(s) of its (co-)editor(s). Read the slides for more submission guidelines. 1 Knowledge Representation (4pts) 1.1 Knowledge Representation Humans usually express their knowledge in natural language. Why aren't we using, e.g., English for knowledge representation and the semantic web? 1.2 Terminological vs Concrete Knowledge What is the role of terminological knowledge (e.g. Every company is an organization.), and what is the role of facts (e.g. Microsoft is an organization. Microsoft is headquartered in Redmond.) in a semantic web system? Hint: Imagine an RDF ontology that contains either only facts (describing factual knowledge: states of aairs) or constraints (describing terminological knowledge: relations between con- cepts). What could a semantic web system do with it? Semantic Web, SS 2017 2 2 RDF (10pts) RDF graphs consist of triples having a subject, a predicate and an object. Dierent syntactic notations can be used in order to serialize RDF graphs. By now you have seen the XML and the Turtle syntax of RDF. In this task we will use the Notation3 (N3) format described at http://www.w3.org/2000/10/swap/Primer. Look at the following N3 le: @prefix model: <http://example.com/model1/> . @prefix cdk: <http://example.com/chemistrydevelopmentkit/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    [Show full text]
  • Enhancing JSON to RDF Data Conversion with Entity Type Recognition
    Enhancing JSON to RDF Data Conversion with Entity Type Recognition Fellipe Freire, Crishane Freire and Damires Souza Academic Unit of Informatics, Federal Institute of Education, Science and Technology of Paraiba, João Pessoa, Brazil Keywords: RDF Data Conversion, Entity Type Recognition, Semi-Structured Data, JSON Documents, Semantics Usage. Abstract: Nowadays, many Web data sources and APIs make their data available on the Web in semi-structured formats such as JSON. However, JSON data cannot be directly used in the Web of data, where principles such as URIs and semantically named links are essential. Thus it is necessary to convert JSON data into RDF data. To this end, we have to consider semantics in order to provide data reference according to domain vocabularies. To help matters, we present an approach which identifies JSON metadata, aligns them with domain vocabulary terms and converts data into RDF. In addition, along with the data conversion process, we provide the identification of the semantically most appropriate entity types to the JSON objects. We present the definitions underlying our approach and results obtained with the evaluation. 1 INTRODUCTION principles of this work is using semantics provided by the knowledge domain of the data to enhance The Web has evolved into an interactive information their conversion to RDF data. To this end, we use network, allowing users and applications to share recommended open vocabularies which are data on a massive scale. To help matters, the Linked composed by a set of terms, i.e., classes and Data principles define a set of practices for properties useful to describe specific types of things publishing structured data on the Web aiming to (LOV Documentation, 2016).
    [Show full text]
  • 15 Years of Semantic Web: an Incomplete Survey
    Ku¨nstl Intell (2016) 30:117–130 DOI 10.1007/s13218-016-0424-1 TECHNICAL CONTRIBUTION 15 Years of Semantic Web: An Incomplete Survey 1 2 Birte Glimm • Heiner Stuckenschmidt Received: 7 November 2015 / Accepted: 5 January 2016 / Published online: 23 January 2016 Ó Springer-Verlag Berlin Heidelberg 2016 Abstract It has been 15 years since the first publications today’s Web: Uniform Resource Identifiers (URIs) for proposed the use of ontologies as a basis for defining assigning unique identifiers to resources, the HyperText information semantics on the Web starting what today is Markup Language (HTML) for specifying the formatting known as the Semantic Web Research Community. This of Web pages, and the Hypertext Transfer Protocol (HTTP) work undoubtedly had a significant influence on AI as a that allows for the retrieval of linked resources from across field and in particular the knowledge representation and the Web. Typically, the markup of standard Web pages Reasoning Community that quickly identified new chal- describes only the formatting and, hence, Web pages and lenges and opportunities in using Description Logics in a the navigation between them using hyperlinks is targeted practical setting. In this survey article, we will try to give towards human users (cf. Fig. 1). an overview of the developments the field has gone through In 2001, Tim Berners-Lee, James Hendler, and Ora in these 15 years. We will look at three different aspects: Lassila describe their vision for a Semantic Web [5]: the evolution of Semantic Web Language Standards, the The Semantic Web is not a separate Web but an evolution of central topics in the Semantic Web Commu- extension of the current one, in which information is nity and the evolution of the research methodology.
    [Show full text]