Return-Path: X-Original-To: apmail-commonsrdf-commits-archive@minotaur.apache.org Delivered-To: apmail-commonsrdf-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3C5B1783E for ; Mon, 27 Apr 2015 16:13:25 +0000 (UTC) Received: (qmail 98290 invoked by uid 500); 27 Apr 2015 16:13:25 -0000 Delivered-To: apmail-commonsrdf-commits-archive@commonsrdf.apache.org Received: (qmail 98263 invoked by uid 500); 27 Apr 2015 16:13:25 -0000 Mailing-List: contact commits-help@commonsrdf.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commonsrdf.incubator.apache.org Delivered-To: mailing list commits@commonsrdf.incubator.apache.org Received: (qmail 98254 invoked by uid 99); 27 Apr 2015 16:13:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 16:13:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [54.76.25.247] (HELO mx1-eu-west.apache.org) (54.76.25.247) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 16:13:01 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 3696320310 for ; Mon, 27 Apr 2015 16:12:59 +0000 (UTC) Received: (qmail 97405 invoked by uid 99); 27 Apr 2015 16:12:58 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 16:12:58 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 1E37BAC02E4 for ; Mon, 27 Apr 2015 16:12:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r949361 - /websites/production/commonsrdf/content/userguide.html Date: Mon, 27 Apr 2015 16:12:57 -0000 To: commits@commonsrdf.incubator.apache.org From: stain@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150427161258.1E37BAC02E4@hades.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stain Date: Mon Apr 27 16:12:57 2015 New Revision: 949361 Log: Site checkin for project Commons RDF Modified: websites/production/commonsrdf/content/userguide.html Modified: websites/production/commonsrdf/content/userguide.html ============================================================================== --- websites/production/commonsrdf/content/userguide.html (original) +++ websites/production/commonsrdf/content/userguide.html Mon Apr 27 16:12:57 2015 @@ -227,6 +227,47 @@

User Guide

This page shows some examples of a client using the Commons RDF API. It was last updated for version 0.1-incubating-SNAPSHOT of the Commons RDF API.

+ +

Using Commons RDF from Maven

To use Commons RDF API from an Apache Maven projects, add the following dependency to your pom.xml:

@@ -276,7 +317,7 @@ </dependency>
-

Creating RDFTerm instances

+

Creating Commons RDF instances

To create instances of Commons RDF interfaces like Graph and IRI you will need a RDFTermFactory.

How to get an instance of this factory is implementation specific, for the simple implementation, you can construct the SimpleRDFTermFactory:

@@ -449,7 +490,7 @@ System.out.println(graph.contains(null,

false

-

IRI, Literal, BlankNode

+

RDF terms

The core RDF terms are arranged in this class hierarchy:

    @@ -635,10 +676,70 @@ System.out.println(b1.equals(new SimpleR

    Note: While it is recommended for this string to be (or contain) a UUID string, implementations are free to use any scheme to ensure their blank node references are globally unique. Therefore no assumptions should be made about this string except that it is unique per blank node.

Literal

-

TODO: Literal

+

A literal in RDF is a value such as a string, number or a date. A Literal can only be used as objects of a Triple

+

To create a Literal instance from an RDFTermFactory, use createLiteral:

+ +
+
+
Literal literal = factory.createLiteral("Hello world");
+System.out.println(literal);
+
+ +
+

"Hello world"

+
+

In RDF 1.1, a plain literal as created above always have the type http://www.w3.org/2001/XMLSchema#string:

+ +
+
+
System.out.println(literal.getDatatype());
+
+ +
+

<http://www.w3.org/2001/XMLSchema#string>

+
+

Literals may be created with an associated language tag:

+ +
+
+
Literal inSpanish = factory.createLiteral("¡Hola, Mundo!", "es");
+System.out.println(inSpanish);
+
+ +
+

"¡Hola, Mundo!"@es

+
+

In RDF 1.1, a Literal with a language always have the type http://www.w3.org/1999/02/22-rdf-syntax-ns#langString:

+ +
+
+
System.out.println(inSpanish.getDatatype());
+
+ +
+

<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>

+
+

A typed literal has a datatype represented by an IRI:

+ +
+
+
IRI xsdDouble = factory.createIRI("http://www.w3.org/2001/XMLSchema#double");
+Literal typedLiteral = factory.createLiteral("13.37", xsdDouble);
+System.out.println(typedLiteral);
+
+ +
+

"13.37"^^<http://www.w3.org/2001/XMLSchema#double>

+
-

Types

-

TODO: Types

+

Types

+

The class Types, which is part of the simple implementation, provides constants for the standard XML Schema datatypes, e.g. xsd:dateTime and xsd:float. Using Types, the above example can be simplified to:

+ +
+
+
Literal typedLiteral = factory.createLiteral("13.37", Types.XSD_DOUBLE);
+
+

Note that the string returned from Literal.ntriplesString() will always contain the full IRI for the datatype.

Triple

TODO: Triple