CS 6795 Semantic Web Techniques

Lab 1


Syllabus
Assigns
Notes
Labs
Project
Resources

Create your own XML DTD, XSD, and RNC or RNG

 

Consider these examples of XML documents for clause sets consisting of zero or more facts f (Prolog: f.) and zero or more 'backward' rules c <= p (Prolog: c :- p.), in any order ("myurl" will be replaced as explained below):

<?xml version="1.0" standalone="no"?>
<!DOCTYPE clauses SYSTEM "myurl">
 <clauses>
    <fact> f </fact>
    <rule> <conc> c </conc> <prem> p </prem> </rule>
 </clauses>
 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE clauses SYSTEM "myurl">
<clauses>
    <rule> <conc> c1 </conc> <prem> p1 </prem> </rule>
    <fact> f1 </fact>
    <rule> <conc> c2 </conc> <prem> p2 </prem> </rule>
    <fact> f2 </fact>
    <fact> f3 </fact>
</clauses>

 

Inductively complete this XML DTD (overwrite the "..." lines) for such clause sets:

 

<!ELEMENT clauses   (................)>
<!ELEMENT rule   (................)>
<!ELEMENT fact    (#PCDATA)>
<!ELEMENT ........    (................)>
<!ELEMENT ........    (................)>

Upload a file containing (just) your completed DTD somewhere in your personal Web space under a URL of your choice, here called "myurl".

Validate the above document examples and other ones online:
 
Go to

http://validator.w3.org/#validate_by_input

 

Paste in and edit the examples at “Enter the Markup to validate:”
as illustrated below for myurl  =  http://www.cs.unb.ca/~boley/cs6795swt/country-address.dtd
(already uploaded - on the course site - for convenience):
 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE address SYSTEM "http://www.cs.unb.ca/~boley/cs6795swt/country-address.dtd">
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
<country>Germany</country>
</address>

 

Hit the 'Check' button
You should basically get:

This document was successfully checked … .


You can now experiment with variations of the original XML DTD and document examples.


XSD

If you reformulate the original XML DTD into an XML Schema Definition (XSD), the Validome validator for XML Schema at http://www.validome.org/xml/validate/ can be employed instead.

You can do this DTD-XSD reformulation in analogy to the reformulation of the Country Address example in the Lecture Notes. For getting familiar with XSV, you can experiment with the example’s uploaded instance and XSD here (in some browsers, to see XML details, you have to enter control-U or select Tools | Web Developer | Page Source):

http://www.cs.unb.ca/~boley/cs6795swt/address.xml
http://www.cs.unb.ca/~boley/cs6795swt/country-address.xsd

Then copy & edit these for your personal Web space, working your way from the <address> example to the <clauses> example.


RNC and RNG

If you reformulate the original EBNF grammar / XML DTD into Relax NG Compact Syntax (RNC) or reformulate the above XML XSD into Relax NG XML Syntax (RNG), Henri Sivonen’s validation service at http://validator.nu can be employed instead.

You can do these reformulations in analogy to the reformulations of the Country Address example in the Lecture Notes. For getting familiar with Validator.nu, you can experiment with the example’s uploaded instance and RNC or RNG here (at ‘Address’, copy the instance URL; at ‘Schemas’, copy the RNC or RNG URL; select “Be lax about HTTP Content-Type” and possibly “Show Source”):

http://www.cs.unb.ca/~boley/cs6795swt/address.xml
http://www.cs.unb.ca/~boley/cs6795swt/country-address.rnc
http://www.cs.unb.ca/~boley/cs6795swt/country-address.rng

Then copy & edit these for your personal Web space, working your way from the <address> example to the <clauses> example.

 

 


Maintained by Harold Boley