You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by ha...@apache.org on 2017/05/07 20:22:17 UTC

svn commit: r1794258 - in /clerezza/site/production: getting-started/index.html getting-started/tutorial/tutorial-01/index.html style/style.css

Author: hasan
Date: Sun May  7 20:22:17 2017
New Revision: 1794258

URL: http://svn.apache.org/viewvc?rev=1794258&view=rev
Log:
CLEREZZA-1017: Add Tutorial 01

Modified:
    clerezza/site/production/getting-started/index.html
    clerezza/site/production/getting-started/tutorial/tutorial-01/index.html
    clerezza/site/production/style/style.css

Modified: clerezza/site/production/getting-started/index.html
URL: http://svn.apache.org/viewvc/clerezza/site/production/getting-started/index.html?rev=1794258&r1=1794257&r2=1794258&view=diff
==============================================================================
--- clerezza/site/production/getting-started/index.html (original)
+++ clerezza/site/production/getting-started/index.html Sun May  7 20:22:17 2017
@@ -80,23 +80,23 @@
                         <ul>
                             <li>
                                 <div>
-                                    <a href="../downloads/">Downloads</a>- Download Apache Clerezza.
+                                    <a href="../downloads/">Downloads</a> - Download Apache Clerezza.
                                 </div>
                             </li>
                             <li>
                                 <div>
-                                    <a href="building-clerezza/">Building Apache Clerezza</a>- Learn how to build Apache Clerezza.
+                                    <a href="building-clerezza/">Building Apache Clerezza</a> - Learn how to build Apache Clerezza.
                                 </div>
                             </li>
                             <li>
                                 <div>
-                                    <a href="/documentation/">Apache Clerezza Documenation</a>- Apache Clerezza provides a documentation available under
+                                    <a href="/documentation/">Apache Clerezza Documenation</a> - Apache Clerezza provides a documentation available under
                                     <a href="http://clerezza.apache.org/documentation">http://clerezza.apache.org/documentation</a>. This documentation is also available on this website.
                                 </div>
                             </li>
                             <li>
                                 <div>
-                                    <a href="http://clerezza.apache.org/getting-started/tutorial/" target="_blank">Tutorial</a>- Learn how to manage linked data using Apache Clerezza.
+                                    <a href="http://clerezza.apache.org/getting-started/tutorial/" target="_blank">Tutorial</a> - Learn how to manage linked data using Apache Clerezza.
                                 </div>
                             </li>
                         </ul>
@@ -177,4 +177,4 @@
             </div>
         </div>
     </body>
-</html>
\ No newline at end of file
+</html>

Modified: clerezza/site/production/getting-started/tutorial/tutorial-01/index.html
URL: http://svn.apache.org/viewvc/clerezza/site/production/getting-started/tutorial/tutorial-01/index.html?rev=1794258&r1=1794257&r2=1794258&view=diff
==============================================================================
--- clerezza/site/production/getting-started/tutorial/tutorial-01/index.html (original)
+++ clerezza/site/production/getting-started/tutorial/tutorial-01/index.html Sun May  7 20:22:17 2017
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <link type="text/css" href="/style/style.css" rel="stylesheet"/>
-        <title>Getting Started</title>
+        <title>Tutorial 01 - Store Triples in a Simple Graph</title>
     </head>
     <body>
         <div class="zz-header">
@@ -76,7 +76,80 @@
             <div class='tx-content'>
                 <div>
                     <div xmlns="http://www.w3.org/1999/xhtml" class="column one-column">
-                        <p>Under Construction</p>
+                        <h2>Problem Definition</h2>
+                        <p>
+                        Suppose that we want to store the statement "Hasan is an Apache Clerezza user" in an RDF Graph. We can rephrase the statement to be more precise to "There is someone having the first name Hasan, who is an Apache Clerezza user". This statement can be represented in <a href="https://www.w3.org/TR/turtle/">Turtle</a>, assuming the use of an example ontology, as follows.
+                        </p>
+                        <div xmlns="http://www.w3.org/1999/xhtml" class="tx-blockcode">
+@prefix ex: <http://clerezza.apache.org/2017/01/example#> .
+_:a ex:hasFirstName "hasan" .
+_:a ex:isA ex:ClerezzaUser .
+                        </div>
+                        <p>
+                        We are looking for a solution using the Apache Clerezza API to store in memory the two triples in a graph.
+                        </p>
+                        <h2>Solution</h2>
+                        <p>The solution below uses the following Apache Clerezza libraries:</p>
+                        <ul>
+                            <li>commons-rdf-api-0.2-SNAPSHOT.jar</li>
+                            <li>commons-rdf-impl-utils-0.2-SNAPSHOT.jar</li>
+                        </ul>
+                        <div xmlns="http://www.w3.org/1999/xhtml" class="tx-blockcode">
+     1  package example.pkg01;
+     2  
+     3  import java.util.Iterator;
+     4  import org.apache.clerezza.commons.rdf.BlankNode;
+     5  import org.apache.clerezza.commons.rdf.Graph;
+     6  import org.apache.clerezza.commons.rdf.IRI;
+     7  import org.apache.clerezza.commons.rdf.Triple;
+     8  import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+     9  import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+    10  import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+    11  
+    12  public class Example01 {
+    13  
+    14      public static void main(String[] args) {
+    15          BlankNode subject = new BlankNode();
+    16  
+    17          IRI isA = new IRI("http://clerezza.apache.org/2017/01/example#isA");
+    18          IRI clerezzaUser = new IRI("http://clerezza.apache.org/2017/01/example#ClerezzaUser");
+    19  
+    20          IRI hasFirstName = new IRI("http://clerezza.apache.org/2017/01/example#hasFirstName");
+    21          PlainLiteralImpl firstName = new PlainLiteralImpl("Hasan");
+    22  
+    23          TripleImpl subjectType = new TripleImpl(subject, isA, clerezzaUser);
+    24          TripleImpl subjectFirstName = new TripleImpl(subject, hasFirstName, firstName);
+    25  
+    26          Graph myGraph = new SimpleGraph();
+    27          myGraph.add(subjectType);
+    28          myGraph.add(subjectFirstName);
+    29  
+    30          Iterator<Triple> iterator = myGraph.filter(null,null,null);
+    31          Triple triple;
+    32          while (iterator.hasNext()) {
+    33              triple = iterator.next();
+    34              System.out.println(triple.getSubject().toString());
+    35              System.out.println(triple.getPredicate().toString());
+    36              System.out.println(triple.getObject().toString());
+    37          }
+    38      }
+    39  }
+
+                        </div>
+                    <p>Running the above Java program results in:</p>
+                        <div xmlns="http://www.w3.org/1999/xhtml" class="tx-blockcode">
+org.apache.clerezza.commons.rdf.BlankNode@1c170f0
+&lt;http://clerezza.apache.org/2017/01/example#isA&gt;
+&lt;http://clerezza.apache.org/2017/01/example#ClerezzaUser&gt;
+org.apache.clerezza.commons.rdf.BlankNode@1c170f0
+&lt;http://clerezza.apache.org/2017/01/example#hasFirstName&gt;
+"Hasan"
+                        </div>
+                        <h2>Discussion</h2>
+                        <p></p>
+                        <p>
+                        Note: Any comments and suggestions for improvements are welcome. Please send your feedback to <a href="mailto:dev@clerezza.apache.org">dev@clerezza.apache.org</a>
+                        </p>
                     </div>
                 </div>
             </div>

Modified: clerezza/site/production/style/style.css
URL: http://svn.apache.org/viewvc/clerezza/site/production/style/style.css?rev=1794258&r1=1794257&r2=1794258&view=diff
==============================================================================
--- clerezza/site/production/style/style.css (original)
+++ clerezza/site/production/style/style.css Sun May  7 20:22:17 2017
@@ -251,7 +251,7 @@ li div,span {
 	margin-top:14em;
 	margin-left:25em;
 	/*width:70%;*/
-	max-width:600px;
+	max-width:800px;
 	line-height: 1.5em;
 	
 }
@@ -428,4 +428,4 @@ div .module-info div ol li a {
 	color: #a4a49c;
 }
 
-/* Localized */
\ No newline at end of file
+/* Localized */