<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4419023952639712437</id><updated>2011-07-28T20:44:58.866-07:00</updated><category term='Semantics.SDK'/><category term='SPARQL'/><category term='Semantics.Datacenter'/><category term='Semantics.Server'/><category term='General'/><category term='API'/><category term='Releases'/><category term='News'/><category term='RdfEntity'/><category term='Getting Started'/><title type='text'>Semantics Web for the Microsoft .NET Framework</title><subtitle type='html'>For software developers interested in the creating applications based on Semantics Web standards (RDF, OWL, SPARQL) on Microsoft Windows using the Microsoft .NET Framework (C#) and Microsoft SQL Server.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>36</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-5312492638162928799</id><published>2010-10-11T07:29:00.001-07:00</published><updated>2010-10-11T07:29:48.319-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='API'/><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><title type='text'>Querying via a ClientModel</title><content type='html'>&lt;p&gt;The .NET API available in the &lt;a href="http://www.intellidimension.com/products/semantics-platform/"&gt;Semantics Platform&lt;/a&gt; allows an application to query one or more sources of data in a federated fashion using SPARQL. The data sources can be local in-memory graphs or remote graphs hosted on another server. The ClientModel class provides the primary interface for executing SPARQL queries.&lt;/p&gt;  &lt;p&gt;In this posting I will go through a simple example of how to use a ClientModel to query the contents of two RDF files. &lt;/p&gt;  &lt;p&gt;I will start by constructing two in-memory GraphDataSource objects. Each data source will be filled with the contents of a local RDF file.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;GraphDataSource &lt;/span&gt;dataGraph = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GraphDataSource&lt;/span&gt;();

&lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StreamReader &lt;/span&gt;r = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StreamReader&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;c:\\data.nt&amp;quot;&lt;/span&gt;))
    dataGraph.Read&amp;lt;&lt;span style="color: #2b91af"&gt;NTriplesReader&lt;/span&gt;&amp;gt;();

&lt;span style="color: #2b91af"&gt;GraphDataSource &lt;/span&gt;ontologyGraph = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GraphDataSource&lt;/span&gt;();

&lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StreamReader &lt;/span&gt;r = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StreamReader&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;c:\\ontology.nt&amp;quot;&lt;/span&gt;))
    ontologyGraph.Read&amp;lt;&lt;span style="color: #2b91af"&gt;NTriplesReader&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

&lt;p&gt;Next I construct the ClientModel object and add both of the graph object to the DataSources collection. Each data source added to a ClientModel must have a unique URI to identify it.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;ClientModel &lt;/span&gt;model = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClientModel&lt;/span&gt;();

model.DataSources[&lt;span style="color: #a31515"&gt;&amp;quot;http://example.org/data&amp;quot;&lt;/span&gt;] = dataGraph;
model.DataSources[&lt;span style="color: #a31515"&gt;&amp;quot;http://example.org/ontology&amp;quot;&lt;/span&gt;] = ontologyGraph;&lt;/pre&gt;

&lt;p&gt;As a convenience, I will define some namespaces on the ClientModel to make my SPARQL queries easier to write.&lt;/p&gt;

&lt;pre class="code"&gt;model.ParserOptions.Namespaces[&lt;span style="color: #a31515"&gt;&amp;quot;rdf&amp;quot;&lt;/span&gt;] = &lt;span style="color: #2b91af"&gt;NS&lt;/span&gt;.Rdf;
model.ParserOptions.Namespaces[&lt;span style="color: #a31515"&gt;&amp;quot;rdfs&amp;quot;&lt;/span&gt;] = &lt;span style="color: #2b91af"&gt;NS&lt;/span&gt;.Rdfs;
model.ParserOptions.Namespaces[&lt;span style="color: #a31515"&gt;&amp;quot;x&amp;quot;&lt;/span&gt;] = &lt;span style="color: #a31515"&gt;&amp;quot;http://example.org/&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;To execute the SPARQL query I simply call the Query method with a valid SPARQL query string. Note because I defined the namespaces on the ClientModel object I do not need to include them in the query using PREFIX statements.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Table &lt;/span&gt;results = model.Query(&lt;span style="color: #a31515"&gt;@&amp;quot;
    select ?label 
    from x:data 
    from x:ontology
    where {
        ?s rdf:type ?type; rdfs:label ?label.
        ?type rdfs:subClassOf x:Thing.
    }&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Finally I write the results of the query to the console window by iterating over the rows in the result table.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;TableRow &lt;/span&gt;row &lt;span style="color: blue"&gt;in &lt;/span&gt;results.GetRows())
    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(row[0].Value);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-5312492638162928799?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/5312492638162928799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/10/querying-via-clientmodel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5312492638162928799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5312492638162928799'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/10/querying-via-clientmodel.html' title='Querying via a ClientModel'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-3003659945390431746</id><published>2010-09-30T08:23:00.001-07:00</published><updated>2010-09-30T08:23:43.799-07:00</updated><title type='text'>Loading large data sets via the Jobs Framework</title><content type='html'>&lt;p&gt;The &lt;a href="http://www.intellidimension.com/products/semantics-datacenter/"&gt;Semantics.Datacenter&lt;/a&gt; Jobs Framework provides a powerful mechanism for processing and loading very large data sets into an RDF graph. For very large data sets it can be impractical to load all of the data into memory at once for processing. The solution the Jobs Framework provides is based on the following approach:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Breaking the input data files into a larger set of smaller files that can processed independently, as tasks, by the worker nodes in the Semantics.Datacenter cluster. &lt;/li&gt;    &lt;li&gt;Each task running on the worker nodes then combine a subset of these data files into a new set of files that provide the required date or serve as input into another processing step (repeat step #1). &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In the case of a typical data load job, it would look like:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Run multiple tasks to split the input data files into a smaller set of data files. These files may or may not be RDF data files. &lt;/li&gt;    &lt;li&gt;Run multiple tasks to process the data files from step #1. Each task would operate on a subset of the files produced in step #1. A task would produce RDF statements and write each statement to a file that is partitioned typically by subject. These files provide an efficient binary representation of the RDF statements and are referred to as &lt;strong&gt;shard files&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Run multiple tasks that each produce an in-memory graph partition file that is suitable for handling queries. Each task would gather the shard files that contain the RDF data for its respective partition an produce a partition file. &lt;/li&gt;    &lt;li&gt;(Optional) Run multiple tasks to compile each partition file into a read-only partition file. These files are much smaller than a writable partition file and therefore will consume less memory once loaded into a Semantics.Datacenter graph. This step can be skipped if a writable graph is desired. &lt;/li&gt;    &lt;li&gt;Run multiple tasks, one for each partition, to load the partition files into a Semantics.Datacenter hosted graph. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For more information on Semantics.Datacenter Partitioned In-Memory Graphs &lt;a href="http://semanticsdotnet.blogspot.com/2010/09/partitioned-in-memory-graphs.html"&gt;read this posting&lt;/a&gt;.    &lt;br /&gt;For more information on setting up a Semantics.Datacenter cluster &lt;a href="http://semanticsdotnet.blogspot.com/2010/09/introduction-to-semanticsdatacenter.html"&gt;read this posting&lt;/a&gt;.&lt;/p&gt;  &lt;h5&gt;Workflow Job&lt;/h5&gt;  &lt;p&gt;Semantics.Datacenter allows you to create jobs based on the Windows Workflow Foundation. Semantics.Datacenter includes a set of pre-build Workflow Activities that can be used to load your data. You can also create your own Workflow Activities using C# if you require some custom processing that is part of the data load or create your own Job type that is not based on Windows Workflows. In this article I will focus on the Workflow Job using our standard Activities.&lt;/p&gt;  &lt;h5&gt;Job Workspace&lt;/h5&gt;  &lt;p&gt;A data load job requires a set of directories that can be used by the tasks for processing data. Before creating your Workflow you should figure out this structure. The table below describes the directory structure I will use for my job.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="737"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="289"&gt;&lt;strong&gt;Directory&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="446"&gt;&lt;strong&gt;Contents&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="289"&gt;c:\job\rdf&lt;/td&gt;        &lt;td valign="top" width="446"&gt;The input RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="289"&gt;c:\job\rdf\split&lt;/td&gt;        &lt;td valign="top" width="446"&gt;The split set of RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="289"&gt;c:\job\parts\shards&lt;/td&gt;        &lt;td valign="top" width="446"&gt;The shard files resulting from parsing the RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="289"&gt;c:\job\parts&lt;/td&gt;        &lt;td valign="top" width="446"&gt;The partition files generated from the shard files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="289"&gt;c:\job\parts\ro&lt;/td&gt;        &lt;td valign="top" width="446"&gt;The read-only partition files compiled from the writable partition files.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;Creating the Workflow Job&lt;/h5&gt;  &lt;p align="left"&gt;The Workflow Job can be created using the Model Manager. Connect to the Semantics.Datacenter cluster coordinator server and select the “Create…” option from the Jobs context menu in the tree control. This will display the Workflow Job designer where Activities can be added and configured to a Workflow Job. To add an Activity simply select one from the list and drag it into the workflow. Select the Activity in the workflow to display its property page where the activity is configured.&lt;/p&gt;  &lt;p align="left"&gt;&lt;a href="http://lh6.ggpht.com/_5sWjxnF5L7Y/TKSrfQd8O1I/AAAAAAAAADQ/uRR3uflxFXI/s1600-h/image3.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_5sWjxnF5L7Y/TKSrf28qRZI/AAAAAAAAADU/dE5UL-TYOmo/image_thumb1.png?imgmax=800" width="240" height="132" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="left"&gt;The following sections will describe the Activities I added to my Workflow Job in the order that they will be executed.&lt;/p&gt;  &lt;h5&gt;&lt;/h5&gt;  &lt;h5&gt;SplitFilesActivity&lt;/h5&gt;  &lt;p&gt;The SplitFilesActivity will split all the RDF files in a directory into a set of smaller files. The table below lists the settings for this activity.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="154"&gt;&lt;strong&gt;Property&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="228"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="424"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="228"&gt;SplitFiles&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The name of the activity instance.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;InputDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;c:\job\rdf &lt;/td&gt;        &lt;td valign="top" width="424"&gt;The directory containing the input RDF files&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;c:\job\rdf\split&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The output directory containing the split RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;NumLines&lt;/td&gt;        &lt;td valign="top" width="228"&gt;50000&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The maximum number of statements allowed in an output file.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;ParseType&lt;/td&gt;        &lt;td valign="top" width="228"&gt;NTriples&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The format of the input RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;OverwriteDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;True&lt;/td&gt;        &lt;td valign="top" width="424"&gt;Deletes the contents of the output directory before processing the input.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;ParseFileActivity&lt;/h5&gt;  &lt;p&gt;The ParseFilesActivity will parse all the RDF files in a directory into a set of shard files that contain a binary representation of the RDF statements. The table below lists the settings for this activity.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="154"&gt;&lt;strong&gt;Property&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="228"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="424"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="228"&gt;ParseFiles&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The name of the activity instance.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;InputDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;SplitFiles.OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The directory containing the input RDF files&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;c:\job\parts\shards&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The output directory containing the shard files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;NumLines&lt;/td&gt;        &lt;td valign="top" width="228"&gt;50000&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The maximum number of statements allowed in an output file.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;ParseType&lt;/td&gt;        &lt;td valign="top" width="228"&gt;NTriples&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The format of the input RDF files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;OverwriteDirectory&lt;/td&gt;        &lt;td valign="top" width="228"&gt;True&lt;/td&gt;        &lt;td valign="top" width="424"&gt;Deletes the contents of the output directory before processing the input.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;BatchSize&lt;/td&gt;        &lt;td valign="top" width="228"&gt;10&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The maximum number of input files to be processed by a single task.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;PartitionCount&lt;/td&gt;        &lt;td valign="top" width="228"&gt;16&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The number of partition files that can be created from the output shard files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="154"&gt;IgnoreParseErrors&lt;/td&gt;        &lt;td valign="top" width="228"&gt;False&lt;/td&gt;        &lt;td valign="top" width="424"&gt;If set to True any parse errors will be ignored and processing will continue.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;LoadPartitionsActivity&lt;/h5&gt;  &lt;p&gt;The LoadPartitionsActivity will load all of the shard files into a set of graph partition files. The table below lists the settings for this activity.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="193"&gt;&lt;strong&gt;Property&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="189"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="424"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="189"&gt;CreatePartitions&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The name of the activity instance.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;InputDirectory&lt;/td&gt;        &lt;td valign="top" width="189"&gt;ParseFiles.OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The directory containing the input shard files&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="189"&gt;c:\job\parts&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The output directory containing the partition files.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;Arity&lt;/td&gt;        &lt;td valign="top" width="189"&gt;3&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The arity of the graph (3=triples, 4=quads)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;IncludeCaseInsensitiveIndex&lt;/td&gt;        &lt;td valign="top" width="189"&gt;False&lt;/td&gt;        &lt;td valign="top" width="424"&gt;If True, a case-insensitive index is created&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;IncludeFullTextIndex&lt;/td&gt;        &lt;td valign="top" width="189"&gt;False&lt;/td&gt;        &lt;td valign="top" width="424"&gt;If True, a full-text index is created&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="193"&gt;PartitionCount&lt;/td&gt;        &lt;td valign="top" width="189"&gt;ParseFiles.PartitionCount&lt;/td&gt;        &lt;td valign="top" width="424"&gt;The number of partition files that will be created from the shard files.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;CompilePartitionsActivity&lt;/h5&gt;  &lt;p&gt;The CompilePartitionsActivity will compile a set of writable partition files into a set of read-only partition files.The table below lists the settings for this activity.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="144"&gt;&lt;strong&gt;Property&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="246"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="416"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="246"&gt;CreateReadOnly&lt;/td&gt;        &lt;td valign="top" width="416"&gt;The name of the activity instance.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;InputDirectory&lt;/td&gt;        &lt;td valign="top" width="246"&gt;CreatePartitions.OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="416"&gt;The directory containing the writable partition files&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="246"&gt;c:\job\parts\ro&lt;/td&gt;        &lt;td valign="top" width="416"&gt;The output directory containing the read-only partition files.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;LoadGraphPartitionsActivity&lt;/h5&gt;  &lt;p&gt;The LoadGraphPartitionsActivity will load a set of partition files into a Semantics.Datacenter hosted graph. The graph must exist otherwise the CreateGraphActivity should be used prior to this activity to create it. The table below lists the settings for this activity.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="144"&gt;&lt;strong&gt;Property&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="295"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="367"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="295"&gt;LoadGraph&lt;/td&gt;        &lt;td valign="top" width="367"&gt;The name of the activity instance.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;InputDirectory&lt;/td&gt;        &lt;td valign="top" width="295"&gt;CreateReadOnly.OutputDirectory&lt;/td&gt;        &lt;td valign="top" width="367"&gt;The directory containing the partition files&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;ConnectionString&lt;/td&gt;        &lt;td valign="top" width="295"&gt;net.tcp://host:7055/DataService&lt;/td&gt;        &lt;td valign="top" width="367"&gt;The connection string to the Semantics.Datacenter server that is hosting the graph to be loaded.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="144"&gt;GraphUri&lt;/td&gt;        &lt;td valign="top" width="295"&gt;http://example.org/data&lt;/td&gt;        &lt;td valign="top" width="367"&gt;The URI of the graph.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;Save and Run&lt;/h5&gt;  &lt;p&gt;After creating the Workflow Job you should save it to a file so it can be used again, especially if your job fails for some reason. This is done by clicking on the “Save…” button and choosing a file name. Then click on “OK” button on the Workflow Job designer and to submit the job to the job queue where its tasks will be processed by one or more worker nodes in the Semantics.Datacenter cluster. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-3003659945390431746?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/3003659945390431746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/loading-large-data-sets-via-jobs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3003659945390431746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3003659945390431746'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/loading-large-data-sets-via-jobs.html' title='Loading large data sets via the Jobs Framework'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_5sWjxnF5L7Y/TKSrf28qRZI/AAAAAAAAADU/dE5UL-TYOmo/s72-c/image_thumb1.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-1965460202943923772</id><published>2010-09-29T11:21:00.001-07:00</published><updated>2010-09-29T11:21:01.486-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Releases'/><title type='text'>Semantics Platform v2.0 Maintenance Release Available.</title><content type='html'>&lt;p&gt;&lt;em&gt;(September 29, 2010)&lt;/em&gt; A maintenance release of the &lt;a href="http://www.intellidimension.com/products/semantics-platform/"&gt;Semantics Platform&lt;/a&gt; v2.0.1.4 is now available for download from the Intellidimension web site at:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.intellidimension.com/downloads/" href="http://www.intellidimension.com/downloads/"&gt;http://www.intellidimension.com/downloads/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This release includes the following updates:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Fixed issue with range constraints in read-only in-memory graphs.&lt;/li&gt;    &lt;li&gt;Fixes to SPARQL query compiler.&lt;/li&gt;    &lt;li&gt;Query engine optimizations.&lt;/li&gt;    &lt;li&gt;Resolved issue with compilation of free-text expression that include Unicode characters.&lt;/li&gt;    &lt;li&gt;Enhancements to build in workflow tasks in the Semantics.Datacenter Job Framework.&lt;/li&gt;    &lt;li&gt;Improvements to job workflow editor in Model Manager.&lt;/li&gt;    &lt;li&gt;Other minor bug fixes&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-1965460202943923772?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/1965460202943923772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/semantics-platform-v20-maintenance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/1965460202943923772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/1965460202943923772'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/semantics-platform-v20-maintenance.html' title='Semantics Platform v2.0 Maintenance Release Available.'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-4179042015282645131</id><published>2010-09-27T05:09:00.001-07:00</published><updated>2010-09-30T08:24:34.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.Datacenter'/><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><title type='text'>Partitioned In-Memory Graphs</title><content type='html'>&lt;p&gt;The &lt;a href="http://www.intellidimension.com/products/semantics-platform"&gt;Semantics Platform&lt;/a&gt; supports partitioned in-memory graphs for storing and querying RDF data. These graphs use an extremely compact indexing format that minimizes the system memory required. As the name implies, the data in the graph can be partitioned to allow parallel read and write access to the data. This parallel access can greatly improve query execution times. Partitioned in-memory graphs manage all their data within the memory space of a single computer process. This is in contrast to a distributed graph which can manage RDF data in multiple processes on multiple machines (&lt;em&gt;I will discuss these is another post).&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;A writable partitioned in-memory graph can compiled into a read-only form that requires even less memory to hold the same amount of data. &lt;/p&gt;  &lt;p&gt;In the case of &lt;a href="http://www.intellidimension.com/products/semantics-datacenter/"&gt;Semantics.Datacenter&lt;/a&gt;, partitioned in-memory graphs are backed by files, with support for journaling, to provide persistent storage of RDF data. Each partition in graph is storage in a separate file. This enables parallel read/write access to the data in the graph and vastly improves data load times.&lt;/p&gt;  &lt;h5&gt;Creating a Partitioned In-Memory Graph&lt;/h5&gt;  &lt;p&gt;Using the Model Manager you can create a partitioned in-memory graph in local client model or on a running instance of a Semantics.Datacenter server. The image below shows the screen for creating a graph on Semantics.Datacenter. The graph can be configured to store either triples or quads and also supports full-text indexing.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/_5sWjxnF5L7Y/TKCJYjo51YI/AAAAAAAAADI/BJ8v7Xc8e1M/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_5sWjxnF5L7Y/TKCJY9Dg7VI/AAAAAAAAADM/74G2C32-1EI/image_thumb%5B3%5D.png?imgmax=800" width="240" height="99" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h5&gt;Loading a Partitioned In-Memory Graph&lt;/h5&gt;  &lt;p align="left"&gt;In a previous posting I discussed how to load data into a partitioned in-memory graph hosted in a local client model using the Model Manger (see &lt;a href="http://semanticsdotnet.blogspot.com/2010/09/working-with-large-rdf-files-in-model.html"&gt;Working with large RDF files in the Model Manager&lt;/a&gt;). However in the case of a graph hosted by Semantics.Datacenter this is accomplished much more efficiently by using the Semantics.Datacenter Jobs Framework. The Jobs Framework allows you partition the data load process into a set of tasks that can be run in parallel which often requires much less memory. I will discuss this process in &lt;a href="http://semanticsdotnet.blogspot.com/2010/09/loading-large-data-sets-via-jobs.html"&gt;another post&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-4179042015282645131?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/4179042015282645131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/partitioned-in-memory-graphs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/4179042015282645131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/4179042015282645131'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/partitioned-in-memory-graphs.html' title='Partitioned In-Memory Graphs'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_5sWjxnF5L7Y/TKCJY9Dg7VI/AAAAAAAAADM/74G2C32-1EI/s72-c/image_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-1794388724692970129</id><published>2010-09-23T06:32:00.001-07:00</published><updated>2010-09-23T09:17:13.518-07:00</updated><title type='text'>An introduction to Semantics.Datacenter clusters</title><content type='html'>&lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-datacenter/"&gt;Semantics.Datacenter&lt;/a&gt; is based on Intellidimension’s proprietary distributed graph store called IMDB. Semantics.Datacenter is deployed in a clustered configuration. A Semantics.Datacenter cluster is a set of network addressable services (“servers”) based on WCF that can be running one or more computers. A cluster must have one coordinator server and one or more worker servers. A cluster also requires a shared directory that is accessible by all servers in the cluster for both reading and writing files. If the cluster is deployed on multiple computers the shared directory must be on a networked storage device. The coordinator and worker nodes can be deployed to a single computer using a local file system directory.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh3.ggpht.com/_5sWjxnF5L7Y/TJtW4ngdQjI/AAAAAAAAAC4/Q-sHeBw-TNs/s1600-h/image%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_5sWjxnF5L7Y/TJtW5M28nkI/AAAAAAAAAC8/3iZUpCCuQ8Y/image_thumb%5B2%5D.png?imgmax=800" width="240" height="157" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The coordinator server manages all the activities for the cluster and is generally not used for application data storage or processing. The coordinator server manages the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Job Queue &lt;/li&gt;    &lt;li&gt;Server failover &lt;/li&gt;    &lt;li&gt;Replication Coordination &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The worker servers in the cluster are responsible for providing the bulk of the services for an application such as:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Hosting of Graphs &lt;/li&gt;    &lt;li&gt;Execution of Tasks (a unit of work in a Job) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Deploying a cluster involves deciding on the hardware resources that you wish to use. This includes the physical computers as well as any network storage that will be required. Each server in the cluster will also require its own network address and the cluster coordinator network address must be reachable by all the worker servers in the cluster.&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;Step 1: Install Semantics.Datacenter      &lt;br /&gt;&lt;/strong&gt;The first step is to install the product on each computer that will be used in the cluster.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Step 2: Install a Coordinator Server      &lt;br /&gt;&lt;/strong&gt;Launch the IMDB Setup utility on the computer that will be hosting the coordinator server. From the main screen select the option to “Add a new server” followed by the option to install “A coordinator node in a new cluster”.&amp;#160; Follow the steps on the rest of the screens that will prompt you for a network address and the location of the shared directory for the cluster.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_5sWjxnF5L7Y/TJtW5XzPX5I/AAAAAAAAADA/UOlkJ8dolQQ/s1600-h/image%5B10%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_5sWjxnF5L7Y/TJtW6H-YpkI/AAAAAAAAADE/WOhdGkLSM38/image_thumb%5B4%5D.png?imgmax=800" width="240" height="196" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Step 3: Install the Worker Server(s)      &lt;br /&gt;&lt;/strong&gt;For each worker server on each computer repeat Step 2 except on the second screen select the option to install “A worker node in an existing cluster”. In order to complete the installation you will be required to provide the network address of coordination server.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Next Steps      &lt;br /&gt;&lt;/strong&gt;Now that the cluster is up and running you will need to configure it for your application. This configuration will vary significantly from application to application and often requires a large amount of testing and tuning to get right depending on the application. I will address several of these topics in future postings, including:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Graph Partitioning &lt;/li&gt;    &lt;li&gt;Distributed Graphs &lt;/li&gt;    &lt;li&gt;Data Replication &lt;/li&gt;    &lt;li&gt;SQL Server Replication &lt;/li&gt;    &lt;li&gt;Data Load Jobs &lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-1794388724692970129?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/1794388724692970129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/introduction-to-semanticsdatacenter.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/1794388724692970129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/1794388724692970129'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/introduction-to-semanticsdatacenter.html' title='An introduction to Semantics.Datacenter clusters'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_5sWjxnF5L7Y/TJtW5M28nkI/AAAAAAAAAC8/3iZUpCCuQ8Y/s72-c/image_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-6034431134176233967</id><published>2010-09-15T05:02:00.001-07:00</published><updated>2010-09-15T05:05:23.715-07:00</updated><title type='text'>Working with large RDF files in the Model Manager</title><content type='html'>&lt;p&gt;Often it is necessary to load and query a large RDF file to understand the data you are working with. The Model Manager is a good tool for this but has some limitations that I will describe in this posting.&lt;/p&gt;  &lt;p&gt;In-Memory Graphs are intended to be used for short term storage of RDF data for performing some application processing. They are not intended to be used as a persistent store of RDF data. In the case of the Model Manger, any data imported into an In-Memory graph is stored in the project file. A Model Manager project file is primarily for storing the configuration of a model. It is not very good at all for storing large amounts of RDF data. Meaning it is not a database. &lt;/p&gt;  &lt;p&gt;We have two database products that are very good at storing large amounts of RDF data. These products are called Semantics.Server and Semantics.Datacenter. &lt;/p&gt;  &lt;p&gt;The links below provide information about both of these products. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-server/"&gt;http://www.intellidimension.com/products/semantics-server/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-datacenter/"&gt;http://www.intellidimension.com/products/semantics-datacenter/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We have two instructional videos that show how to setup, load and query RDF data using each (see links below).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/developers/videos/v2.aspx"&gt;http://www.intellidimension.com/developers/videos/v2.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/developers/videos/v3.aspx"&gt;http://www.intellidimension.com/developers/videos/v3.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you do not want to use one of our database server products. There is a more efficient way to work with large RDF data files using In-Memory graphs in the Model Manager. You can &amp;quot;Import&amp;quot; a RDF file into an In-Memory graph but then save it as an image file. This is done by creating an image file or read-only image file from the menu on the In-Memory graph. These files have a very compact storage format and can be loaded much more quickly than parsing an RDF file via the import menu. If you don't not intend on modifying any of the data I suggest you use read-only image file. &lt;/p&gt;  &lt;p&gt;Now here is the IMPORTANT step. Drop the graph before saving your project so its contents are not saved to the project file. We are working on a better solution for this that will be available in a future release. &lt;/p&gt;  &lt;p&gt;When you open your project file next time in the Model Manager. Just create a new In-Memory graph and load the image file using the menu on that graph. This will load much faster than an RDF file because it does not need to parse the file and it can be read directly into memory. Of coarse you will still need enough memory on you local machine to hold the entire contents of the image file but this will be less than the memory that is needed to parse the RDF file or load the data from the Model Manager project file.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-6034431134176233967?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/6034431134176233967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/working-with-large-rdf-files-in-model.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6034431134176233967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6034431134176233967'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/working-with-large-rdf-files-in-model.html' title='Working with large RDF files in the Model Manager'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-3230777981759863249</id><published>2010-09-14T10:09:00.001-07:00</published><updated>2010-09-14T10:15:33.375-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='API'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Registering Custom SPARQL Functions</title><content type='html'>&lt;p&gt;The Semantics Platform allows custom SPARQL functions to be registered with a client model. Once a function has been registered it can be used in a SPARQL query using the URI it was registered with. A custom SPARQL function can be implemented as a static method on a .NET class that has the proper delegate type. The Semantics Platform enables all the custom SPARQL functions in an assembly to be loaded provided they are declared with the proper attributes. &lt;/p&gt;  &lt;p&gt;The example below shows a custom SPARQL function implemented in C# that supports the delegate type (ClientFunctionCall). The function calculates the area of a circle based on a single argument that represents the radius. The function checks that the proper number of arguments are provided. It calculates the area and returns it as the result argument. If the function is called with a result argument set to a value then it must be compared to the calculated area to see if the expression evaluates to true. The function should return false if the function fails to generate a value or the comparison fails.&lt;/p&gt;  &lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ClientFunctionAttribute&lt;/span&gt;(
    &lt;span style="color: #a31515"&gt;&amp;quot;http://example.org/fn/areaOfCircle&amp;quot;&lt;/span&gt;, 
    &lt;span style="color: #a31515"&gt;&amp;quot;[bf]b&amp;quot;&lt;/span&gt;, 
    Deterministic=&lt;span style="color: blue"&gt;true&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public static bool &lt;/span&gt;AreaOfCircleFunction(
    &lt;span style="color: #2b91af"&gt;FunctionCallParams &lt;/span&gt;funcParams)
{
    &lt;span style="color: #2b91af"&gt;TableRow &lt;/span&gt;funcArgValues = funcParams.ArgRow;

    &lt;span style="color: green"&gt;// Make sure we have exactly 2 arguments in 
    // our arguments collection.
    //
    // index 0: The result value
    // index 1: The radius
    &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(funcArgValues.Count == 2 &amp;amp;&amp;amp; 
        funcArgValues[1] != &lt;span style="color: blue"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; 
        funcArgValues[1] &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RdfLiteral &lt;/span&gt;&amp;amp;&amp;amp; 
        ((&lt;span style="color: #2b91af"&gt;RdfLiteral&lt;/span&gt;)funcArgValues[1]).IsNumeric)
    {
        &lt;span style="color: green"&gt;// A = PI * R^2
        &lt;/span&gt;&lt;span style="color: blue"&gt;double &lt;/span&gt;area = &lt;span style="color: #2b91af"&gt;Math&lt;/span&gt;.PI * &lt;span style="color: #2b91af"&gt;Math&lt;/span&gt;.Pow(
            (&lt;span style="color: blue"&gt;double&lt;/span&gt;)(&lt;span style="color: #2b91af"&gt;RdfLiteral&lt;/span&gt;)funcArgValues[1], 2);

        &lt;span style="color: #2b91af"&gt;RdfLiteral &lt;/span&gt;resultValue = area;

        &lt;span style="color: green"&gt;// If a result value was provided (index 0) 
        // then test for equality.
        &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;RdfValue&lt;/span&gt;.IsNull(funcArgValues[0]) || 
            funcArgValues[0] == resultValue)
        {
            funcArgValues[0] = resultValue;
            &lt;span style="color: blue"&gt;return true&lt;/span&gt;;
        }
    }

    &lt;span style="color: blue"&gt;return false&lt;/span&gt;; &lt;span style="color: green"&gt;//evaluated as false
&lt;/span&gt;}&lt;/pre&gt;

&lt;p&gt;Notice, the method is declared with an attribute called ClientFunctionAttribute. This attribute requires a URI to identify the SPARQL function and a binding pattern. A binding pattern is a form of a regular express where ‘b’ represents a bound argument and ‘f’ represents an unbound argument (aka free). In the example above the binding pattern ‘[bf]b’ indicates the result argument can be bound or free and the first argument must be bound. The method attribute is also sets the property Deterministic to true to indicate it is a deterministic function.&lt;/p&gt;

&lt;p&gt;One way to register the custom SPARQL function is using the Model Manager. Open a model, new or existing, and right click on the Functions folder to display the menu and select ‘Load Assembly…’. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/_5sWjxnF5L7Y/TI-sPtH8nmI/AAAAAAAAACo/uTXrlpmlBWs/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_5sWjxnF5L7Y/TI-sP7DKa_I/AAAAAAAAACs/JE-BUp-J7Ts/image_thumb.png?imgmax=800" width="244" height="168" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will display the dialog box shown above. Simply browse and select the assembly file that contains the custom SPARQL function(s). The dialog will display all the methods found in the assembly that are declared with the proper attribute and delegate type. You may select specific SPARQL functions to load or just load them all.&lt;/p&gt;

&lt;p&gt;Once loaded they may be used in a SPARQL query using the Model Manager query window as shown below. The function is called using the URI it was registered with.&lt;/p&gt;

&lt;p align="center"&gt;&lt;a href="http://lh6.ggpht.com/_5sWjxnF5L7Y/TI-sQQLRQtI/AAAAAAAAACw/tn9FsTFX3nE/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_5sWjxnF5L7Y/TI-sQvhvG5I/AAAAAAAAAC0/gGLUtfs2Fi0/image_thumb%5B1%5D.png?imgmax=800" width="244" height="93" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The custom functions assembly can also be loaded via the Semantics Platform .NET API using the helper class ClientFunctionLoader. This class will create the required class for registering a SPARQL function with an instance of a ClientModel. The C# code below provides and example of its use.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;ClientModel &lt;/span&gt;model = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClientModel&lt;/span&gt;();

&lt;span style="color: #2b91af"&gt;ClientFunctionLoader &lt;/span&gt;loader = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClientFunctionLoader&lt;/span&gt;(
    &lt;span style="color: #a31515"&gt;&amp;quot;c:\\SPARQL\\CustomFunctions.dll&amp;quot;&lt;/span&gt;);

&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;RdfUri &lt;/span&gt;uri &lt;span style="color: blue"&gt;in &lt;/span&gt;loader.FunctionUris)
{
    model.RegisterFunction(uri, loader.CreateFunction(uri));
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;This is the easiest way to register a custom SPARQL function.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-3230777981759863249?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/3230777981759863249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/registering-custom-sparql-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3230777981759863249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3230777981759863249'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/09/registering-custom-sparql-functions.html' title='Registering Custom SPARQL Functions'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_5sWjxnF5L7Y/TI-sP7DKa_I/AAAAAAAAACs/JE-BUp-J7Ts/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-6964183381845796951</id><published>2010-06-07T04:47:00.001-07:00</published><updated>2010-06-07T04:47:03.997-07:00</updated><title type='text'>Semantics Platform v2.0 Released: Semantic Web technology for Windows, RDF Libraries for .NET/C# and SPARQL on SQL Server.</title><content type='html'>&lt;p&gt;Intellidimension has released Semantics Platform v2.0 that provides the most comprehensive set of Semantic Web technology for Microsoft Windows, the .NET Framework (C#) and SQL Server. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-platform/"&gt;http://www.intellidimension.com/products/semantics-platform/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Semantics Platform is a family of products that includes:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Semantics.Datacenter&lt;/strong&gt; a distributed RDF data store that allows both graphs and processing jobs to be partitioned over a cluster of servers. It supports both distributed SPARQL query and inference rule execution. Semantics.Datacenter also contains a library of built-in jobs that can be extended using C#. Jobs are configured using a simple workflow editor and when executed they can leverage the parallel processing capabilities of the cluster. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-datacenter/"&gt;http://www.intellidimension.com/products/semantics-datacenter/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Semantics.Server&lt;/strong&gt; continues to provide a robust option for storing RDF data within SQL Server along with allowing SQL Server to execute SPARQL queries and inference rules.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-server/"&gt;http://www.intellidimension.com/products/semantics-server/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Semantics.Framework Express Edition&lt;/strong&gt; is all the core RDF libraries used in the Semantics Platform that are free for use. C# programmers can use these .NET libraries to load and store RDF data along with perform complex SPARQL and inference rule processing. The Express Edition also includes visual tools for working with RDF files and testing SPARQL queries and inference rules.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-framework/"&gt;http://www.intellidimension.com/products/semantics-framework/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Semantics.Developer&lt;/strong&gt; provides developers with full access to all the technology in the Semantics Platform in a cost-effective manner. A free 60-day evaluation is available for this product.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/products/semantics-developer/"&gt;http://www.intellidimension.com/products/semantics-developer/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-6964183381845796951?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/6964183381845796951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/06/semantics-platform-v20-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6964183381845796951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6964183381845796951'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/06/semantics-platform-v20-released.html' title='Semantics Platform v2.0 Released: Semantic Web technology for Windows, RDF Libraries for .NET/C# and SPARQL on SQL Server.'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-5414982706921761084</id><published>2010-05-03T13:45:00.001-07:00</published><updated>2010-05-03T13:45:28.659-07:00</updated><title type='text'>Semantics Platform 2.0 (Beta) Released</title><content type='html'>&lt;p&gt;Intellidimension has just released the Semantics Platform 2.0 Beta for free download and evaluation. The Semantics Platform 2.0 includes the following improvements:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A new highly-scalable in-memory graph database (IMDB). IMDB provides a scale-out strategy with parallel query execution and failover recovery. IMDB is included in a new product call Semantics.Datacenter.&lt;/li&gt;    &lt;li&gt;Significant improvements to query plan, compilation and execution for SPARQL queries and inference rules.&lt;/li&gt;    &lt;li&gt;Numerous enhancements to Model Manager including new multiple file project format.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Visit the following URL for more information about the Semantics Platform 2.0:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.intellidimension.com/products/semantics-platform/" href="http://www.intellidimension.com/products/semantics-platform/"&gt;http://www.intellidimension.com/products/semantics-platform/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Check out our new online video library for product overviews and tutorials:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.intellidimension.com/developers/videos/" href="http://www.intellidimension.com/developers/videos/"&gt;http://www.intellidimension.com/developers/videos/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-5414982706921761084?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/5414982706921761084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/05/semantics-platform-20-beta-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5414982706921761084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5414982706921761084'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/05/semantics-platform-20-beta-released.html' title='Semantics Platform 2.0 (Beta) Released'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2836588961192906359</id><published>2010-02-05T08:24:00.001-08:00</published><updated>2010-02-08T13:25:18.958-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Querying for intersections between sets.</title><content type='html'>&lt;p&gt;A SPARQL query is often needed to find the intersection between sets in a data model. This article provides a simple example based on landmarks and regions. In this data model a landmark belongs to a region and regions can belong to other regions creating a hierarchical collection of sets. The goal is to find the common regions for all landmarks. The trick is we want the best match for the region. For example Boston Common and Fenway Park are both located in Boston; therefore, we do not want to return results showing regions that contain Boston such as Massachusetts, United States of America or North America.&lt;/p&gt;  &lt;p&gt;The SPARQL query below uses a rule to generate some data for the examples. It uses a couple of other rules to recursively generation all the containment relationships for the regions. The query itself uses negation to eliminate results that have a region that contains another region for the same two landmarks.&lt;/p&gt;  &lt;p style="font-family: courier; font-size: 12px"&gt;&lt;font size="1"&gt;&lt;span style="color: #0000ff"&gt;prefix&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;&amp;lt;http://example.org/&amp;gt;&lt;/span&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;span style="color: #0000ff"&gt;rulebase&lt;/span&gt; (      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;# generate some facts for our example       &lt;br /&gt;&lt;/span&gt;&amp;#160;&lt;span style="color: #0000ff"&gt;construct&lt;/span&gt; {      &lt;br /&gt;&amp;#160;&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;# places       &lt;br /&gt;&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Boston&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Massachusetts&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Massachusetts&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:UnitedStatesOfAmerica&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:UnitedStatesOfAmerica&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:NorthAmerica&lt;/span&gt;.&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Boston&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Massachusetts&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Paris&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:France&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:France&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Europe&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Toronto&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Ontario&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Ontario&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Canada&lt;/span&gt;.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Canada&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:NorthAmerica&lt;/span&gt;.      &lt;br /&gt;&amp;#160; &lt;br /&gt;&amp;#160;&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;#landmarks       &lt;br /&gt;&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:BostonCommon&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Boston&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:FenwayPark&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Boston&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:EiffelTower&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Paris&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:CNTower&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:Toronto&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:MississippiRiver&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:UnitedStatesOfAmerica&lt;/span&gt;.      &lt;br /&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:GreatLakes&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:HasLocation&lt;/span&gt;&amp;#160;&lt;span style="color: #ff0000"&gt;x:NorthAmerica&lt;/span&gt;.      &lt;br /&gt;}      &lt;br /&gt;      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;# walk the region classification       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;construct&lt;/span&gt; {?a &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?b} &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; {?a &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?c. ?c &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?b}      &lt;br /&gt;&lt;span style="color: #0000ff"&gt;construct&lt;/span&gt; {?a &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?a} &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; {{?a &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?x.}&lt;span style="color: #0000ff"&gt;union&lt;/span&gt;{?x &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?a}}      &lt;br /&gt;&lt;span style="color: #0000ff"&gt;construct&lt;/span&gt; {?a &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?b} &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; {?a &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?b}      &lt;br /&gt;)      &lt;br /&gt;      &lt;br /&gt;&lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;# find the smallest common location between landmarks       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;select&lt;/span&gt; ?lm1 ?lm2 ?region &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; {      &lt;br /&gt;&amp;#160; ?lm1 &lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt; ?loc1.      &lt;br /&gt;&amp;#160; ?lm2 &lt;span style="color: #ff0000"&gt;x:hasLocation&lt;/span&gt; ?loc2.      &lt;br /&gt;&amp;#160; &lt;span style="color: #0000ff"&gt;filter&lt;/span&gt;(?lm1 != ?lm2)      &lt;br /&gt;&amp;#160; ?loc1 &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?region.      &lt;br /&gt;&amp;#160; ?loc2 &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?region.      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font size="1"&gt;&lt;span style="color: #228b22"&gt;#make sure there is not a closer match       &lt;br /&gt;&lt;/span&gt;&amp;#160; &lt;span style="color: #0000ff"&gt;not&lt;/span&gt;(?loc1 ?loc2 ?region)      &lt;br /&gt;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ?loc1 &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?region2.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ?loc2 &lt;span style="color: #ff0000"&gt;x:isSameAsOrPartOf&lt;/span&gt; ?region2.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ?region2 &lt;span style="color: #ff0000"&gt;x:isPartOf&lt;/span&gt; ?region.      &lt;br /&gt;&amp;#160; }      &lt;br /&gt;} &lt;/font&gt;&lt;span style="color: gray"&gt;     &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;When the query above is executed it produces the following results.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;Boston&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;UnitedStatesOfAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;Boston&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;UnitedStatesOfAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;BostonCommon&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;UnitedStatesOfAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;CNTower&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;NorthAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;MississippiRiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;FenwayPark&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;UnitedStatesOfAmerica&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;.&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2836588961192906359?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2836588961192906359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/02/querying-for-intersections-between-sets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2836588961192906359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2836588961192906359'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/02/querying-for-intersections-between-sets.html' title='Querying for intersections between sets.'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-3833384236826499215</id><published>2010-02-03T05:21:00.001-08:00</published><updated>2010-02-08T08:44:17.740-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Using rules to implement a cascading delete</title><content type='html'>&lt;p&gt;In an RDF model some entities are wholly owned by other entities. These are often referenced to as contained objects. When deleting an entity the desired logic is:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Delete all statements about the entity &lt;/li&gt;    &lt;li&gt;Delete all statements about any contained objects referenced by the entity &lt;/li&gt;    &lt;li&gt;Delete any statements that reference the contained object. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;One way to implement this logic is to add some additional information about the predicates that are used to reference a contained object. For example for a property “foo” we can add the following statement to the ontology.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier"&gt;x:foo x:refType x:containedSubject.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This statement denotes that any entity that is the object value of a statement with the predicate x:foo is a contained object. Using this approach a generic set of recursive delete rules can be implemented for removing contained objects and the statements that reference them. It traditional database terminology this is referred to a a cascading delete.&lt;/p&gt;  &lt;p&gt;The SPARQL rulebase and DELETE query shown below provides an example of how to implement this logic.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;x: &amp;lt;http://example.org/&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;rulebase &lt;/span&gt;&lt;span style="color: gray"&gt;(
&lt;/span&gt;&lt;span style="color: green"&gt;# remove references to the contained object.
&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o ?r &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;. 
  &lt;/span&gt;&lt;span style="color: black"&gt;?p &lt;/span&gt;&lt;span style="color: red"&gt;x:refType x:containedObject&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: blue"&gt;filter&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?o &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;?r&lt;/span&gt;&lt;span style="color: gray"&gt;)} &lt;/span&gt;&lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: red"&gt;x:cascadeDelete

&lt;/span&gt;&lt;span style="color: green"&gt;# remove all statements about the contained object.
&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o ?r &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;. 
  &lt;/span&gt;&lt;span style="color: blue"&gt;filter&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;=&lt;/span&gt;&lt;span style="color: black"&gt;?r&lt;/span&gt;&lt;span style="color: gray"&gt;).} &lt;/span&gt;&lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: red"&gt;x:cascadeDelete

&lt;/span&gt;&lt;span style="color: green"&gt;# remove all referenced contained objects
&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o ?r &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?r ?x ?y&lt;/span&gt;&lt;span style="color: gray"&gt;. 
  &lt;/span&gt;&lt;span style="color: black"&gt;?x &lt;/span&gt;&lt;span style="color: red"&gt;x:refType x:containedObject&lt;/span&gt;&lt;span style="color: gray"&gt;. 
  &lt;/span&gt;&lt;span style="color: red"&gt;x:cascadeDelete&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?p&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?o&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?y&lt;/span&gt;&lt;span style="color: gray"&gt;).} &lt;/span&gt;&lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: red"&gt;x:cascadeDelete
&lt;/span&gt;&lt;span style="color: gray"&gt;)

&lt;/span&gt;&lt;span style="color: green"&gt;# delete a node where @target = the target URI
&lt;/span&gt;&lt;span style="color: blue"&gt;delete from &lt;span style="color: red"&gt;&amp;lt;xxx&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;} 
&lt;/span&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;&lt;span style="color: red"&gt;&amp;lt;xxx&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: red"&gt;x:cascadeDelete&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?p&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?o&lt;/span&gt;&lt;span style="color: gray"&gt;, @target).}
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-3833384236826499215?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/3833384236826499215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/02/using-rules-to-implement-cascading.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3833384236826499215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3833384236826499215'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/02/using-rules-to-implement-cascading.html' title='Using rules to implement a cascading delete'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-7281164824373148724</id><published>2010-01-05T04:50:00.001-08:00</published><updated>2010-01-05T04:50:36.013-08:00</updated><title type='text'>Maintenance Release v1.2.0.56 Available</title><content type='html'>&lt;p&gt;January, 5 2010 - A new maintenance release of Semantics.SDK and Semantics.Server is now available for download at:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/downloads"&gt;http://www.intellidimension.com/downloads&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Release Notes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Improvements to Model Manager SPARQL editor &lt;/li&gt;    &lt;li&gt;Fixes to resource view in Model Manager &lt;/li&gt;    &lt;li&gt;Fix to “index out of range” exception that sometimes occurred when using multiple data sources in a query.&lt;/li&gt;    &lt;li&gt;Improvements to optimization algorithms in the query and rule compiler.&lt;/li&gt;    &lt;li&gt;Fix to defect with SQL Server (SH) assemblies that resulted in an exception.&lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-7281164824373148724?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/7281164824373148724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/01/maintenance-release-v12056-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7281164824373148724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7281164824373148724'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2010/01/maintenance-release-v12056-available.html' title='Maintenance Release v1.2.0.56 Available'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-7767146071630944085</id><published>2009-12-16T06:20:00.001-08:00</published><updated>2009-12-16T06:45:20.449-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Using the SQL Data Source</title><content type='html'>&lt;p&gt;The SQL Data Source is a component available in the Semantics.SDK. It allows an application to connect to a traditional relational database and expose its data as RDF data. It is most commonly used by an semantic application to import relational data in to its RDF database. This article will provide a short example of how to use it. &lt;/p&gt;  &lt;h5&gt;Sample Data&lt;/h5&gt;  &lt;p&gt;Let’s first examine a very simple relational database. It contains one table “Employee” with its schema described below.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="632"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="174"&gt;Column&lt;/td&gt;        &lt;td valign="top" width="456"&gt;Description&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;ID&lt;/td&gt;        &lt;td valign="top" width="456"&gt;The unique identifier of the employee. (PK, int)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="174"&gt;Name&lt;/td&gt;        &lt;td valign="top" width="456"&gt;The employee name. (NOT NULL, varchar(255))&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The table contains the following two records.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="85"&gt;ID&lt;/td&gt;        &lt;td valign="top" width="315"&gt;Name&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="85"&gt;1&lt;/td&gt;        &lt;td valign="top" width="315"&gt;Fred Flintstone&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="85"&gt;2&lt;/td&gt;        &lt;td valign="top" width="315"&gt;Barney Rubble&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;Model Manager&lt;/h5&gt;  &lt;p&gt;I will first show how you can query the relational data as RDF using SPARQL via the Model Manager. First open the Model Manager and use the context menu on the Data Sources folder under the default model to add a SQL Data Source. The following dialog box will be displayed.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/_5sWjxnF5L7Y/SyjskQPKseI/AAAAAAAAACU/3CRMHnqwieo/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_5sWjxnF5L7Y/Syjskv_X28I/AAAAAAAAACY/ptv-MboZXV4/image_thumb%5B1%5D.png?imgmax=800" width="244" height="198" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The table below describes the fields in the dialog box.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="662"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Data Source Uri&lt;/td&gt;        &lt;td valign="top" width="460"&gt;The URI for the graph representing the relational data in your local model. This will be the URI you will use in the FROM clause of your SPARQL queries.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Base Uri&lt;/td&gt;        &lt;td valign="top" width="460"&gt;The base URI is used by the SQL Data Source when generating URIs to describe the relational data as RDF data. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;SQL Connection String&lt;/td&gt;        &lt;td valign="top" width="460"&gt;The connection string for the relational database.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Query Mode&lt;/td&gt;        &lt;td valign="top" width="460"&gt;The SQL Data Source can be configured to return RDF data that describes the data in the relational tables, that describes the relational schema, or both.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;I configured the SQL Data Source to return both Table &amp;amp; Schema Data so we can see both. Using the Model Manager query window I executed the following SPARQL query.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o 
&lt;/span&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;&lt;span style="color: red"&gt;&amp;lt;http://example.org/graph/Employee&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;} &lt;/span&gt;&lt;span style="color: blue"&gt;order by &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;I save the results as to turtle file (&lt;em&gt;via a context menu on the query results&lt;/em&gt;) that contains the RDF data shown below:&lt;/p&gt;

&lt;p&gt;@prefix rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;. 
  &lt;br /&gt;@prefix ns1: &amp;lt;http://www.w3.org/2001/XMLSchema#&amp;gt;. 

  &lt;br /&gt;@prefix ns2: &amp;lt;http://www.w3.org/2000/01/rdf-schema#&amp;gt;. 

  &lt;br /&gt;@prefix ns3: &amp;lt;http://example.org/data/&amp;gt;. 

  &lt;br /&gt;@prefix ns4: &amp;lt;http://www.w3.org/2002/07/owl#&amp;gt;. &lt;/p&gt;

&lt;p&gt;ns3:Employee_Name a ns4:DatatypeProperty; 
  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns2:range [ 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ns1:maxLength &amp;quot;255&amp;quot;^^ns1:int; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ns2:subClassOf ns1:string]; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns2:domain ns3:Employee. 

  &lt;br /&gt;ns3:Employee a ns4:Class. 

  &lt;br /&gt;ns3:Employee_ID a ns4:DatatypeProperty; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns2:range ns1:int; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns2:domain ns3:Employee. 

  &lt;br /&gt;&amp;lt;http://example.org/data/Employee,1&amp;gt; ns3:Employee_Name &amp;quot;Fred Flintstone&amp;quot;^^ns1:string; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; a ns3:Employee; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns3:Employee_ID &amp;quot;1&amp;quot;^^ns1:int. 

  &lt;br /&gt;&amp;lt;http://example.org/data/Employee,2&amp;gt; ns3:Employee_Name &amp;quot;Barney Rubble&amp;quot;^^ns1:string; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; a ns3:Employee; 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ns3:Employee_ID &amp;quot;2&amp;quot;^^ns1:int.&lt;/p&gt;

&lt;p&gt;If you examine the RDF data closely you will see the table schema is described as an ontology using RDFS and OWL and the table data is described in terms of that ontology. &lt;/p&gt;

&lt;h5&gt;Using .NET&lt;/h5&gt;

&lt;p&gt;The Semantics.SDK allows you do perform the same task I performed above in your own .NET application. This is because the Model Manage itself is based on the Semantics.SDK .NET API. The code segment shown below creates SQL Data Source connected to the relation database, executes a SPARQL query on it, and writes the results to a turtle file.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;ClientModel &lt;/span&gt;cm = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ClientModel&lt;/span&gt;();

&lt;span style="color: #2b91af"&gt;SqlDatasource &lt;/span&gt;ds = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SqlDatasource&lt;/span&gt;(
    &lt;span style="color: #a31515"&gt;&amp;quot;trusted_connection=yes;;server=localhost\mssql2008;database=test&amp;quot;&lt;/span&gt;, 
    &lt;span style="color: #a31515"&gt;&amp;quot;http://www.example.org/data/&amp;quot;&lt;/span&gt;);

ds.QueryScope = &lt;span style="color: #2b91af"&gt;QUERY_SCOPE&lt;/span&gt;.DATA | &lt;span style="color: #2b91af"&gt;QUERY_SCOPE&lt;/span&gt;.ONTOLOGY;

cm.DataSources[&lt;span style="color: #a31515"&gt;&amp;quot;http://www.example.org/graph/Employee&amp;quot;&lt;/span&gt;] = ds;

&lt;span style="color: #2b91af"&gt;Table &lt;/span&gt;res = cm.Query(&lt;span style="color: #a31515"&gt;@&amp;quot;
        select ?s ?p ?o from &amp;lt;http://www.example.org/graph/Employee&amp;gt; 
        where {?s ?p ?o} order by ?s ?p&amp;quot;&lt;/span&gt;);

&lt;span style="color: #2b91af"&gt;GraphDataSource &lt;/span&gt;g = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GraphDataSource&lt;/span&gt;(res);

&lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StreamWriter &lt;/span&gt;s = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StreamWriter&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;c:\\sample.ttl&amp;quot;&lt;/span&gt;))
{
    g.Format&amp;lt;&lt;span style="color: #2b91af"&gt;TurtleFormatter&lt;/span&gt;&amp;gt;(s);
}&lt;/pre&gt;

&lt;h5&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Ontology Mapping&lt;/h5&gt;

&lt;p&gt;Note that the ontology used by the SQL Data Source to describe the relational data isn’t always how you want to model the data in your application. However, now that you have the data described as RDF it in one ontology it is easy to map that data into another ontology using inference rules. That topic I will save for another posting.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-7767146071630944085?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/7767146071630944085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/12/using-sql-data-source.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7767146071630944085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7767146071630944085'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/12/using-sql-data-source.html' title='Using the SQL Data Source'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_5sWjxnF5L7Y/Syjskv_X28I/AAAAAAAAACY/ptv-MboZXV4/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-4516452598992919200</id><published>2009-12-09T07:23:00.001-08:00</published><updated>2009-12-09T08:08:31.951-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Full Text Expressions</title><content type='html'>&lt;p&gt;Many applications need to efficiently search a RDF graph for any statements that contain a set of terms in a literal value. Semantics.SDK and Semantics.Server both provide support for full text expressions to meet this need. In the case of Semantics.Server these full text expressions are evaluated using full text capabilities of Microsoft SQL Server.&lt;/p&gt;  &lt;p&gt;Full text expressions are based on the following constructs:&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="481"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="199"&gt;pattern&lt;/td&gt;        &lt;td valign="top" width="280"&gt;Any simple word match that contains no spaces or punctuation. The matched text must contain the exact word as specified in the pattern.          &lt;br /&gt;          &lt;br /&gt;ex: bluebird&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;prefix pattern&lt;/td&gt;        &lt;td valign="top" width="280"&gt;Any valid pattern followed by an asterisk (‘*’). The matched text must contain a word that starts with the specified pattern.          &lt;br /&gt;          &lt;br /&gt;ex: blue*&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;simple expression&lt;/td&gt;        &lt;td valign="top" width="280"&gt;A simple expression contains one or more patterns. The matched text must match all the patterns specified.          &lt;br /&gt;          &lt;br /&gt;ex: song bluebird&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;set expression&lt;/td&gt;        &lt;td valign="top" width="280"&gt;A set expression contains one or more sets. The matched text must match all the sets in the expression.          &lt;br /&gt;          &lt;br /&gt;ex: {blue red}{large medium}!{dog}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;set&lt;/td&gt;        &lt;td valign="top" width="280"&gt;A set contains one or more patterns delimited by curly braces (‘{}’). The text must match at least one of the patterns in the set.          &lt;br /&gt;          &lt;br /&gt;ex: {blue* red*}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;negated set&lt;/td&gt;        &lt;td valign="top" width="280"&gt;A negated set is a set that is prefixed with an exclamation mark (‘!’). The text must not match any of the patterns in the set.          &lt;br /&gt;          &lt;br /&gt;ex: !{dog cat} &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Examples:&lt;/p&gt;  &lt;p&gt;The following examples are based on the familiar input string:&lt;/p&gt;  &lt;p&gt;“The quick fox jumps over the lazy brown dog.”&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="160"&gt;Expression&lt;/td&gt;        &lt;td valign="top" width="240"&gt;Match?&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;dog laz*&lt;/td&gt;        &lt;td valign="top" width="240"&gt;yes&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;{dog laz*}{quick}&lt;/td&gt;        &lt;td valign="top" width="240"&gt;yes&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;{dog laz*}!{quick}&lt;/td&gt;        &lt;td valign="top" width="240"&gt;no&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;umps&lt;/td&gt;        &lt;td valign="top" width="240"&gt;no&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;SPARQL:&lt;/p&gt;  &lt;p&gt;The &lt;em&gt;contains&lt;/em&gt; function allows you to use a full text expression in a SPARQL query. The example below shows the use of a full text expression in a SPARQL query.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: red"&gt;1 &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: blue"&gt;filter&lt;/span&gt;&lt;span style="color: gray"&gt;(contains(&lt;/span&gt;&lt;span style="color: red"&gt;&amp;quot;The quick fox jumps over the lazy brown dog.&amp;quot;&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;&amp;quot;dog laz*&amp;quot;&lt;/span&gt;&lt;span style="color: gray"&gt;))}
&lt;/span&gt;&lt;span style="color: gray"&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color: gray"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-4516452598992919200?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/4516452598992919200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/12/full-text-expressions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/4516452598992919200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/4516452598992919200'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/12/full-text-expressions.html' title='Full Text Expressions'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-8769020790880331133</id><published>2009-11-11T06:26:00.001-08:00</published><updated>2009-11-11T07:54:43.347-08:00</updated><title type='text'>Getting counts via SPARQL</title><content type='html'>&lt;p&gt;Many applications need to acquire a count of either statements or subjects to provide some statistics about the information in an RDF graph. There are multiple ways to accomplish this:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Programmatically via the Semantics.SDK API.&lt;/li&gt;    &lt;li&gt;Using the SPARQL aggregation function: &lt;em&gt;count&lt;/em&gt;.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In this article we will focus on the SPARQL &lt;em&gt;count&lt;/em&gt; function. The example below shows a SPARQL query that uses the &lt;em&gt;count&lt;/em&gt; function to return the number of unique subjects that have a property &lt;em&gt;x:gender&lt;/em&gt; equal to &lt;em&gt;x:Male&lt;/em&gt;. The inference rules used in the example are solely for generating some sample data for this example.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;x: &amp;lt;http://example.org/&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;

&lt;/span&gt;&lt;span style="color: green"&gt;#infer some sample data
&lt;/span&gt;&lt;span style="color: blue"&gt;rulebase &lt;/span&gt;&lt;span style="color: gray"&gt;(
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-1 rdf:type x:Person&lt;/span&gt;&lt;span style="color: gray"&gt;.
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-1 rdf:type x:Employee&lt;/span&gt;&lt;span style="color: gray"&gt;.
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-1 rdf:type x:SalesPerson&lt;/span&gt;&lt;span style="color: gray"&gt;.
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-1 x:gender x:Male&lt;/span&gt;&lt;span style="color: gray"&gt;.
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-2 rdf:type x:Customer&lt;/span&gt;&lt;span style="color: gray"&gt;.
    &lt;/span&gt;&lt;span style="color: red"&gt;x:id-2 x:gender x:Male&lt;/span&gt;&lt;span style="color: gray"&gt;.}
)
&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: gray"&gt;count(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s &lt;/span&gt;&lt;span style="color: red"&gt;x:gender x:Male&lt;/span&gt;&lt;span style="color: gray"&gt;.}
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;When the query above is executed it returns a value of:&lt;/p&gt;

&lt;p&gt;&amp;quot;2&amp;quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#int&amp;gt; &lt;/p&gt;

&lt;p&gt;The count function can be used with multiple arguments to provide a count of distinct combinations of variables. For example, if we wanted to get a count of the the number of distinct combinations of subject and object values for a particular predicate value (&lt;em&gt;rdf:type&lt;/em&gt;) the query could be modified to:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: gray"&gt;count(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?o&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{
  &lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: blue"&gt;filter&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?p&lt;/span&gt;&lt;span style="color: gray"&gt;=&lt;/span&gt;&lt;span style="color: red"&gt;rdf:type&lt;/span&gt;&lt;span style="color: gray"&gt;)
} &lt;/span&gt;&lt;span style="color: blue"&gt;group by &lt;/span&gt;&lt;span style="color: black"&gt;?p
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Notice we include a GROUP BY clause to force an aggregation of ?s and ?o. This query produces a result of:&lt;/p&gt;

&lt;p&gt;&amp;quot;4&amp;quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#int&amp;gt;&lt;/p&gt;

&lt;p&gt;If you would like to get a count of all the statements in a graph(s) you can execute the following query:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: gray"&gt;count(&lt;/span&gt;&lt;span style="color: black"&gt;?s&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?p&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;?o&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;where  &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s ?p ?o&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: blue"&gt;filter&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;?x&lt;/span&gt;&lt;span style="color: gray"&gt;=&lt;/span&gt;&lt;span style="color: red"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)} &lt;/span&gt;&lt;span style="color: blue"&gt;group by &lt;/span&gt;&lt;span style="color: black"&gt;?x&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;We need to force a grouping on a dummy variable ?x to avoid having the query default to grouping on all variables (?s, ?p and ?o). This behavior will be modified in a future release to make the default grouping be on no variables so a dummy variable is not required. The query above produces the result:&lt;/p&gt;

&lt;p&gt;&amp;quot;6&amp;quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#int&amp;gt;&lt;/p&gt;

&lt;p&gt;I will try and get an article on using the Semantics.SDK API to get counts sometime soon.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-8769020790880331133?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/8769020790880331133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/11/getting-counts-via-sparql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8769020790880331133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8769020790880331133'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/11/getting-counts-via-sparql.html' title='Getting counts via SPARQL'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-9139528027610717683</id><published>2009-11-06T08:56:00.001-08:00</published><updated>2009-11-06T08:56:33.768-08:00</updated><title type='text'>OWL Union and Intersection Rules</title><content type='html'>&lt;p&gt;This article provides a simple example of how to use inference rules to map &lt;em&gt;owl:unionOf&lt;/em&gt; and &lt;em&gt;owl:intersectionOf&lt;/em&gt; class descriptions into &lt;em&gt;rdfs:subClassOf&lt;/em&gt; relationships.&lt;/p&gt;  &lt;p&gt;The example below shows a SPARQL query that has rules to:&lt;/p&gt;  &lt;p&gt;(1) Interpret the RDF collection notation to assign membership.&lt;/p&gt;  &lt;p&gt;(2) Create RDFS subclass relationships based on the OWL union and intersection descriptions.&lt;/p&gt;  &lt;p&gt;(3) Generates some sample data to demonstrate the first two rules.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;rdfs: &amp;lt;http://www.w3.org/2000/01/rdf-schema#&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;owl: &amp;lt;http://www.w3.org/2002/07/owl#&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;prefix &lt;/span&gt;&lt;span style="color: red"&gt;x: &amp;lt;http://www.example.org/&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;rulebase &lt;/span&gt;&lt;span style="color: gray"&gt;(
&lt;/span&gt;&lt;span style="color: green"&gt;# (1) some rdf collection rules
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:member &lt;/span&gt;&lt;span style="color: black"&gt;?i&lt;/span&gt;&lt;span style="color: gray"&gt;} &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdf:first &lt;/span&gt;&lt;span style="color: black"&gt;?i&lt;/span&gt;&lt;span style="color: gray"&gt;}
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:member &lt;/span&gt;&lt;span style="color: black"&gt;?i&lt;/span&gt;&lt;span style="color: gray"&gt;} &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdf:rest &lt;/span&gt;&lt;span style="color: black"&gt;?r&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: black"&gt;?r &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:member &lt;/span&gt;&lt;span style="color: black"&gt;?i&lt;/span&gt;&lt;span style="color: gray"&gt;}

&lt;/span&gt;&lt;span style="color: green"&gt;# (2) owl to rdfs subclass rules
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:subClassOf &lt;/span&gt;&lt;span style="color: black"&gt;?c&lt;/span&gt;&lt;span style="color: gray"&gt;} &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?s &lt;/span&gt;&lt;span style="color: red"&gt;owl:intersectionOf &lt;/span&gt;&lt;span style="color: black"&gt;?l&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:member &lt;/span&gt;&lt;span style="color: black"&gt;?c&lt;/span&gt;&lt;span style="color: gray"&gt;}
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?c &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:subClassOf &lt;/span&gt;&lt;span style="color: black"&gt;?u&lt;/span&gt;&lt;span style="color: gray"&gt;} &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?u &lt;/span&gt;&lt;span style="color: red"&gt;owl:unionOf &lt;/span&gt;&lt;span style="color: black"&gt;?l&lt;/span&gt;&lt;span style="color: gray"&gt;. &lt;/span&gt;&lt;span style="color: black"&gt;?l &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:member &lt;/span&gt;&lt;span style="color: black"&gt;?c&lt;/span&gt;&lt;span style="color: gray"&gt;}

&lt;/span&gt;&lt;span style="color: green"&gt;# (3) some sample data
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: red"&gt;x:HumanBeing  owl:unionOf  &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;x:Man x:Woman&lt;/span&gt;&lt;span style="color: gray"&gt;)}
  &lt;/span&gt;&lt;span style="color: blue"&gt;construct &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: red"&gt;x:TallMan  owl:intersectionOf  &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;x:Man x:TallThing&lt;/span&gt;&lt;span style="color: gray"&gt;)}
)

&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: black"&gt;?sub &lt;/span&gt;&lt;span style="color: black"&gt;?super &lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;&lt;span style="color: gray"&gt;{&lt;/span&gt;&lt;span style="color: black"&gt;?sub &lt;/span&gt;&lt;span style="color: red"&gt;rdfs:subClassOf &lt;/span&gt;&lt;span style="color: black"&gt;?super&lt;/span&gt;&lt;span style="color: gray"&gt;}
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;font color="#000000"&gt;The SELECT query then produces a list of classes with their corresponding base class.&amp;#160; When the query is executed it produces the following results:&lt;/font&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre id="codeSnippet" class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;Man&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;HumanBeing&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;TallMan&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;Man&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;TallMan&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;TallThing&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;Woman&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;http:&lt;/span&gt;//&lt;span class="attr"&gt;www&lt;/span&gt;.&lt;span class="attr"&gt;example&lt;/span&gt;.&lt;span class="attr"&gt;org&lt;/span&gt;/&lt;span class="attr"&gt;HumanBeing&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;font color="#000000"&gt;Note, the RDFS subclass rules are not recursive and just show the immediate base class.&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-9139528027610717683?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/9139528027610717683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/11/owl-union-and-intersection-rules.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9139528027610717683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9139528027610717683'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/11/owl-union-and-intersection-rules.html' title='OWL Union and Intersection Rules'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2262472130842419468</id><published>2009-10-28T15:20:00.000-07:00</published><updated>2009-10-28T12:19:40.861-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Releases'/><title type='text'>Semantics v1.2 Released</title><content type='html'>&lt;p&gt;Intellidimension has just released version 1.2 of its Semantics.Server and Semantics.SDK. Both products are available for download from its web site.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/downloads"&gt;http://www.intellidimension.com/downloads&lt;/a&gt;&lt;/p&gt;  &lt;h5&gt;Release Notes:&lt;/h5&gt;  &lt;p&gt;General:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Added native list data type and associated functions (&lt;em&gt;list, nil, first, rest, listlength, listmember&lt;/em&gt;). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Semantics.Server:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Improvements to full-text search. &lt;/li&gt;    &lt;li&gt;Additional auxiliary SQL statistics including expandable histogram (error based vs. fixed size) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Semantics.SDK:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Improvements to query compilation to deal with unsafe rules and aggregates. &lt;/li&gt;    &lt;li&gt;Added rule rewriter support &lt;/li&gt;    &lt;li&gt;Enhanced full-text search expressions. &lt;/li&gt;    &lt;li&gt;Fixes to turtle parsing. &lt;/li&gt;    &lt;li&gt;XSPARQL support &lt;/li&gt;    &lt;li&gt;New data source (&lt;em&gt;InMemoryGraph&lt;/em&gt;) with dramatically reduced memory footprint with full text index. &lt;/li&gt;    &lt;li&gt;Improved query caching in &lt;em&gt;ClientModel&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Events added for improved manageability of models (ex Caching Events) &lt;/li&gt;    &lt;li&gt;Reduced size of over the wire serialization of graphs and tables &lt;/li&gt;    &lt;li&gt;Math functions added &lt;/li&gt;    &lt;li&gt;Improvements to RDF serialization of objects. &lt;/li&gt;    &lt;li&gt;Added hash index based data source (&lt;em&gt;HashDataSource&lt;/em&gt;). &lt;/li&gt;    &lt;li&gt;Modified quad serialization to be compatible with other implementations. &lt;/li&gt;    &lt;li&gt;Added support for function cardinality callbacks in function registration &lt;/li&gt;    &lt;li&gt;Enforce proper namespace conventions (blank namespace not allowed) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Model Manager:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Support for multiple models within a project file. &lt;/li&gt;    &lt;li&gt;Support for multiple query windows. &lt;/li&gt;    &lt;li&gt;Addition of Model Manager extension API &lt;/li&gt;    &lt;li&gt;Improvements to Semantics.Server assembly installer. &lt;/li&gt;    &lt;li&gt;Added SQL Data Source extension. &lt;/li&gt;    &lt;li&gt;Added Semantics.Server extension. &lt;/li&gt;    &lt;li&gt;Added Local Client Model extension. &lt;/li&gt;    &lt;li&gt;New In-Memory Graph extension. &lt;/li&gt;    &lt;li&gt;Support for adding custom functions via user interface. &lt;/li&gt;    &lt;li&gt;Support for query parameters. &lt;/li&gt;    &lt;li&gt;General improvements to user interface. &lt;/li&gt;    &lt;li&gt;Addition of model namespace configuration. &lt;/li&gt;    &lt;li&gt;Load and save of query results &lt;/li&gt;    &lt;li&gt;New baseball sample project &lt;/li&gt; &lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2262472130842419468?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2262472130842419468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/semantics-v12-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2262472130842419468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2262472130842419468'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/semantics-v12-released.html' title='Semantics v1.2 Released'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-6346557799786599558</id><published>2009-10-14T12:11:00.001-07:00</published><updated>2009-10-28T12:21:23.073-07:00</updated><title type='text'>Model Manager Improvements (v1.2)</title><content type='html'>&lt;p&gt;The Model Manager has a number of significant improvements in version 1.2 of the Semantics.SDK. The Model Manager is a Windows desktop application that exposes many of the features of the Semantics.SDK and Semantics.Server.&lt;/p&gt;  &lt;h5&gt;Projects and Models&lt;/h5&gt;  &lt;p&gt;The Model Manager operates on a single project at a time that consists of one or more models. A model is fundamentally a set of RDF graphs that can be queried. The Model Manager supports different types of models each with additional capabilities beyond supporting graphs and queries. The Model Manager allows you to create, edit and remove models from your project.&lt;/p&gt;  &lt;p&gt;A model can be created from either the main application file menu or from a context menu on the models collection item in the tree control. A model can be saved to file as part of a project or in its own file where it can be opened in another project.&lt;/p&gt;  &lt;h5&gt;Local Model&lt;/h5&gt;  &lt;p&gt;A Local Model is a model that runs in the same process as the Model Manager. It supports federated queries across local in-memory RDF graphs, as well as, external sources of data such a relational store (SQL Data Source) or a Semantics.Server graph (Server Graph). In addition of data sources to a Local Model also supports:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Custom Functions &lt;/li&gt;    &lt;li&gt;Rulebases &lt;/li&gt;    &lt;li&gt;Graph Aliases &lt;/li&gt;    &lt;li&gt;Namespaces &lt;/li&gt; &lt;/ul&gt;  &lt;h5&gt;Server Model&lt;/h5&gt;  &lt;p&gt;A Server Model is a model that runs in a separate process from that of the Model Manager. Server Models support one or more RDF graphs and can be queried. Server Model graphs can also be added as data sources to a Local Model to perform federated queries with graphs not part of that Server Model. A Local Model can also be created from a Server Model to include all the graphs from that Server Model in the Local Model. The advantage being now you can make use of all the features supported by the Local Model (ex: custom functions or namespaces). Each type of Server Model supports a different set of features that may or may not be the same of those available in a Local Model.&lt;/p&gt;  &lt;h5&gt;Semantics.Server Model&lt;/h5&gt;  &lt;p&gt;A Semantics.Server Model is added to a project by selecting it from the new model menu. This will open the dialog shown below that allows you to define the SQL Server connection settings for the database. &lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/_5sWjxnF5L7Y/StYiOS2Y4TI/AAAAAAAAABw/2cMe15Jm_N4/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_5sWjxnF5L7Y/StYiOi7C2gI/AAAAAAAAAB0/6evF_JGNh38/image_thumb%5B1%5D.png?imgmax=800" width="244" height="220" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If the database does not exist or Semantics.Server has not been installed on that database then you must first run the Semantics.Server installer by clicking on the “Setup” button.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/_5sWjxnF5L7Y/StYiO-5_xFI/AAAAAAAAAB4/_pX3NLXUQaA/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_5sWjxnF5L7Y/StYiPB1sRaI/AAAAAAAAAB8/AglxB_vxGxY/image_thumb.png?imgmax=800" width="244" height="146" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;h5&gt;SQL Data Source&lt;/h5&gt;  &lt;p&gt;The SQL Data Source exposes existing relational databases as RDF and allows them to be queried using SPARQL. You can add a SQL Data Source to your Local Model by selecting it on the add menu available as a context menu on the data source collection for the model. The following configuration dialog will open that allows you to defined the URI for the data source, the SQL connection string for the relational DB, the base URI for the relation data, and the query mode (data, ontology or both).&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/_5sWjxnF5L7Y/StYiPvC04LI/AAAAAAAAACA/OZYdMVTfEv4/s1600-h/image%5B8%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_5sWjxnF5L7Y/StYiP9qf1DI/AAAAAAAAACE/gVINIhpqBWg/image_thumb%5B2%5D.png?imgmax=800" width="244" height="198" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;h5&gt;Queries&lt;/h5&gt;  &lt;p align="left"&gt;The Model Manager now supports a multiple query files open at the same time! To execute a query you must select the model you wish to query using the main menu and either open an existing query file or type in a query and press “F5”. The query results are shown in the grid below. The query results can be saved to a file using SPARQL Results XML format by using the context menu available from the grid.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh3.ggpht.com/_5sWjxnF5L7Y/StYiQQ__InI/AAAAAAAAACI/i2zUq9BuDzM/s1600-h/image%5B11%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_5sWjxnF5L7Y/StYiQ4BJQ8I/AAAAAAAAACM/O8QRtELk7n0/image_thumb%5B3%5D.png?imgmax=800" width="244" height="149" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-6346557799786599558?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/6346557799786599558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/model-manager-improvements-v12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6346557799786599558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/6346557799786599558'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/model-manager-improvements-v12.html' title='Model Manager Improvements (v1.2)'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_5sWjxnF5L7Y/StYiOi7C2gI/AAAAAAAAAB0/6evF_JGNh38/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-620795432854734679</id><published>2009-10-12T12:25:00.001-07:00</published><updated>2009-10-12T13:48:27.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Baseball Sample Model</title><content type='html'>&lt;p&gt;The v1.2 release of the Semantics.SDK includes a sample model that can be loaded into the Model Manager. The model contains a simple ontology for describing a baseball team lineup and a sample lineup that uses the ontology. To try out the sample, start the Model Manager application, click the menu item “Help -&amp;gt; Open Sample Project…” and select the “baseball.project” file.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_5sWjxnF5L7Y/StOCjZ5wtsI/AAAAAAAAABo/C3bfhazzHpk/s1600-h/clip_image002%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://lh6.ggpht.com/_5sWjxnF5L7Y/StOCjvU86kI/AAAAAAAAABs/wKxuq9lnUSM/clip_image002_thumb%5B1%5D.jpg?imgmax=800" width="244" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The model has two graphs that contain the ontology (http://www.intellidimension.com/schema/baseball/20090721#Ontology) and instance data (http://www.intellidimension.com/schema/baseball/20090721#Data). The RDF data for these graphs are available in the files “baseball-ontology.ttl” and “team-data.ttl” respectively. &lt;/p&gt;  &lt;p&gt;The sample includes a couple of SPARQL query files that can be used with this model. To open a SPARQL query click on the “File-&amp;gt;Open-&amp;gt;Query” menu and open one of the queries in the directory “&amp;lt;install dir&amp;gt;\samples\models\baseball”. &lt;/p&gt;  &lt;p&gt;The query file “lineup-card.sparql” contains a SPARQL SELECT query that creates a result set in a format similar to lineup card. The other query file “validate-lineup.sparql” runs a set of inference rules over the lineup data to ensure that it’s valid. This query adds the same batter twice to the lineup to create a violation and report on it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-620795432854734679?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/620795432854734679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/baseball-sample-model.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/620795432854734679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/620795432854734679'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/10/baseball-sample-model.html' title='Baseball Sample Model'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_5sWjxnF5L7Y/StOCjvU86kI/AAAAAAAAABs/wKxuq9lnUSM/s72-c/clip_image002_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-3529456155728944099</id><published>2009-09-30T11:33:00.001-07:00</published><updated>2009-09-30T11:33:15.172-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Security via SPARQL Expression Parsing</title><content type='html'>&lt;p&gt;Some common questions that often arise in the context of wanting to secure a SPARQL service are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How do I prevent the execution of SPARQL INSERT and DELETE commands?&lt;/li&gt;    &lt;li&gt;How do I protect certain graphs in model from being accessed?&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;An easy way to implement application level security in your services is to parse the incoming SPARQL query into an expression tree and interrogate it and either reject the query or modify it before allowing it to be executed. This is accomplished in the Semantics.SDK by using the &lt;em&gt;&lt;strong&gt;SparqlExpression&lt;/strong&gt;&lt;/em&gt; class.&lt;/p&gt;  &lt;p&gt;The code snip below shows how to prevent INSERT and DELETE queries from being executed by first parsing a SPARQL query string and then examining its command type.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;Intellidimension.Sparql;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;span style="color: #2b91af"&gt;SparqlExpression &lt;/span&gt;expr = &lt;span style="color: #2b91af"&gt;SparqlExpression&lt;/span&gt;.Parse(

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #a31515"&gt;&amp;quot;delete from &amp;lt;data&amp;gt; {?s ?p ?o} from &amp;lt;data&amp;gt; where {?s ?p ?o}&amp;quot;&lt;/span&gt;);

  &lt;br /&gt;

  &lt;br /&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(expr.Command &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CommandDelete &lt;/span&gt;|| expr.Command &lt;span style="color: blue"&gt;is &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CommandInsert&lt;/span&gt;)

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Access denied!&amp;quot;&lt;/span&gt;);&lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Access to a particular graph can be prevented by checking the graphs that are specified in the FROM or FROM NAMED clause of a SPARQL query. This can be accomplished using an expression by testing both the &lt;em&gt;DefaultGraphs&lt;/em&gt; and &lt;em&gt;NamedGraphs&lt;/em&gt; collections on the command.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;SparqlExpression &lt;/span&gt;expr = &lt;span style="color: #2b91af"&gt;SparqlExpression&lt;/span&gt;.Parse(
    &lt;span style="color: #a31515"&gt;&amp;quot;select ?s ?p ?o from &amp;lt;admin&amp;gt; where {?s ?p ?o}&amp;quot;&lt;/span&gt;);

&lt;span style="color: blue"&gt;if &lt;/span&gt;(expr.Command.DefaultGraphs.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;) || 
    expr.Command.NamedGraphs.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;))
    &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Access denied!&amp;quot;&lt;/span&gt;);
&lt;font face="Verdana"&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Verdana"&gt;Expression parsing has uses outside of security such a dynamically building SPARQL queries or modifying existing ones. For example, its often used by services to set a default graph when none is specified in a query. This is done by modifying the expression object and then calling its &lt;em&gt;ToString&lt;/em&gt; method to produce a SPARQL query string.&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Verdana"&gt;I find myself using the &lt;em&gt;SparqlExpression&lt;/em&gt; class in almost every application I write.&lt;/font&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-3529456155728944099?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/3529456155728944099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/09/security-via-sparql-expression-parsing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3529456155728944099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/3529456155728944099'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/09/security-via-sparql-expression-parsing.html' title='Security via SPARQL Expression Parsing'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-5383181732043668619</id><published>2009-08-28T11:36:00.001-07:00</published><updated>2009-08-28T11:40:09.776-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>SPARQL Switch/Case</title><content type='html'>&lt;p&gt;The Intellidimension SPARQL processor supports a &lt;strong&gt;Switch/Case&lt;/strong&gt; syntax that allows for the implementation of &lt;strong&gt;If…Else If…Else If…Else… &lt;/strong&gt;logic in your queries. The syntax of a switch statement consists of a variable list followed by a body that contains one or more graph patterns preceded by the case keyword.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier"&gt;switch ([variable list]) {     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier"&gt;&amp;#160; case {[graph pattern 1]}     &lt;br /&gt;&amp;#160; ..      &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;font face="Courier"&gt;case {[graph pattern N]}&lt;/font&gt;&lt;font face="Courier"&gt;     &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The variable list defines one or more variables to be grouped by when evaluating the body of the statement. The graph patterns for the cases are evaluated once for each unique binding of the variables in the list. The case graph patterns are evaluated in order and once a pattern is matched for a set of variable bindings then no more patterns are evaluated (&lt;em&gt;for that set of variable bindings&lt;/em&gt;). &lt;/p&gt;  &lt;p&gt;The example below uses some inference rules to create some sample data and then runs a SPARQL SELECT query that utilizes a switch statement to get a label for a resource. The logic is to first use the property &amp;lt;name&amp;gt;, then &amp;lt;label&amp;gt; and if neither exists then to turn the subject URI into a literal.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;# infer some data&lt;br /&gt;rulebase (&lt;br /&gt;  construct {&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;label&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &amp;quot;a&amp;quot;}&lt;br /&gt;  construct {&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;b&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;label&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &amp;quot;b&amp;quot;}  &lt;br /&gt;  construct {&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;b&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &amp;quot;bee&amp;quot;}  &lt;br /&gt;  construct {&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;c&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;size&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &amp;quot;large&amp;quot;}&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;select ?s ?txt where {&lt;br /&gt;  ?s ?p ?o.&lt;br /&gt;  switch(?s) {&lt;br /&gt;    case {?s &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; ?txt} #name first&lt;br /&gt;    case {?s &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;label&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; ?txt} #then label&lt;br /&gt;    case {filter(?txt=str(?s))} #default&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;When this query is executed it produces the following results.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &amp;quot;a&amp;quot;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;b&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &amp;quot;bee&amp;quot;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;c&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;    &amp;quot;c&amp;quot;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;
The switch statement is perfect for generating a single value for a property based on some predetermined ranking of predicates.  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-5383181732043668619?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/5383181732043668619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/08/sparql-switchcase.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5383181732043668619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/5383181732043668619'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/08/sparql-switchcase.html' title='SPARQL Switch/Case'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-9013286584067366480</id><published>2009-07-25T11:39:00.001-07:00</published><updated>2009-07-25T11:39:17.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Customizing the SPARQL DESCRIBE command</title><content type='html'>&lt;p&gt;The default behavior of the SPARQL DESCRIBE command is to return all statements where the specified URI is the subject value (ex: describe &amp;lt;some uri&amp;gt;). Many applications require a much richer description of a resource that may include information about referenced URIs also. When using Intellidimension Semantics the behavior of the DESCRIBE command can be modified by providing some special inference rules.&amp;#160; The DESCRIBE command gets its behavior from a special inference rules call &lt;strong&gt;&amp;lt;description&amp;gt;&lt;/strong&gt;. This rule (“relation”) takes four arguments as shown below.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The first three arguments are the statements describing the URI in the fourth argument.&lt;/p&gt;  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;select ?s ?p ?o ?r where {?s ?p ?o. filter(?s=?r)} as &amp;lt;description&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;/pre&gt;

&lt;p&gt;So consider the first three arguments outputs and the fourth as an input. This relation provides the default implementation of the DESCRIBE command by returning all statements about a specified URI.&lt;/p&gt;

&lt;p&gt;To customize the DESCRIBE command, you must provide one or more rules that implement the &amp;lt;description&amp;gt; relation. For example, if you wanted to create a custom description for a factory entity that included information about chemicals it uses you could implement the following rules and include them in your DESCRIBE query.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;rulebase (&lt;br /&gt;    select ?s ?p ?o ?r where {&lt;br /&gt;    ?r x:usesChemical ?s. &lt;br /&gt;    ?s ?p ?o.} as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;)&lt;br /&gt;describe &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;somefactoryuri&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; from &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;data&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;By adding this rule you will now get all statements about the factory plus all statements about any chemicals it uses. So you can now create different sets of rules for different entity types each with its own custom description.&lt;/p&gt;

&lt;p&gt;Another way to accomplish this goal is to add some additional information to your ontology so that a single set of rules can be used for all entity types. For example if we added the statement {x:FactoryClass x:includedReference x:usesChemical} to the ontology a generic set of description rules could be written as follows.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;rulebase (&lt;br /&gt;    select ?s ?p ?o ?r where &lt;br /&gt;    {?s ?p ?o. filter(?s=?r)} as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    # special rule to look for all marked predicates for the&lt;br /&gt;    # class of the entity (?r) and recursively describe all&lt;br /&gt;    # included references.&lt;br /&gt;    select ?s ?p ?o ?r where {&lt;br /&gt;    ?r rdf:type ?class.&lt;br /&gt;    ?class x:includedReference ?ref.&lt;br /&gt;    ?r ?ref ?included.&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;(?s, ?p, ?o, ?included).&lt;br /&gt;    }as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  )&lt;br /&gt;describe &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;somefactoryuri&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;Taking this approach we only need a single set of rules for our descriptions. 
  &lt;br /&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;br /&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;br /&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-9013286584067366480?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/9013286584067366480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/customizing-sparql-describe-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9013286584067366480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9013286584067366480'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/customizing-sparql-describe-command.html' title='Customizing the SPARQL DESCRIBE command'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2241866388174715733</id><published>2009-07-16T11:27:00.001-07:00</published><updated>2009-07-16T11:32:21.225-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><title type='text'>An Introduction to Inference Rules</title><content type='html'>&lt;p&gt;Intellidimension’s SPARQL extensions for inference rules are a powerful tool when developing a semantics based application. In this article I will show you a few simple examples to get you started. Intellidiemsion has added a SPARQL extension called a &lt;strong&gt;rulebase &lt;/strong&gt;for defining inference rules to be used in any SPARQL query. When an SPARQL query is executed all the rules in all the rulebases are evaluated. A rulebase can be loaded into a model and referenced by uri or declared right inline with your SPARQL query. In this article let’s take a looks at an inline rulebase. &lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;prefix rdf:&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;www&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;w3&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;1999&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;02&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;22-rdf-syntax-ns&lt;/span&gt;#&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;prefix rdfs:&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;www&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;w3&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;2000&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;01&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;rdf-schema&lt;/span&gt;#&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;prefix x:&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;rulebase(&lt;br /&gt;# create some facts&lt;br /&gt;construct {x:D rdfs:subClassOf x:B}&lt;br /&gt;construct {x:C rdfs:subClassOf x:B}&lt;br /&gt;construct {x:B rdfs:subClassOf x:A}&lt;br /&gt;&lt;br /&gt;#transitive subclass rule&lt;br /&gt;construct {?class rdfs:subClassOf ?super} where {&lt;br /&gt;    ?class rdfs:subClassOf ?x. &lt;br /&gt;    ?x rdfs:subClassOf ?super }&lt;br /&gt;&lt;br /&gt;# root class relation&lt;br /&gt;select ?class ?root where {&lt;br /&gt;    ?class rdfs:subClassOf ?root.&lt;br /&gt;    not(?root) {?root rdfs:subClassOf ?super}&lt;br /&gt;} as :rootClass&lt;br /&gt;&lt;br /&gt;# aggregation relation&lt;br /&gt;select ?class :count(?sub) as ?count where {&lt;br /&gt;    ?sub rdfs:subClassOf ?class.&lt;br /&gt;} group by ?class as :numberOfSubClasses&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;select ?super where {x:C rdfs:subClassOf ?super}&lt;br /&gt;#select ?root where {:rootClass(x:C, ?root)}&lt;br /&gt;#select ?count where {:numberOfSubClasses(x:B, ?count)}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;The example about creates a rulebase with some facts about subclass relationships and some inference rules to derive some additional information about those class relationships. The rule:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;construct {?class rdfs:subClassOf ?super} where {&lt;br /&gt;?class rdfs:subClassOf ?x.&lt;br /&gt;?x rdfs:subClassOf ?super }&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;Recursively generates all the subclass relationships so when the following query is run:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;select ?super where {x:C rdfs:subClassOf ?super}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;it results in:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;A&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;B&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;
&lt;font face="Courier"&gt;&lt;/font&gt;

&lt;p&gt;&lt;font face="Courier"&gt;&lt;font face="Verdana"&gt;The rulebase also contains a relation rule for finding the root class (the top base class) of any class. Note that this rule actually makes use of our previous rule for recursively traversing the class hierarchy.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;select ?class ?root where { &lt;br /&gt; ?class rdfs:subClassOf ?root. &lt;br /&gt; not(?root) {?root rdfs:subClassOf ?super} &lt;br /&gt;} as :rootClass&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;
&lt;font face="Courier"&gt;&lt;/font&gt;

&lt;p&gt;When we execute this rule in a query by replacing the SELECT query in the example with the following:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;select ?root where {:rootClass(x:C, ?root)}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;We get:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;example&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;A&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;The last rule in the rulebase provides both an example of the use of a SPARQL function as well as an aggregation. This rule calculates how many subclasses a class has.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;select ?class :count(?sub) as ?count where { &lt;br /&gt; ?sub rdfs:subClassOf ?class. &lt;br /&gt;} group by ?class as :numberOfSubClasses&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;When we execute this rule in a query (replace the SELECT in the example):&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;select ?count where {:numberOfSubClasses(x:B, ?count)}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;We get:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;&amp;quot;2&amp;quot;^^&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;http:&lt;/span&gt;//&lt;span style="color: #ff0000"&gt;www&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;w3&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;org&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;2001&lt;/span&gt;/&lt;span style="color: #ff0000"&gt;XMLSchema&lt;/span&gt;#&lt;span style="color: #ff0000"&gt;int&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;Hopefully this is enough to get you started with inference rules. I will post some more complicated use of rules in the future.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2241866388174715733?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2241866388174715733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/introduction-to-inference-rules.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2241866388174715733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2241866388174715733'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/introduction-to-inference-rules.html' title='An Introduction to Inference Rules'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-8772184767537033800</id><published>2009-07-06T15:01:00.001-07:00</published><updated>2009-07-06T15:03:02.390-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Client Model Pooling</title><content type='html'>&lt;p&gt;One simple way to improve performance of your data access services is to create a client model pool. Creating a new instance of a ClientModel for each service request can get expensive especially if the ClientModel makes use of a SemanticServerGraph. By creating a pool of client models that can be reused you benefit from cached statistics and compiled queries.&lt;/p&gt;  &lt;p&gt;Client model pooling is implemented is by creating a single instance of a ClientModelPool. The example below creates a pool that holds a maximum of 10 client models that expire after 5 minutes.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;ClientModel pool = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ClientModelPool(10, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TimeSpan(0, 5, 0));&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #008000"&gt;// assign it to some global&lt;/span&gt;&lt;br /&gt;app.ModelPool = pool;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;You will want to keep this pool around in as a static member or in some other global container such as the ASP.NET Application object. Next you must create a method for creating a new instance of a client model that is configured for your application. This can be done in one of two ways: &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Derive an application specific class from ClientModelPool and override its Create method. &lt;/li&gt;

  &lt;li&gt;Implement your own method for creating a client model on some centralized configuration class that already exists in your application. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Option 2 seems to be the most popular choice. So a simple method for getting a client model in your application class might look like.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ClientModel GetClientModel()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;//get a pooled model &lt;/span&gt;&lt;br /&gt;    ClientModel model = ModelPool.Get();&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (model == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #008000"&gt;// create a new one and make it pooled&lt;/span&gt;&lt;br /&gt;        model = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ClientModel();&lt;br /&gt;        model.SetPool(ModelPool);&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// TODO: configure for your application&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; model;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;You should call this method in your application in the context of a using statement. When the client model is disposed then it is returned to the pool.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (ClientModel cm = app.GetClientModel())&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;//do something&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You should quickly discover this can have a big effect on performance.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-8772184767537033800?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/8772184767537033800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/client-model-pooling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8772184767537033800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8772184767537033800'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/07/client-model-pooling.html' title='Client Model Pooling'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-9204073617856066767</id><published>2009-06-16T06:42:00.001-07:00</published><updated>2009-06-16T06:42:47.333-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Releases'/><title type='text'>Maintenance Release 1.1.0.29 Available</title><content type='html'>&lt;p&gt;June 16, 2009 – A new maintenance release of Semantics.SDK and Semantics.Server is now available for download at &lt;a href="http://www.intellidimension.com/downloads" target="_blank"&gt;http://www.intellidimension.com/downloads&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;* Fix to problem with XSD date in gmt +xxx timezones.    &lt;br /&gt;* Fix to stats when using certain quad based graph patterns in queries.     &lt;br /&gt;* Improvements to Model Manager model explorer.     &lt;br /&gt;* Fix to SemanticServer API for getting SQL extension functions.     &lt;br /&gt;* Fix to SemanticServer API for setting graph update mode.     &lt;br /&gt;* Addition of URI fo SemanticServerModel.     &lt;br /&gt;* Fix delete key handling in SPARQL editor Model Manager.     &lt;br /&gt;* New events added to ClientModelPool.     &lt;br /&gt;* Fixed expiration bug in ClientModelPool     &lt;br /&gt;* Renumber in rules fixed&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-9204073617856066767?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/9204073617856066767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/maintenance-release-11029-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9204073617856066767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/9204073617856066767'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/maintenance-release-11029-available.html' title='Maintenance Release 1.1.0.29 Available'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-675546695199263739</id><published>2009-06-10T07:42:00.001-07:00</published><updated>2009-06-16T06:43:44.685-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Releases'/><title type='text'>Maintenance Release 1.1.0.28 Available</title><content type='html'>&lt;p&gt;June 10, 2009 – A new maintenance release of Semantics.SDK and Semantics.Server is now available for download at &lt;a href="http://www.intellidimension.com/downloads" target="_blank"&gt;http://www.intellidimension.com/downloads&lt;/a&gt;.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Fix for ServerModel compilation of queries to SQL. In some cases this would produce SQL syntax errors that would be seen when using the sw_sparql extension. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://www.intellidimension.com/downloads" target="_blank"&gt;&amp;#160;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-675546695199263739?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/675546695199263739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/maintenance-release-11028-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/675546695199263739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/675546695199263739'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/maintenance-release-11028-available.html' title='Maintenance Release 1.1.0.28 Available'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2252921840346932727</id><published>2009-06-01T14:36:00.001-07:00</published><updated>2009-06-10T07:51:36.808-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='News'/><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><category scheme='http://www.blogger.com/atom/ns#' term='Releases'/><title type='text'>Semantics 1.1 Released</title><content type='html'>&lt;p&gt;Intellidimension has just released its 1.1 version of Semantics.SDK and Semantics.Server. Both are available for download on our web site&lt;/p&gt;  &lt;h5&gt;Installation&lt;/h5&gt;  &lt;p&gt;You should download (&lt;a href="http://www.intellidimension.com/downloads" target="_blank"&gt;click here&lt;/a&gt;) and install both Semantics.SDK and Semantics.Server. Be sure to install Semantics SDK first.&lt;/p&gt;  &lt;h5&gt;The Model Manager&lt;/h5&gt;  &lt;h5&gt;&lt;/h5&gt;  &lt;p&gt;The Model Manager is a new tool included in the 1.1 release of the Semantics.SDK. This tool exposes most of the fundamental features of our .NET API through a simple GUI. You should become familiar with the Model Manager functionality before diving into the API.&lt;/p&gt;  &lt;p&gt;The Model Manager can be started by running the executable ModelManager.exe located in the [install dir]\bin directory of the SDK. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_5sWjxnF5L7Y/SiRKblkgrLI/AAAAAAAAABY/Vjwh-GhscHQ/s1600-h/image001%5B4%5D.png"&gt;&lt;img title="image001" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="145" alt="image001" src="http://lh3.ggpht.com/_5sWjxnF5L7Y/SiRKccJ11WI/AAAAAAAAABc/Rr0cPH5oQaQ/image001_thumb%5B2%5D.png?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The Model Manger allows a user to create, save and edit a client model. A client model is a local RDF model that serves as the primary interface in the API for executing SPARQL queries. The table below describes some of the most basic components of a client model.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="799" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="203"&gt;Data Sources&lt;/td&gt;        &lt;td valign="top" width="594"&gt;A data source is a container of triples (or quads) that can be local or remote. A model can have one or more data sources associated with it. The model manager provides a file load feature for quickly adding data to a data source. Each data source identified by a URI.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="206"&gt;Rulebases&lt;/td&gt;        &lt;td valign="top" width="592"&gt;A rulebase is a collection of inference rules that are identified by a URI. One or more rulebases can be included in a query to execute the rules as part of the query.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="206"&gt;Functions&lt;/td&gt;        &lt;td valign="top" width="592"&gt;A client model comes with a set of predefined SPARQL functions. However you may define custom functions of your own.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;All of these components can be added, edited and removed via the tree control on the left hand side of the Model Manager. &lt;/p&gt;  &lt;p&gt;Once you have setup your client model you can use the “Query” tab to execute and debug SPARQL queries running against your model.&lt;/p&gt;  &lt;h5&gt;Semantics.Server Setup&lt;/h5&gt;  &lt;p&gt;Semantics.Server provides an implementation of a server model. A server model is hosted on an instance of SQL Server and stores its data in a SQL Server database. The Model Manager provides a simple interface to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Connect to a SQL Server database.&lt;/li&gt;    &lt;li&gt;Install the Semantics.Server assemblies in the SQL Server database.&lt;/li&gt;    &lt;li&gt;Create data sources (graphs) in the server model that are backed by SQL Server tables.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To get started you need to define a connection to Semantics.Server model. Right mouse click on the “Connections” item in the tree control and select the “Add Semantics.Server Connection…” menu item. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_5sWjxnF5L7Y/SiRKcndiDgI/AAAAAAAAABg/RiknnYqVHEI/s1600-h/image003%5B4%5D.png"&gt;&lt;img title="image003" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="140" alt="image003" src="http://lh4.ggpht.com/_5sWjxnF5L7Y/SiRKc9y8-_I/AAAAAAAAABk/e20KmdxxJjg/image003_thumb%5B2%5D.png?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The dialog box that is displayed allows you to install all the Semantics.Server assemblies on an instance of SQL Server. Once you define a Semantic.Server connection you can define some graphs that you will be able to include as data sources in your client model. This is how you move data between your client application and your SQL Server database.&lt;/p&gt;  &lt;h5&gt;Disclaimer&lt;/h5&gt;  &lt;p&gt;We acknowledge that the Model Manager is still a bit rough around the edges but we wanted to get it in the hands of our developer community. We welcome any feedback you might have and we are actively improving its usability (user-friendliness) as well as its feature set. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now start writing that semantic application!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2252921840346932727?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2252921840346932727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/semantics-11-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2252921840346932727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2252921840346932727'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/06/semantics-11-released.html' title='Semantics 1.1 Released'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_5sWjxnF5L7Y/SiRKccJ11WI/AAAAAAAAABc/Rr0cPH5oQaQ/s72-c/image001_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2779875348219920651</id><published>2009-05-22T10:33:00.001-07:00</published><updated>2009-05-22T10:42:16.493-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='News'/><title type='text'>Semantics 1.1 Coming Soon</title><content type='html'>&lt;p&gt;Intellidimension will soon be releasing a new version of it’s Semantics.SDK and Semantics.Server (v 1.1). Here are some of the key features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Much improved query compilation. This includes better graph index statistics and caching of compiled query plans. &lt;/li&gt;    &lt;li&gt;Support for distributed graphs. A graph can be partitioned over multiple servers for applications that require high performance querying on large data models. Distributed graph partitions can be backed by a SQL Server databases or just use the high performance in-memory r/w cache. The framework ensures maximum parallelization during queries and loads. &lt;/li&gt;    &lt;li&gt;A set of new visual tools for setting up models and testing and debugging queries. Many improvements to these tools are planned over the next several months. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Both products will be available for a free 60-day evaluation. &lt;/p&gt;  &lt;p&gt;Stay tuned!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2779875348219920651?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2779875348219920651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/semantics-11-coming-soon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2779875348219920651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2779875348219920651'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/semantics-11-coming-soon.html' title='Semantics 1.1 Coming Soon'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2820667034132310843</id><published>2009-05-05T08:52:00.001-07:00</published><updated>2009-05-05T13:11:54.983-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RdfEntity'/><title type='text'>Defining an Entity Description Type</title><content type='html'>&lt;p&gt;One of the first design issues encountered when using the Entity Framework is the design of your description types. The role of a description type is to define the data that makes up an entity. So you need to start with a clear understanding of your data model. Let’s start with a simple class of object like a Person and work through an example.&lt;/p&gt;  &lt;p&gt;A Person will have a couple of simple literal properties such as:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Full Name &lt;/li&gt;    &lt;li&gt;First Name &lt;/li&gt;    &lt;li&gt;Last Name &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The simplest way to define a description type with the Entity Framework is with a rulebase. So let’s define a rulebase for the Person description.&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; height: 92px; background-color: #f4f4f4; text-align: left"&gt;   &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;br /&gt;select ?s ?p ?o ?r where {?s ?p ?o. filter(?s=?r).} as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;We start by adding a description rule that includes all direct properties of the entity. This is the most basic form of a description type. Things get more complicated when we introduce references to other objects. This introduces some rather common data modeling concepts such as is an object contained by another object or just referenced. So let’s add an example of each type of property.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Address (contains an Address object) &lt;/li&gt;

  &lt;li&gt;Knows (references another Person object) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I will add two additional rules to the description rulebase to include these new properties.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; height: 233px; background-color: #f4f4f4; text-align: left"&gt;
  &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;select ?s ?p ?o ?r where {&lt;br /&gt;    ?r x:Address ?s. ?s ?p ?o.&lt;br /&gt;}as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;select ?s ?p ?o ?r where {&lt;br /&gt;    ?r x:Knows ?s. &lt;br /&gt;    ?s ?p ?o. &lt;br /&gt;    filter(?p=x:FullName)&lt;br /&gt;} as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;The first rule includes all the direct properties of the contained Address object. The second rule includes just the full name of the referenced Person object to provide some user-friendly identity for the reference.&lt;/p&gt;

&lt;p&gt;This description type is useful for retrieving an entity from the store. However get and put operations are often asymmetric. Meaning you often retrieve more data than you want to store after editing. In this example we would not want to store any a statements about the referenced Person object. To handle this we use a different description type when storing the entity. One that does not include any of the statements for the referenced object.&lt;/p&gt;

&lt;p&gt;So we would remove the following rule from the storage description type.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; height: 150px; background-color: #f4f4f4; text-align: left"&gt;
  &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;select ?s ?p ?o ?r where {&lt;br /&gt;    ?r x:Knows ?s.     &lt;br /&gt;    ?s ?p ?o.     &lt;br /&gt;    filter(?p=x:FullName)&lt;br /&gt;} as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Note these description type rules are for illustrative purposes. It it sometimes much easier to classify containment vs. reference through annotations on the property in the ontology. In this case, you can have one set of rules for all Classes in your data model.&lt;/p&gt;

&lt;p&gt;For example we could get all contained objects using a generic rule.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
  &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;select ?s ?p ?o where {&lt;br /&gt;    ?r ?x ?y. &lt;br /&gt;    ?x x:referenceType x:Containment.&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;(?s, ?p, ?o, ?y).&lt;br /&gt;} &lt;br /&gt;as &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;The rule above recursively includes all properties that are marked with a reference type of Containment.&lt;/p&gt;

&lt;p&gt;As you can see description types are just a tool that can be configured to meet the needs of your data model.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2820667034132310843?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2820667034132310843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/defining-entity-description-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2820667034132310843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2820667034132310843'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/defining-entity-description-type.html' title='Defining an Entity Description Type'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-7085909459152191356</id><published>2009-05-04T12:33:00.001-07:00</published><updated>2009-05-04T15:03:04.876-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RdfEntity'/><title type='text'>Setting up an Entity Model</title><content type='html'>This article is about the RDF Entity Framework. It shows you how to setup a basic entity model using Semantics.Server.

&lt;strong&gt;Setting up Semantics.Server&lt;/strong&gt;

The first step to setting up an entity model is configuing a Semantics.Server database with
the graphs that you will need to hold your entity model. We will use the Semantics.Server API in the
Semantics.SDK to do this.


Create a provider graph that will hold the information about your model setup.
&lt;pre&gt;
SemanticServerModel entityStore = new SemanticServerModel(ConnectionString);

entityStore.Graphs.CreateMultiGraph("http://entitystore/graph-provider");
&lt;/pre&gt;


Create a graph to hold the facts about the entity instances.
&lt;pre&gt;
entityStore.Graphs.CreateGraph("http://entitystore/graph-fact");
&lt;/pre&gt;

Create a graph to hold facts about the ontology.
&lt;pre&gt;
entityStore.Graphs.CreateGraph("http://entitystore/graph-ontology");
&lt;/pre&gt;

Create a rulebase for your CBD description type.
&lt;pre&gt;
entityStore.Rulebases.CreateRulebase("http://entitystore/rulebase-cbd-description", EntityProviderRulebase.ConciseBoundedDescription);
&lt;/pre&gt;


&lt;strong&gt;Setting up the Entity Model&lt;/strong&gt;

We will use the ModelSetup helper class to defined a entity model for the Semantics.Server database we just setup.


First we define a URI for our model. 
&lt;pre&gt;
ModelSetup modelSetup = new ModelSetup("http://entitystore/model/model-1");
&lt;/pre&gt;

Map the fact graph into the entity model. This connects the logic graph name with the physical name.
&lt;pre&gt;
GraphSetup factGraph = new GraphSetup(EntityGraphUri.Fact, true);
factGraph.AddTarget("http://entitystore/graph-fact");
modelSetup.AddGraph(factGraph);
&lt;/pre&gt;

Map the ontology graph into the entity model.
&lt;pre&gt;
GraphSetup ontologyGraph = new GraphSetup(EntityGraphUri.Ontology, true);
ontologyGraph.AddTarget("http://entitystore/graph-ontology");
modelSetup.AddGraph(ontologyGraph);
&lt;/pre&gt;

Map the description graph onto the fact graph since we are not using any other entity data graphs in this model.
&lt;pre&gt;
GraphSetup descriptionGraph = new GraphSetup(EntityGraphUri.Description);
descriptionGraph.AddTarget("http://entitystore/graph-fact");
modelSetup.AddDefaultGraph(descriptionGraph);
&lt;/pre&gt;

Create a description type based on our CBD rules.
&lt;pre&gt;
DescriptionTypeSetup cbdType = new DescriptionTypeSetup("http://entitystore/model/model-1/type-default");
cbdType.AddRulebase("http://entitystore/rulebase-cbd-description");
modelSetup.AddDefaultDescriptionType(cbdType);
&lt;/pre&gt;

Create the entity model.
&lt;pre&gt;
SemanticServerProvider provider = new SemanticServerProvider(ConnectionString);
provider.Settings.ProviderGraphUri = "http://entitystore/graph-provider";
EntityModel model = modelSetup.CreateEntityModel(provider);
&lt;/pre&gt;

That's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-7085909459152191356?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/7085909459152191356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/setting-up-entity-model.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7085909459152191356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/7085909459152191356'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/setting-up-entity-model.html' title='Setting up an Entity Model'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-717693303851433193</id><published>2009-05-04T11:41:00.000-07:00</published><updated>2009-05-04T11:59:18.743-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RdfEntity'/><title type='text'>Entity Framework Overview</title><content type='html'>The Entity framework is built on top of the Semantics.SDK and providesentity-based transactions on a RDF store such as Semantics.Server. This article will cover some of the basic concepts of the Entity framework. 

&lt;strong&gt;Entity&lt;/strong&gt;
An entity consists of two things: (1) A URI that indentifies the entity and (2) and set of RDF statements that describe the entity.  

&lt;strong&gt;Description Type&lt;/strong&gt;
A description type defines the statements associated with an entity. In the simple case just the statements with the entity URI as the subject value are considered part of the entity. In real applications an entity description is often much richer than this. A common description type is called a CBD (concise bounded description). A CBD is defined as all statements with the entity URI as the subject value plus any anonymous nodes recursively referenced by any of those statements. 

Description types can be defined using rules and/or custom .NET code. The example below shows the CBD definition using rules.
&lt;pre&gt;
RULEBASE 
(
    SELECT ?s ?p ?o ?r WHERE {?s ?p ?o. filter(?r=?s)} AS &amp;lt;description&amp;gt;
    SELECT ?s ?p ?o ?r WHERE {
        ?r ?x ?y.
        {&amp;lt;description&amp;gt;(?s, ?p, ?o, ?y)}
        filter(isblank(?y))
    } AS &amp;lt;description&amp;gt;
)
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Retrieving an Entity&lt;/strong&gt;
When an entity is retrieved using the RdfEntity framework via the EntityModel class. An entity model requires a URI for the model and a EntityServiceProvider in its constructor. We will discuss the EntityServiceProvider class later but it can be thought of as an entity store driver. 
&lt;pre&gt;
EntityModel model = new EntityModel(provider, “model:MyModel”);
model.UriResolver.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
model.UriResolver.AddNamespace("foaf", "http://xmlns.com/foaf/0.1/");
model.UriResolver.AddNamespace("model", "http://entitystore/model/model-1/");
model.UriResolver.AddNamespace("store", "http://entitystore/");

Entity derrish = model.GetEntity("model:DerrishRepchick");
derrish.DescriptionType = "model:CBD";
&amp;nbsp;
&lt;/pre&gt;
An entity is constructed when EntityModel.GetEntity is called. The entity is bound to the specifed URI and the entity model and therefore the underlying service provider. All calls on the instance of the entity will be routed through the entity model that created it. 

Notice how we set the DescriptionType property on the entity. This tells the framework which statements to retrieve for this entity. The statements are not actually retrieved until a graph is accessed for that entity. 
&lt;pre&gt;
string creator = derrish.NamedNode[EntityGraphUri.Metadata]["dc:creator"].FirstOrDefault();
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Entity Graphs&lt;/strong&gt;
An entity model is logically and/or physically partitioned into multiple graphs. The Entity framework has some well-known graphs that are defined as follows. You may choose which, if any, of these graphs to support in your entity model. However, some are required for certain features of the Entity framework.

&lt;em&gt;Ontology Graph&lt;/em&gt;
Contains statements about the onotology. This is a required graph.

&lt;em&gt;Fact Graph&lt;/em&gt;
Contains explicit facts about entities. This is a required graph.

&lt;em&gt;Description Graph&lt;/em&gt;
Contains full entity description (facts + inferences). This is a required read-only graph.

&lt;em&gt;Inference Graph&lt;/em&gt;
Contains only inferences about entities. This is an optional read-only graph.

&lt;em&gt;Metadata Graph&lt;/em&gt;
Contains metadata about the entities. This is an optional read-only graph.

&lt;em&gt;Provider Graph&lt;/em&gt;
Contains metadata about the underlying service provider. This is a required (optional for some providers) read-only graph.

&lt;strong&gt;Storing an Entity&lt;/strong&gt;
A modified entity can be stored by calling the SaveToStore method. You will want to make sure to set the correct description type on the entity before storing. It is often the case that an entity will have asymmetric description types. Meaning often more statements are retrieved then stored. For example you may retrieve facts and inferences but only want to store facts.  A similar issue exists when removing an entity from the store.

&lt;strong&gt;Service Providers&lt;/strong&gt;
The Entity framework contains a built in provider for Semantics.Server called SemanticServerProvider. This service provider allows an entity model to be maintained in a Semantics.Server database. The SemanticServerProvider has a convenient helper class for setting up an entity model called ModelSetup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-717693303851433193?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/717693303851433193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/entity-framework-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/717693303851433193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/717693303851433193'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/entity-framework-overview.html' title='Entity Framework Overview'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-8006572942609719727</id><published>2009-05-04T08:49:00.000-07:00</published><updated>2009-05-04T09:04:44.987-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Querying a graph using SPARQL</title><content type='html'>The Intellidimension Semantics.SDK supports the SPARQL syntax for querying RDF data. This article will focus on using SPARQL to query a single in-memory graph and accessing the results.

&lt;strong&gt;The DataSource.Query Method&lt;/strong&gt;
As mentioned in earlier articles, the abstract base class DataSource provides the interface to all sources of RDF data. All DataSource objects support a Query method with several overloads. The simplest overload takes a single string parameter that is the SPARQL query string to be executed on the DataSource object. The Query method returns a Table object that contains any results for the query.

&lt;strong&gt;SELECT Command&lt;/strong&gt;
One of the most commonly used SPARQL commands is the SELECT command. When executing a SELECT command against a single DataSource object the name of the graph does not need to be included in the FROM clause of the command since it is implied, as shown below.
&lt;pre&gt;
GraphDataSource g = new GraphDataSource();

Table results = g.Query(@"
  PREFIX dc: &amp;lt;http://purl.org/dc/elements/1.1/&amp;gt;
  SELECT ?title WHERE
  {&amp;lt;http://example.org/book1&amp;gt; dc:title ?title}");
&amp;nbsp;
&lt;/pre&gt;
Per the SPARQL specification, the graph pattern is matched against the statements in the DataSource object. The variables in the select list are bound as specified in the graph pattern and returned as results.

&lt;strong&gt;Query Results&lt;/strong&gt;
SPARQL commands such as the SELECT command return query results in a Table object. The Table object has a row for each distinct set of column values. The column values are defined in the select list of the SELECT command. Below is an example of how to iterate over the results of a SELECT command.
&lt;pre&gt;
for (int i = 0; i &lt; results.RowCount; i++)
RdfLiteral title = results[i][0] as RdfLiteral;
&amp;nbsp;
&lt;/pre&gt;
The Semantics.SDK provides support for the XML serialization of query results using the SPARQL result syntax, as shown below.
&lt;pre&gt;
SparqlXmlFormatter fmt = new SparqlXmlFormatter(
results, typeof(CommandSelect));
fmt.Write(stream);
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Parameterized Queries&lt;/strong&gt;
SPARQL queries can be parameterized using the Semantics.SDK via the QueryParameters object. The QueryParameter object is used to bind a RdfValue object to a named parameter that is specified in the query using the @ character followed by any valid variable name. A query parameter can be used anywhere that a query variable can be specified. Below shows an example of the use of a query parameter in a SPARQL SELECT command.
&lt;pre&gt;
QueryParameters qp = new QueryParameters();
qp.Add("id", new RdfUri("http://example.org/"));

g.Query(@"SELECT ?s ?p ?o WHERE
{?s ?p ?o. filter(?s=@id)}", qp);
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Conclusion&lt;/strong&gt;
This article provided an introduction to the objects and methods used to execute a SPARQL query and access the results using the Semantics.SDK. However this article did not provide much insight into the Semantics.SDK support for all the SPARQL commands and extensions. The Semantics.SDK supports a variety of SPARQL commands such as: SELECT, DESCRIBE, CONSTRUCT, ASK, INSERT, and DELETE. In addition, it provides support for inference rules and a variety of extension functions. These will all be discussed in future articles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-8006572942609719727?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/8006572942609719727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/querying-graph-using-sparql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8006572942609719727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8006572942609719727'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/querying-graph-using-sparql.html' title='Querying a graph using SPARQL'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-961628137339589007</id><published>2009-05-04T08:39:00.000-07:00</published><updated>2009-05-04T09:38:02.973-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Reading and writing a RDF Graph</title><content type='html'>The Intellidimension Semantics.SDK contains a suite of RDF readers and formatters for .NET. These allow applications to read and write serialized RDF data from and to streams.

&lt;strong&gt;RdfReader and RdfFormatter
&lt;/strong&gt;The Semantics.SDK has two abstract base classes that provide the interfaces for reading and formatting RDF data, respectively. These base classes provide an interface that allows each to operate on an instance of a stream object that must be created in the application code prior to using either of these classes. This allows the RdfReader and RdfFormatter classes to operate on virtually any source that supports the TextReader or TextWriter interface as defined in System.IO. The RdfReader class is design to read data from a stream into an instance of a DataSource. While the RdfFormatter class will write data from an instance of a DataSource to a stream.

&lt;strong&gt;RDF Syntaxes&lt;/strong&gt;
The Semantics.SDK supports most of the standard RDF syntaxes. The table below lists the RDF syntax along with the RdfReader and RdfFormatter classes that implement the serialization for that syntax.

RDF/XML: RdfXmlReader, RdfXmlFormatter
N Triples: NTriplesReader, NTriplesFormatter
Turtle: TurtleReader, TurtleFormatter
RDFa: RdfaReader

&lt;strong&gt;Reading RDF
&lt;/strong&gt;In the Semantics.SDK, all RDF graphs derive from the base class DataSource. This base class defines several overloaded Read methods for loading RDF data into an instance of a DataSource. The Read method is used to load RDF data into the DataSource from a string, stream or location specified as a URI. Each of these overloaded methods provides the option of specifying the default base URI for any relative URIs used in the RDF data.

The code below shows an example of how to read a RDF/XML file into an in-memory graph. Note, that one of the overloaded Read methods is a generic method in which the class of the RdfReader is specified.
&lt;pre&gt;
GraphDataSource g = new GraphDataSource();
StreamReader s = new StreamReader(@"c:\sample.rdf");
g.Read&lt;rdfxmlreader&gt;(s);
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Writing RDF&lt;/strong&gt;
The DataSource class also defines several overloaded Format methods for writing RDF data from an instance of a DataSource to a string or stream. Like the Read method, the Format method also has an overloaded generic form in which the class of the RdfFormatter is specified.
The code below shows an example of how to store the contents of an in-memory graph to a file using the N Triples syntax.
&lt;pre&gt;
GraphDataSource g = new GraphDataSource();
StreamWriter s =
    new StreamWriter(@"c:\sample.rdf");
g.Format&lt;ntriplesformatter&gt;(s);
&amp;nbsp;
&lt;/pre&gt;
The code below shows an example of how to store the contents of an in-memory graph to a string using the turtle syntax.
&lt;pre&gt;
GraphDataSource g = new GraphDataSource();
String s = g.Format&lt;turtleformatter&gt;();
&amp;nbsp;
&lt;/pre&gt;
&lt;strong&gt;Conclusion&lt;/strong&gt;
This article provided a brief introduction into how to serialize RDF data to and from a stream. The Semantics.SDK also allows RDF data to be stored and retrieved from a Microsoft SQL Server® database using Intellidimension Semantics.Server. This will be discussed in detail in future articles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-961628137339589007?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/961628137339589007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/intellidimension-semantics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/961628137339589007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/961628137339589007'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/intellidimension-semantics.html' title='Reading and writing a RDF Graph'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-778210803395389129</id><published>2009-05-04T07:18:00.000-07:00</published><updated>2009-05-04T09:01:49.396-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Getting Started'/><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>Getting Started with Graphs</title><content type='html'>The Intellidimension Semantics.SDK provides a simple object-oriented API for working with RDF data using Microsoft .NET. The most basic structure for managing RDF data is a graph, which is a collection of RDF statements. This article will focus on the basic interface the Semantics.SDK provides for manipulating statements in a graph.

&lt;strong&gt;In-memory Graphs&lt;/strong&gt;
The Semantics.SDK provides an abstract base class DataSource that provides an interface for working with a RDF graph. The most commonly used implementation of a DataSource is the GraphDataSource which implements an in-memory RDF graph.

&lt;strong&gt;Adding Statements
&lt;/strong&gt;One of several ways statements can be added to any DataSource via its Add method.

&lt;pre&gt;
GraphDataSource g = new GraphDataSource();

g.Add(new RdfUri("http://www.intellidimension.com/sdj.pdf"),
new RdfUri("http://www.w3.org/2000/01/rdf-schema#label"),
new RdfLiteral("Getting Started With Graphs"));
&amp;nbsp;
&lt;/pre&gt;
The parameters to the Add method specify the subject, predicate and object values, respectively, of the statement to be added to the graph. There are several overloads to the Add method.

&lt;strong&gt;Removing Statements
&lt;/strong&gt;Similarly, a statement can be removed from a DataSource by calling it’s Remove method and specify the subject, predicate and object values of the statement to be removed. Any one of these parameters can be set to null. In that case the parameters for the Remove method act as a statement mask where each null value is treated as a wildcard value for matching statements in the DataSource. In this manner multiple or all the statement can be removed from the DataSource with a single call.
&lt;strong&gt;&lt;/strong&gt;
&lt;strong&gt;Getting Statements&lt;/strong&gt;
A DataSource object is a collection of RDF statements each represented by an instance of the class Statement. All DataSource objects provide access to the collection of statements via their GetStatements method. The code below shows how to iterate over all the statements in a DataSource.

&lt;pre&gt;
foreach (Statement stmt in g.GetStatements())
{
    RdfValue s = stmt.Subject;
    RdfValue p = stmt.Predicate;
    RdfValue o = stmt.Object;
}
&amp;nbsp;
&lt;/pre&gt;
For each Statement the Subject, Predicate and Object properties are retrieved as an instance of the RdfValue class.

&lt;strong&gt;The RdfValue Class&lt;/strong&gt;
The RdfValue class is an abstract base class that is used to represent subject, predicate and object values of a statement. A RDF resource is represented by the RdfUri class and a RDF literal is represented by the RdfLiteral class.

&lt;pre&gt;
double d = (double)(RdfLiteral)stmt.Object;
DateTime dt = (DateTime)(RdfLiteral)stmt.Object;
&amp;nbsp;
&lt;/pre&gt;
The RdfValue class is widely used throughout the Semantics.SDK and it supports some conveniences such as conversion operators to simplify the integration with other data types in .NET.

&lt;strong&gt;Conclusion&lt;/strong&gt;
This article provided a brief introduction into how to manipulate statements in an RDF graph. The Semantics.SDK provides other capabilities such as issuing queries to graphs that will be discussed in future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-778210803395389129?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/778210803395389129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/getting-started-with-graphs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/778210803395389129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/778210803395389129'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/getting-started-with-graphs.html' title='Getting Started with Graphs'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-2105782903982964468</id><published>2009-05-04T06:34:00.000-07:00</published><updated>2009-05-04T08:12:53.971-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.Server'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>What is Semantics.Server?</title><content type='html'>&lt;div&gt;Semantics.Server is a set of .NET assemblies that are installed on Microsoft SQL Server enabling it to store, query and perform inferencing on RDF data. All the RDF data stored using Semantics.Server is backed by relational tables thereby leveraging the capabilities of Microsoft SQL Server. Even inferencing can be backed by relational tables. This eliminates memory limits that are often reached when executing inference rules over large models.

An evaluation copy of Semantics.Server can be downloaded from:

&lt;a href="http://www.intellidimension.com/"&gt;http://www.intellidimension.com/&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-2105782903982964468?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/2105782903982964468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/what-is-semanticsserver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2105782903982964468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/2105782903982964468'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/what-is-semanticsserver.html' title='What is Semantics.Server?'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4419023952639712437.post-8933994575329060156</id><published>2009-05-04T06:20:00.000-07:00</published><updated>2009-05-04T10:10:34.120-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='Semantics.SDK'/><title type='text'>What is the Semantics.SDK?</title><content type='html'>The Semantics.SDK is a commercially available product for adding semantics based computing to your .NET application. It consists of visual tools for working if RDF, RDFS/OWL ontologies, SPARQL queries and inference rules. These tools are based on a complete .NET based API that is also available to the developer.

Semantics.SDK features:
&lt;ul&gt;&lt;li&gt;In-memory RDF graphs&lt;/li&gt;
&lt;li&gt;SPARQL query engine&lt;/li&gt;
&lt;li&gt;Inference engine&lt;/li&gt;
&lt;li&gt;Extensible data service interface for integration&lt;/li&gt;
&lt;li&gt;API for Semantics.Server&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;An evaluation copy of Semantics.SDK can be downloaded from:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.intellidimension.com/"&gt;http://www.intellidimension.com/&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4419023952639712437-8933994575329060156?l=semanticsdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://semanticsdotnet.blogspot.com/feeds/8933994575329060156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/what-is-semanticssdk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8933994575329060156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4419023952639712437/posts/default/8933994575329060156'/><link rel='alternate' type='text/html' href='http://semanticsdotnet.blogspot.com/2009/05/what-is-semanticssdk.html' title='What is the Semantics.SDK?'/><author><name>Derrish Repchick</name><uri>http://www.blogger.com/profile/07970771168387327881</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
