Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 780

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="2. Installation Guide" />
  <meta name="dc.subject" content="2. Installation Guide" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="installation.html" title="Chapter Contents" />
  <link rel="prev" href="installsilver.html" title="Creating a Silverlight Application to consume the service" />
  <link rel="next" href="installnetriavd.html" title="Creating a .Net RIA Services Application That Will Update Virtuoso Data" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>2. Installation Guide</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="installnetriadd" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>2. Installation Guide</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="installation.html">Chapter Contents</a> | <a class="link" href="installsilver.html" title="Creating a Silverlight Application to consume the service">Prev</a> | <a class="link" href="installnetriavd.html" title="Creating a .Net RIA Services Application That Will Update Virtuoso Data">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="installation.html">Installation Guide</a>
   </div>
    <br />
   <div>
      <a href="installwin32.html">Virtuoso for Windows</a>
   </div>
   <div>
      <a href="linuxinstall.html">Virtuoso for Linux (Enterprise Edition)</a>
   </div>
   <div>
      <a href="unxinstvirt.html">Virtuoso for Unix (Enterprise Edition)</a>
   </div>
   <div>
      <a href="unixpersonainstall.html">Virtuoso for Unix (Personal Edition)</a>
   </div>
   <div>
      <a href="installmacosx.html">Virtuoso for Mac OS X</a>
   </div>
   <div>
      <a href="installvsgrid.html">Virtuoso ADO.Net Data Grid Form Application</a>
   </div>
   <div>
      <a href="installvsent.html">Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application</a>
   </div>
   <div>
      <a href="installusado.html">Using Visual Studio 2008 to Build an ADO.NET Data Services based Application</a>
   </div>
   <div>
      <a href="installwfas.html">Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider</a>
   </div>
   <div>
      <a href="installcrweb.html">Creating a Web Browser Application to Access RDF Data Using The Virtuoso ADO.Net Provider</a>
   </div>
   <div>
      <a href="installsilver.html">Creating a Silverlight Application to consume the service</a>
   </div>
   <div class="selected">
      <a href="installnetriadd.html">Creating A Simple .NET RIA Services Application To Display Data
From Virtuoso</a>
    <div>
        <a href="#installnetriaddpreq" title="Pre-requisites">Pre-requisites</a>
        <a href="#installnetriaddcrser" title="Creating the Application">Creating the Application</a>
        <a href="#installnetriaddcrdf" title="Displaying RDF Data">Displaying RDF Data</a>
        <a href="#installnetriaddcnext" title="Next Steps">Next Steps</a>
    </div>
   </div>
   <div>
      <a href="installnetriavd.html">Creating a .Net RIA Services Application That Will Update Virtuoso Data</a>
   </div>
   <div>
      <a href="clusterstcnf.html">Cluster Installation and Config</a>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="installnetriadd" />
    <h2>2.12. Creating A Simple .NET RIA Services Application To Display Data
From Virtuoso</h2>
<p>.NET RIA Services is a new framework from Microsoft that simplifies the development of n-tier web
applications. A typical application will consist of a presentation layer, application logic and a data
access layer. In these examples a combination of Silverlight 3 and .NET RIA Services will provide the
presentation layer and application layer while the data will reside in Virtuoso and be accessed using
the Virtuoso ADO.NET provider. The first example demonstrates how to display data from the Employee
table in the Demo database in a grid on a web page. The second example shows how to display IRIs from
the RDF views of the demo data. The IRIs are used to create hyperlinks that are the starting point
for exploring the linked data.
</p>
      
        <a name="installnetriaddpreq" />
    <h3>2.12.1. Pre-requisites</h3>
<ol>
      <li>The example assumes that you have a local Virtuoso server with the Northwind demo database
installed. If the demo database is not already installed then download the demo database VAD package
(demo_dav.vad) and install it. The VAD package will create a new database in Virtuoso called demo
containing the familiar Northwind tables. It will also creates RDF views of the Northwind tables.
In the example we assume the database is accessible on a hostname of &quot;demo.openlinksw.com&quot; on the
default port 80, where an actually live instance of the Virtuoso Demo database is hosted. Users
would use the appropriate hostname and port number of their Virtuoso installation to create the
sample application, and would be would be localhost:8890 for a default installation or whatever
the URIQA DefaultHost Virtuoso configuration parameter is set to when the demo database VAD package
is installed.</li>
      <li>The Virtuoso ADO.Net provider for .Net 3.5 and the Entity Framework.</li>
      <li>Microsoft Visual Studio 2008</li>
      <li>The Virtuoso RDF Mappers VAD package.</li>
      <li>
        <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9442b0f2-7465-417a-88f3-5e7b5409e9dd&amp;displaylang=en">Silverlight 3 Tools for Visual Studio 2008 SP1</a>.</li>
      <li>
        <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en">Microsoft .NET RIA Services July 2009 Preview</a>.</li>
    </ol>
    <br />
    
        <a name="installnetriaddcrser" />
    <h3>2.12.2. Creating the Application</h3>
<p>
      <strong>Step 1 - Create the Visual Studio Projects.</strong>
    </p>
<ol>
      <li>Open <strong>Visual Studio</strong> and create a new <strong>Silverlight Application</strong> project. Call the project DemoApplication.</li>
      <li>In the New Silverlight Application dialog ensure that <strong>Enable .NET RIA Services</strong> is checked. Click the <strong>OK</strong> button.
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria1.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.2.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
    </ol>
  <p>At this point a skeleton solution is created that consists of a client project called DemoApplication
and a server project called DemoApplication.Web. This application will use data from the Virtuoso database.
We add the data and its schema to the application by adding an ADO.NET entity data model to the server
project.</p>
<p>
      <strong>Step 2 -  Add the Data Model</strong>
    </p>
<ol>
      <li>Right click the server project in the <strong>Solution Explorer</strong> and
<strong>Add New Item</strong>. In the dialog box select <strong>ADO.NET Entity Data Model</strong>
and call it demo.edmx. Click the <strong>Add</strong> button. This will open the
<strong>Entity Data Model Wizard</strong>.</li>
      <li>Choose <strong>Generate From Database</strong> and click <strong>Next</strong>.</li>
      <li>Set up a connection to the Demo database on your local Virtuoso Server, select
<strong>Yes, include the sensitive data in the connection string</strong> and set the name of the
entities to DemoEntities. Click <strong>Next</strong>.</li>
      <li>On the <strong>Choose Your Database Objects</strong> page expand <strong>Tables</strong>
and select Employees. Check that the Model Namespace is DemoModel and click <strong>Finish</strong>.</li>
    </ol>
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td>
          <img alt=".NET RIA Services Application" src="../images/ui/ria2.png" />
     </td>
    </tr>
    <tr>
        <td>Figure: 2.12.2.1. .NET RIA Services Application</td>
    </tr>
    </table>
  <p>We want to make the entities in the model available to both the client and server parts of the
solution. To do this we need to add a DomainService to the solution. However, to make the entities from
the data model available to the domain service we must first build the solution.</p>
<p>
      <strong>Step 3 - Add a Domain Service.</strong>
    </p>
<ol>
      <li>First build the solution.</li>
      <li>Right click the server project in the <strong>Solution Explorer</strong> and
<strong>Add New Item</strong>. In the dialog box choose <strong>Domain Service Class</strong>
from the Templates pane and call it EmployeeService.cs. Click <strong>Add</strong>. This will open the
<strong>Add New Domain Service Class</strong> dialog.</li>
      <li>The entities from the model we have just added to the project are listed under
<strong>Entities</strong>. Tick the box next to Employees. and click OK.</li>
    </ol>
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td>
          <img alt=".NET RIA Services Application" src="../images/ui/ria3.png" />
     </td>
    </tr>
    <tr>
        <td>Figure: 2.12.2.2. .NET RIA Services Application</td>
    </tr>
    </table>
<p>This will create the DomainService class and generated code in both the client and server parts of
the application. The Silverlight client can now interact with the data through the DomainContext class
in the client project. At this point you need to build the solution again.
</p>
<p>
      <strong>Step 4 -  Display The Data</strong>
    </p>
<ol>
      <li>From the <strong>Silverlight XAML Controls</strong> in the <strong>Toolbox</strong>
drag a <strong>DataGrid</strong> between the &lt;Grid&gt; &lt;/Grid&gt; tags on MainPage.xaml in the client. Call the grid EmployeeGrid.
<div>
          <pre class="programlisting">
&lt;data:DataGrid Name=&quot;EmployeeGrid&quot;&gt;&lt;/data:DataGrid&gt;
</pre>
        </div>
</li>
      <li>Instantiate the DomainContext to get the list of employees and add them to the grid by
adding code to MainPage.xaml.cs so it looks like this:
<div>
          <pre class="programlisting">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DemoApplication.Web;
using System.Windows.Ria.Data;

namespace DemoApplication
{
    public partial class MainPage : UserControl
    {
        private EmployeeContext _employeeContext = new EmployeeContext();
        public MainPage()
        {
            InitializeComponent();
            LoadOperation&lt;Employees&gt; LoadOp =
                this._employeeContext.Load(this._employeeContext.GetEmployeesQuery());
            this.EmployeeGrid.ItemsSource = LoadOp.Entities;
        }
    }
}
</pre>
        </div>
</li>
      <li>Build and run the application. Internet Explorer will be launched and you will see the data
displayed on the page as a grid.
</li>
    </ol>
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td>
          <img alt=".NET RIA Services Application" src="../images/ui/ria4.png" />
     </td>
    </tr>
    <tr>
        <td>Figure: 2.12.2.3. .NET RIA Services Application</td>
    </tr>
    </table>
   <br />
   
     <a name="installnetriaddcrdf" />
    <h3>2.12.3. Displaying RDF Data</h3>
     <p>One advantage of using Virtuoso as the data store is the seamless way in which we can use
this use this application to display dereferencable IRIs and explore RDF linked data.
     </p>
     <p>The Virtuoso SPASQL interface allows RDF data in the Virtuoso Quad store to be queried
using SPARQL from any SQL interface by simply prefixing the SPARQL query with the keyword SPARQL.
We will use the SPASQL interface to create a view containing the IRIs of the Employees in the
the Demo RDF data in Virtuoso.
     </p>
<p>
      <strong>Step 1 -  Create the View in Virtuoso</strong>
    </p>
<ol>
      <li>Open the Virtuoso Conductor.</li>
      <li>In isql execute the following statement. Remember to use the appropriate hostname and port
number of your Virtuoso installation, typically localhost:8890 for a default installation or whatever
the <a href="sect5_ini_URIQA.html">URIQA DefaultHost</a> Virtuoso configuration parameter was set to when
the demo database VAD package was installed.
<div>
          <pre class="programlisting">
CREATE VIEW Demo.demo.sparqlview as
SPARQL
PREFIX nwind: &lt;http://demo.openlinksw.com/schemas/northwind#&gt;
SELECT DISTINCT  ?s
FROM &lt;http://demo.openlinksw.com/Northwind&gt;
WHERE
  {
    ?s a nwind:Employee
  }
</pre>
        </div>
</li>
    </ol>
<p>
      <strong>Step 2 -  Modify the Solution To use the View</strong>
    </p>
<ol>
      <li>Delete the existing Employee model and add a new one that comprises this new view.
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria5.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
      <li>Delete the DomainService. Build the solution and add a new DomainService called
EmployeeService. Select the sparqlview entity. Build the solution.
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria6.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
      <li>Modify the code in mainpage.xaml.cs so it uses the sparqview entity. It should look like this:
<div>
          <pre class="programlisting">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DemoApplication.Web;
using System.Windows.Ria.Data;

namespace DemoApplication
{
    public partial class MainPage : UserControl
    {
        private EmployeeContext _employeeContext = new EmployeeContext();
        public MainPage()
        {
            InitializeComponent();
            LoadOperation&lt;sparqlview&gt; LoadOp =
                this._employeeContext.Load(this._employeeContext.GetSparqlviewQuery());
            this.EmployeeGrid.ItemsSource = LoadOp.Entities;
        }
    }
}
</pre>
        </div>
</li>
      <li>Build and run the application. You will see a list of IRIs that identify the Northwind employees.
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria7.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
    </ol>
<p>To realize the power of linked data we would now liked to begin exploring this data by clicking on
these IRIs.</p>
<p>
      <strong>Step 3 - Make Hyperlinks From IRIs</strong>
    </p>
<ol>
      <li>Modify the DataGrid in MainPage.xaml to bind the IRI in each cell of the grid to a
Hyperlink button. We set the AutoGenerateColumns property of the DataGrid to False then add our
own Template for the column. MainPage.xaml should look like this:
<div>
          <pre class="programlisting">
&lt;UserControl xmlns:data=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data&quot;  x:Class=&quot;DemoApplication.MainPage&quot;
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot; xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
    mc:Ignorable=&quot;d&quot; d:DesignWidth=&quot;640&quot; d:DesignHeight=&quot;480&quot;&gt;
  &lt;Grid x:Name=&quot;LayoutRoot&quot;&gt;
      &lt;data:DataGrid Name=&quot;EmployeeGrid&quot; AutoGenerateColumns=&quot;False&quot;&gt;
            &lt;data:DataGrid.Columns&gt;
                &lt;data:DataGridTemplateColumn Header=&quot;Employee&quot;&gt;
                    &lt;data:DataGridTemplateColumn.CellTemplate&gt;
                        &lt;DataTemplate&gt;
                            &lt;StackPanel x:Name=&quot;DisplayEmployeeData&quot;
                                        Orientation=&quot;Horizontal&quot;
                                        VerticalAlignment=&quot;Bottom&quot;
                                        Margin=&quot;5&quot; &gt;
                                &lt;HyperlinkButton Content =&quot;{Binding s}&quot;
                                                 NavigateUri=&quot;{Binding s}&quot;
                                                 Margin=&quot;5,0,0,0&quot;
                                                 VerticalAlignment=&quot;Bottom&quot;
                                                 HorizontalAlignment=&quot;Left&quot;
                                                 FontSize=&quot;12&quot;&gt;
                                &lt;/HyperlinkButton&gt;
                            &lt;/StackPanel&gt;
                        &lt;/DataTemplate&gt;
                    &lt;/data:DataGridTemplateColumn.CellTemplate&gt;
                &lt;/data:DataGridTemplateColumn&gt;
            &lt;/data:DataGrid.Columns&gt;
        &lt;/data:DataGrid&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
        </div>
</li>
      <li>If we build and run the project now each IRI in the list appears as a hyperlink.
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria8.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
</li>
      <li>Clicking on each of the links takes you to a new document that contains further links
to information about each Employee. The Demo dataset can be explored further by following the
dereferenceable IRIs in the description pages.
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria9.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
    <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/ria10.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.12.3.2. .NET RIA Services Application</td>
      </tr>
        </table>
</li>
    </ol>
   <br />
   
     <a name="installnetriaddcnext" />
    <h3>2.12.4. Next Steps</h3>
     <p>The examples in this document show you how to simply display data in a browser using
Silverlight 3 and .NET RIA Services. See an <a href="installnetriavd.html">example</a> of a
more complicated application.</p>
   <br />
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="installsilver.html" title="Creating a Silverlight Application to consume the service">Previous</a>
          <br />Creating a Silverlight Application to consume the service</td>
     <td align="center" width="34%">
          <a href="installation.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="installnetriavd.html" title="Creating a .Net RIA Services Application That Will Update Virtuoso Data">Next</a>
          <br />Creating a .Net RIA Services Application That Will Update Virtuoso Data</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>