Sophie

Sophie

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

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="installvsent.html" title="Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application" />
  <link rel="next" href="installwfas.html" title="Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider" />
  <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="installusado" />
    <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="installvsent.html" title="Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application">Prev</a> | <a class="link" href="installwfas.html" title="Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider">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 class="selected">
      <a href="installusado.html">Using Visual Studio 2008 to Build an ADO.NET Data Services based Application</a>
    <div>
        <a href="#installusadointro" title="Introduction">Introduction</a>
        <a href="#installusadogetstart" title="Getting Started: Creating Data Services">Getting Started: Creating Data Services</a>
        <a href="#installusadocreateservice" title="Creating a Data Service using the ADO.NET Entity Framework">Creating a Data Service using the ADO.NET Entity Framework</a>
    </div>
   </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>
      <a href="installnetriadd.html">Creating A Simple .NET RIA Services Application To Display Data
From Virtuoso</a>
   </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="installusado" />
    <h2>2.8. Using Visual Studio 2008 to Build an ADO.NET Data Services based Application</h2>
    <div class="formalpara">
      <strong>Using Microsoft ADO.Net Data Services with Virtuoso</strong>
    </div>
    
      <a name="installusadointro" />
    <h3>2.8.1. Introduction</h3>
      <p>The goal of Microsoft ADO.NET Data Services is to enable applications to expose data as a
data service that can be consumed by web clients within corporate networks and across the internet. A data
service is reachable via regular HTTP requests, using standard HTTP verbs such as GET, POST, PUT and DELETE
to perform CRUD operations against the service. The payload format used by the service is controllable by the
application, but all options are simple, open formats such as JSON and Atom/APP.
      </p>
      <p>The use of web-friendly technologies make ADO.NET Data Services ideal as a data back-end
for AJAX-style applications, Rich Interactive Applications and other applications that need to operate
against data that is stored across the web.
      </p>
    <br />
    
      <a name="installusadogetstart" />
    <h3>2.8.2. Getting Started: Creating Data Services</h3>
      <p>
      <strong>Pre-requisites</strong>
    </p>
      <p>In order to create a data service using ADO.NET Data Services in your own environment you
will need Microsoft Visual Studio 2008 SP1. The ADO.NET Entity Framework runtime and associated tools are
included in Visual Studio 2008 SP1.
      </p>
      <p>
      <strong>Selecting a Data Source</strong>
    </p>
      <p>The ADO.NET Data Service server framework is comprised of two halves. The top-half is the
runtime itself; this part is &quot;fixed&quot;, and it implements URI translation, the Atom/JSON wire formats, the
interaction protocol, etc. This is what makes an ADO.NET Data Service look like an ADO.NET Data Service.
The bottom half is the data-access layer and is pluggable. Communication between layers happens in terms
of the IQueryable interface plus a set of conventions to map CLR graphs into the URI/payload patterns
of ADO.NET Data Services.
      </p>
      <p>The first step in creating an ADO.NET Data Service is to determine the data source that
is to be exposed as a set of REST-based endpoints (ie. select or create a data access layer). For relational
data stored in Microsoft SQL Server or other 3rd Party databases, ADO.NET Data Services currently enables
easily exposing a conceptual model created using the ADO.NET Entity Framework (EF). For all other data
sources (XML section, web service, application logic layer, etc) or to use additional database access
technologies (ex. LINQ to SQL), a mechanism is provided which enables any data source, as per the plug-in
model described above, to be exposed as an ADO.NET Data Service.
      </p>
      <p>To create a data service which exposes a relational database through an Entity Framework
conceptual model see &quot;Creating a Data Service using the ADO.NET Entity Framework&quot;. To create a data service
which exposes another data source see &quot;Creating a Data Service from any Data Source&quot;.
      </p>
    <br />
    
      <a name="installusadocreateservice" />
    <h3>2.8.3. Creating a Data Service using the ADO.NET Entity Framework</h3>
      <p>ADO.NET Data Services are a specialized form of Windows Communication Foundation services,
and thus can be hosted in various environments. The below example will create an ADO.NET Data Service which
is hosted inside an ASP.NET site. In order to create a data service, you must first create a web project;
you will then need to establish a connection with the database that will be exposed by the service, and
then create the data service itself within the web application. Below is a step-by-step description of
this process.
      </p>
      <p>The following steps can be used for creating a Data Service using the Virtuoso ADO.Net
Provider for accessing the sample Northwind Demo database:
      </p>
      <ol>
      <li>Launch the Visual Studio 2008 SP1 IDE.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Visual Studio 2008 SP1 IDE." src="../images/ui/dora1.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Visual Studio 2008 SP1 IDE.</td>
      </tr>
        </table>
        </li>
      <li>Create a <strong>Web Application</strong> project by going to the
<strong>File</strong> menu in Visual Studio and choosing <strong>New Project</strong>.
        </li>
      <li>When the New Project window appears, choose either <strong>Visual Basic</strong>
or <strong>Visual C#</strong> as the programming language.
        </li>
      <li>Within the language category click on <strong>Web</strong>, and select <strong>ASP.NET Web Application</strong> from the right-hand panel.
        </li>
      <li>Choose a name for the project, for example <strong>VirtuosoDataService</strong>, and click <strong>OK</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Name project" src="../images/ui/eora2.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Name project</td>
      </tr>
        </table>
        </li>
      <li>This will create a new project called <strong>VirtuosoDataService</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Create project" src="../images/ui/eora3.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Create project</td>
      </tr>
        </table>
        </li>
      <li>Right click on the <strong>VirtuosoDataService</strong> project name of the
Solution Explorer pane, then select the <strong>Add -&gt; New Item</strong> menu options.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="New Item" src="../images/ui/einf4.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. New Item</td>
      </tr>
        </table>
        </li>
      <li>The <strong>Add</strong> New Item dialog will appear, choose the
<strong>ADO.NET Entity Data Model</strong> template, give it the name <strong>Virtuoso.edmx</strong>
and click <strong>Add</strong> to start the creation of the ADO.Net Entity Data Model.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Entity Model" src="../images/ui/eora5.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Entity Model</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Entity Data Model Wizard</strong> dialog
<strong>Choose Model Contents</strong> page select the <strong>Generate from Database</strong> model
type and click <strong>Next</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Model Contents" src="../images/ui/eora6.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Model Contents</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Entity Data Model Wizard</strong> dialog
<strong>Choose your Data Connection</strong> page select the <strong>New Connection</strong> button
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Data Connection" src="../images/ui/ados7.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Data Connection</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Choose Data Source</strong> dialog, select the
OpenLink <strong>Virtuoso Data Source</strong> from the list displayed and click <strong>Continue</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Data Source" src="../images/ui/dora9.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Data Source</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Add Connection</strong> dialog, specify the
<strong>hostname, portno, username and password</strong> for the target Virtuoso Server and check the Save Password check box.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Connection Properties" src="../images/ui/dora10.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Connection Properties</td>
      </tr>
        </table>
        </li>
      <li>Select the <strong>Select Database From List</strong> radio button and choose
<strong>Demo</strong> from the drop down list, assuming the Virtuoso Demo Database is installed.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Advanced Properties" src="../images/ui/ados10.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Advanced Properties</td>
      </tr>
        </table>
        </li>
      <li>Click the <strong>Test Connection</strong> button to verify the connection is
successful and then click OK to add the connection.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Test Connection" src="../images/ui/ados11.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Test Connection</td>
      </tr>
        </table>
        </li>
      <li>Set the <strong>entity connect string</strong> name to
<strong>VirtuosoDemoEntities</strong> (note this name as it is required in step 17 below)
and click <strong>Next</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="entity connect string" src="../images/ui/ados12.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. entity connect string</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Choose your Database Objects</strong>
page select the <strong>Tables</strong> check box to select all tables in the Demo database for
addition to the Entity Data Model, set the <strong>Model Namespace</strong> to
<strong>VirtuosoDemoModel</strong> and click <strong>Finish</strong>.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Database Objects" src="../images/ui/ados13.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Database Objects</td>
      </tr>
        </table>
        </li>
      <li>The <strong>Virtuoso.edmx</strong> EDM will be created with the tables and relationships displayed in the Visual Studio IDE
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Virtuoso.edmx" src="../images/ui/ados14.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Virtuoso.edmx</td>
      </tr>
        </table>
        </li>
      <li>Right click on the <strong>VirtuosoDataService</strong> project name of the
<strong>Solution Explorer pane</strong>, then select the <strong>Add -&gt; New Item</strong> menu options.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="New Item" src="../images/ui/ados4.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. New Item</td>
      </tr>
        </table>
        </li>
      <li>The <strong>Add New Item</strong> dialog will appear, choose the
<strong>ADO.NET Data Service</strong> template, give it the name <strong>Virtuoso.svc</strong> and
click <strong>Add</strong> to create the ADO.Net Data Service.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="ADO.NET Data Service" src="../images/ui/ados15.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. ADO.NET Data Service</td>
      </tr>
        </table>
        </li>
      <li>In the <strong>Virtuoso.svc.cs</strong> Data Service file created add the
data source class name of <strong>VirtuosoDemoEntities</strong> (note this is the name set in step 12)
as the <strong>DataService</strong> name and enable the access to the Data Service by adding
the entry <strong>config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);</strong> in the
<strong>InitializeService</strong> method.
<div>
          <pre class="programlisting">
// C#

using System;
using System.Web;
using System.Collections.Generic;
using System.ServiceModel.Web;
using System.Linq;
using System.Data.Services;

namespace SimpleDataService
{
    public class Northwind : DataService&lt;VirtuosoDemoEntities&gt;
    {
        public static void InitializeService(IDataServiceConfiguration  config)
        {
            config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);
        }
    }
}
</pre>
        </div>
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Data Service" src="../images/ui/ados16.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Data Service</td>
      </tr>
        </table>
        </li>
      <li>To test the Data Service, simply hit <strong>Ctrl+F5</strong> within Visual Studio, which will start the development web server, run the Data Services server inside and load a Web browser page displaying the list of available tables/entities of the Demo database.
          <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="test the Data Service" src="../images/ui/ados17.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. test the Data Service</td>
      </tr>
        </table>
        </li>
      <li>To access a specific entity instance like the <strong>Customers</strong> table
<strong>ALFKI</strong> record, this would be specified as http://host/vdir/Virtuoso.svc/Customers(&#39;ALFKI&#39;) .
            <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt="Access a specific entity instance" src="../images/ui/ados18.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.8.3.1. Access a specific entity instance</td>
      </tr>
        </table>
         </li>
    </ol>
        <p>
      <strong>NOTES</strong>
    </p>
        <ol>
      <li>
        <strong>Important</strong> - To view <strong>Atom</strong> (the default
format returned by an ADO.NET Data Service) in Internet Explorer, you must first ensure that
<strong>Feed Reading View</strong> is turned <strong>off</strong>. This can be done on
the <strong>Content tab</strong> of <strong>Tools in Internet Options</strong>.
          </li>
      <li>If a Data Services entity instance URI page fails to load you can turn
<strong>Verbose</strong> errors on by adding <strong>config.UseVerboseErrors = true;</strong>
in the <strong>virtuoso.svc.cs InitializeService</strong> method to obtain more detailed
information from the server as to why the page failed to load:
<div>
          <pre class="programlisting">
public static void InitializeService(IDataServiceConfiguration config)

{

config.UseVerboseErrors = true;

config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);

}
</pre>
        </div>
          </li>
    </ol>
      <br />
  <table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="installvsent.html" title="Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application">Previous</a>
          <br />Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application</td>
     <td align="center" width="34%">
          <a href="installation.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="installwfas.html" title="Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider">Next</a>
          <br />Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider</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>