CS 6795 Semantic Web Techniques

Lab 1


Syllabus
Assigns
Notes
Labs
Project
Resources

Create your own XML DTD and XSD


DTD

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 ........    (................)>

Put 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://www.stg.brown.edu/service/xmlvalid/

 

> Paste in and edit the examples at

Text:

 Suppress warning messages
 Relax namespace checks

  

 

 
> Hit the 'Validate' button
> You should basically get:
Document validates OK.
 

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), W3C's XSV Validator for XML Schema at http://www.w3.org/2001/03/webdata/xsv 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 XSD instance and schema here:

http://www.ruleml.org/temp/swt/address.xml
http://www.ruleml.org/temp/swt/country-address.xsd

Just copy & edit these to work your way from the <address> example to the <clauses> example.

 


Maintained by Bruce Spencer