This HTML5 document contains 34 embedded RDF statements represented using HTML+Microdata notation.

The embedded RDF content will be recognized by any processor of HTML5 Microdata.

PrefixNamespace IRI
dctermshttp://purl.org/dc/terms/
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n12http://vos.openlinksw.com/dataspace/services/wiki/
n9http://vos.openlinksw.com/wiki/main/VOS/VirtSPASQLRDFDemoImageText/NotesForm.
oplhttp://www.openlinksw.com/schema/attribution#
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
dchttp://purl.org/dc/elements/1.1/
n18http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtSPASQLRDFDemoImageText/sioc.
n15http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n11http://rdfs.org/sioc/services#
siocthttp://rdfs.org/sioc/types#
n7http://vos.openlinksw.com/dataspace/person/dav#
n4http://vos.openlinksw.com/dataspace/owiki/wiki/
n6http://vos.openlinksw.com/wiki/main/VOS/VirtSPASQLRDFDemoImageText/MoreButton.
n10http://vos.openlinksw.com/wiki/main/VOS/VirtSPASQLRDFDemoImageText/ImageWindow.
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n21http://vos.openlinksw.com/dataspace/owiki#
xsdhhttp://www.w3.org/2001/XMLSchema#
n20http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
n22http://docs.openlinksw.com/virtuoso/rdfdatarepresentation.html#
Subject Item
n7:this
foaf:made
n2:VirtSPASQLRDFDemoImageText
Subject Item
n15:this
sioc:creator_of
n2:VirtSPASQLRDFDemoImageText
Subject Item
n12:item
n11:services_of
n2:VirtSPASQLRDFDemoImageText
Subject Item
n21:this
sioc:creator_of
n2:VirtSPASQLRDFDemoImageText
Subject Item
n4:VOS
sioc:container_of
n2:VirtSPASQLRDFDemoImageText
atom:entry
n2:VirtSPASQLRDFDemoImageText
atom:contains
n2:VirtSPASQLRDFDemoImageText
Subject Item
n2:VirtSPASQLRDFDemoImageText
rdf:type
atom:Entry sioct:Comment
dcterms:created
2017-06-13T05:49:15.626218
dcterms:modified
2017-06-29T07:40:19.922946
rdfs:label
VirtSPASQLRDFDemoImageText
foaf:maker
n7:this n20:this
dc:title
VirtSPASQLRDFDemoImageText
opl:isDescribedUsing
n18:rdf
sioc:has_creator
n15:this n21:this
sioc:attachment
n6:png n9:png n10:png
sioc:content
---+Extending RDFDemo to Display Images and Longer Text Fields This document will guide you through extending<nowiki> RDFDemo</nowiki> so that longer text fields can be displayed as a block of text and so that links to images and web pages can be viewed in a browser window. ---+++Pre-requisites 1. A working copy of the RDFDemo application created in [[VirtSPASQLRDFDemoModifyNorthwind][Modifying the Northwind Ontology to Add Labels]]. ---++Modifying the Application. ---+++Displaying Text We will modify the form that show the details of the selected item so that when the text in the boxes is too long to be seen in full a button will appear beside the box on the form and if you click the button the complete text will be displayed in a separate window. 1. Add a new class, <nowiki>MoreButton</nowiki> that extends System.Windows.Forms.Button. * In the <b>Solution Explorer</b> right click on the <nowiki>RDFDemo</nowiki> project and select <b>Add</b> then <b>New Item</b>. * Add a new class called <nowiki>MoreButton.cs</nowiki>. <br><img src="%ATTACHURLPATH%/MoreButton.png" style="wikiautogen"/> * The following using statement goes at the top of the file: <verbatim> using System.Windows.Forms; </verbatim> * The <nowiki>MoreButton</nowiki> class must inherit from System.Windows.Forms.Button so the class definition line should look like this <verbatim> class MoreButton : Button </verbatim> * Add the following code to the body of the <nowiki>MoreButton</nowiki> class: <verbatim> String longText; public MoreButton(String text) { longText = text; this.Text = "More"; } protected override void OnClick(EventArgs e) { Form moreForm = new Form(); TextBox moreBox = new TextBox(); moreBox.Text = longText; moreBox.Width = 300; moreBox.Height = 250; moreBox.ScrollBars = ScrollBars.Vertical; moreBox.Multiline = true; moreBox.WordWrap = true; moreBox.Select(0, 0); moreBox.ReadOnly = true; moreForm.Controls.Add(moreBox); moreForm.Width = 320; moreForm.Height = 280; moreForm.ShowDialog(); } </verbatim> 1. In <nowiki>displayData</nowiki> in the <nowiki>ExtendedStringHandler</nowiki> class, when the labels and <nowiki>TextBoxes</nowiki> are added to the form check if the text is too big for the box. If it is then add a <nowiki>MoreButton</nowiki> that will display all the text in a separate window. <verbatim> if (textBoxList[i].DataBindings[0].DataSource.ToString().Length > 80 &amp;&amp; !(textBoxList[i].DataBindings[0].DataSource is SqlExtendedString)) { moreButtonList.Add(new MoreButton(textBoxList[i].DataBindings[0].DataSource.ToString())); moreButtonList[moreButtonList.Count - 1].Location = new Point(550, i * 22 + 50); describeForm.Controls.Add(moreButtonList[moreButtonList.Count -1]); } </verbatim> 1. We will also need a list to hold the buttons as they are created so the following needs to be added to the member variables at the top of the <nowiki>ExtendedStringHandler</nowiki> class. <verbatim> List<MoreButton> moreButtonList = new List<MoreButton>(); </verbatim> 1. Build and run the application. If you click through to an Employee page you will see the Notes field now has a button labeled More next to it. If you click on that button the text from the Notes field is displayed in a new window. <br><img src="%ATTACHURLPATH%/NotesForm.png" style="wikiautogen"/> ---+++Displaying Images and Web Pages Next we will modify the form so that item identified as images or web pages will be opened in a browser window. Again we will do this by adding a button beside the box on the form that will open the browser window. 1. Add a new class, <nowiki>OpenButton</nowiki> that extends System.Windows.Forms.Button. * In the <b>Solution Explorer</b> right click on the <nowiki>RDFDemo</nowiki> project and select <b>Add</b> then <b>New Item</b> * Add a new class called <nowiki>OpenButton.cs.</nowiki> * The following using statement goes at the top of the file: <verbatim> using System.Windows.Forms; </verbatim> * The <nowiki>OpenButton</nowiki> class must inherit from System.Windows.Forms.Button so the class definition line should look like this <verbatim> class OpenButton : Button </verbatim> * Add the following code to the body of the <nowiki>OpenButton</nowiki> class: <verbatim> String urlText; public OpenButton(String text) { urlText = text; this.Text = "Open"; } protected override void OnClick(EventArgs e) { System.Diagnostics.Process.Start(urlText); } </verbatim> 1. In <nowiki>displayData</nowiki> in the <nowiki>ExtendedStringHandler</nowiki> class, where we added the code to check for long text fields we now need to check for IRIs that identify images and web pages. As a simple first attempt we will check for matching labels. So for example, if a property label is 'image' or 'webpage', we will assume it can be opened in a browser window and put an <nowiki>OpenButton</nowiki> beside it. <verbatim> if (labelList[i].Text == "website" || labelList[i].Text == "image" || labelList[i].Text == "depiction" || labelList[i].Text == "page" || labelList[i].Text == "url" || labelList[i].Text == "image skyline") { openButtonList.Add(new OpenButton(textBoxList[i].DataBindings[0].DataSource.ToString())); openButtonList[openButtonList.Count - 1].Location = new Point (550, i * 22 + 50); describeForm.Controls.Add(openButtonList[openButtonList.Count - 1]); } </verbatim> 1. We will also need a list to hold the buttons as they are created so the following needs to be added to the member variables at the top of the <nowiki>ExtendedStringHandler</nowiki> class. <verbatim> List<OpenButton> openButtonList = new List<OpenButton>(); </verbatim> 1. Build and run the application. If you click through to an Employee page now you will see that the Image field now has a button labeled Open next to it. If you click on that button the image is opened in your default browser. <br><img src="%ATTACHURLPATH%/ImageWindow.png" style="wikiautogen"/> ---++ Next Steps It has already been mentioned that the property labels are also dereferenceable [[http://docs.openlinksw.com/virtuoso/rdfdatarepresentation.html#rdfiriidtype][IRIs]]. We used this feature to find a short name to display rather that the complete [[http://docs.openlinksw.com/virtuoso/rdfdatarepresentation.html#rdfiriidtype][IRI]]. The next step is to make the labels clickable so the ontology itself can also be explored. [[VirtSPASQLRDFDemoClickableLabels][Extending RDFDemo To Make The Property Labels Clickable]]
sioc:id
4c7cecdc1afdf40a09805e1ec2756da7
sioc:link
n2:VirtSPASQLRDFDemoImageText
sioc:has_container
n4:VOS
n11:has_services
n12:item
atom:title
VirtSPASQLRDFDemoImageText
sioc:links_to
n2:VirtSPASQLRDFDemoClickableLabels n22:rdfiriidtype
atom:source
n4:VOS
atom:author
n7:this
atom:published
2017-06-13T05:49:15Z
atom:updated
2017-06-29T07:40:19Z
sioc:topic
n4:VOS