Turtle version of the primer's ontology (was Re: Some comments on the Primer document)

Bijan,

thanks to a long waiting at Logan airport yesterday, and in the hotel 
lounge beforehand when was already kicked off my room:-), I attach the 
turtle translation of the whole appendix. I have run it through a turtle 
validator[1]. It almost validates except for the lines at the very end:

[ ] a owl:AllDifferent;
     owl:distinctMembers ( :John :Mary :Bill :Susan )

because the validator does not understand the idiom of using [] in 
subject position for an (unnamed) bnode (though this is clearly valid 
syntax per[2]).

I think if this could be added to the primer appendix, this could be a 
good start. I saw that you started to edit the document again, I did not 
want to touch it for fear of messing up. I also think it could be a good 
idea to add a turtle example to 1-2 places at the beginning of the 
document (ie, new button, things like that) just to show the result. If 
there is a decision of the group (maybe at the f2f?) as for how to go on 
syntax-wise, I am happy to help in adding the examples overall.

B.t.w.: a simple autotranslation was not really a winner. For a primer 
the proper organization, indentation, to be as close as possible to the 
RDF/XML to be able to compare them, etc, were also important and my 
first attempt to just run it through an automatic translation did not 
cut it (although I did not spend too much time). Ie, most of it is 
manual work (thanks to Logan aiport!:-)

Ivan

[1] http://rdfabout.com/demo/validator/
[2] http://www.w3.org/TeamSubmission/turtle/


Bijan Parsia wrote:
> 
> On 28 Mar 2008, at 18:03, Ivan Herman wrote:
> 
>> Bijan Parsia wrote:
>>>> 2. I am on record saying that I would like to have Turtle added to 
>>>> this document as an alternative (and much more readable) syntax. I 
>>>> want to put my money where my mouth is, so I will try to make a 
>>>> turtle version of the RDF/XML ontology in the appendix; I hope to do 
>>>> that before the f2f. Is that o.k. with you?
>>> Feel free, but I remind you that I'm aiming for automated 
>>> translation, so your effort might be wasted work, in some sense. I'm 
>>> also still thinking about the particular example and whether it's ideal.
>>> (Indeed, autotranslating the whole ontology is easy, it's doing the 
>>> individual fragments that's a bit of a pita..not hard, merely a touch 
>>> tedious. If having the whole ontology translated would suffice for 
>>> you I can run the owl api and do it.)
>>
>> My ideal would be to have the turtle be integral part of the document, 
>> just like RDF/XML and the rest.
> 
> Oh, that's the goal, no doubt. It's just a bit tedious at the moment 
> such that I'd rather spend my time working on other bits or on 
> autotranslation. If you want to do it, I won't stop you at all. Just 
> don't wack me if the day after you finish an autotranslation mechanism 
> goes on line or I change the example entirely. As long as you are ok 
> with that, go ahead.
> 
> My point about the end is that it's very easy to translate and 
> incorporate a "whole ontology" so I don't worry about wasted work there.
> 
> If your concern is merely signaling, then you could translate the first 
> few or we could put up a note. If you think it'll help feedback to have 
> all the examples in turtle, then we should do that.
> 
>> Autotranslating is indeed doable, though probably one would have to 
>> massage to output a bit to make it more readable. But, of course, 
>> doing the individual fragment that is, well,...
> 
> I think it's fully doable.
> 
>> O.k. Then let me turn the question back to you:-): what can I do to 
>> help this process?
> 
> Help with the autotranslator framework? Or, if you are ok with the 
> translation maybe being thrown out, you can, of course, do it by hand. 
> Obviously, more syntaxes sooner is better, but you should judge whether 
> it's worth your effort.
> 
> Cheers,
> Bijan.
> 
> 

-- 

Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
PGP Key: http://www.ivan-herman.net/pgpkey.html
FOAF: http://www.ivan-herman.net/foaf.rdf
@prefix :		<http://example.com/owl/families#> .
@prefix owl:	<http://www.w3.org/2002/07/owl#> .
@prefix owl11:	<http://www.w3.org/2006/12/owl11#> .
@prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:	<http://www.w3.org/2001/XMLSchema#> .
@prefix f:		<http://example.com/owl/families#> .
@prefix g:		<http://two.example.com/owl2/families#> .

<http://example.com/owl/families> a owl:Ontology;
	owl:imports <http://two.example.com/owl2/families.owl> 
.

:hasAncestor a owl:ObjectProperty, owl:TransitiveProperty, owl11:IrreflexiveProperty .

:hasChild a owl:ObjectProperty;
	rdfs:subPropertyOf		:hasAncestor;
	rdfs:domain				:Person;
	rdfs:range				:Person;
	owl:equivalentProperty	g:child
.

:hasDaughter a owl:ObjectProperty;
	rdfs:range 
		[ a owl:Class;
			owl:intersectionOf 
				( :Person 
				  [ a owl:Restriction; owl:onProperty :hasGender; owl:hasValue :female] 
				)
		];
	rdfs:range                     :Person;
	rdfs:domain                    :Person;
	rdfs:subPropertyOf             :hasChild;
	rdfs:domain                    :Parent;
	owl11:disjointObjectProperties :hasSon
.

:hasGender a owl:ObjectProperty .
      
:hasHusband owl:inverseOf :hasWife .

:hasSon a owl:ObjectProperty;
	rdfs:range 
		[ a owl:Class;
			owl:intersectionOf 
				( :Person 
				  [ a owl:Restriction; owl:onProperty :hasGender; owl:hasValue :male] 
				)
		];
	rdfs:range			:Person;
	rdfs:domain			:Person;
	rdfs:subPropertyOf	:hasChild;
	rdfs:domain			:Parent
.

:hasSpouse a owl:ObjectProperty, owl:SymmetricProperty, owl11:IrreflexiveProperty .

:hasWife a	owl:ObjectProperty, owl:InverseFunctionalProperty, 
			owl:FunctionalProperty, owl11:AsymmetricProperty, 
			owl11:IrreflexiveProperty;
	rdfs:domain 		:Person;
	rdfs:range  		:Person;
	rdfs:subPropertyOf	:loves;
	rdfs:range			:Woman;
	rdfs:subPropertyOf :hasSpouse;
	rdfs:domain 		:Man
.
    
:loves a owl:ObjectProperty;
	rdfs:domain :Person
.

:hasAge a owl:DatatypeProperty, owl:FunctionalProperty;
	rdfs:domain				:Person;
	rdfs:range				xsd:integer;
	owl:equivalentProperty	g:age
.

:Adult a owl:Class;
	owl:equivalentClass 
		[ a owl:Class;
			owl:intersectionOf 
				(
					:Person
					[ a owl:Restriction;
						owl:onProperty :hasAge;
						owl:someValuesFrom 
							[ a owl:DataRange;
								owl11:onDataRange 	xsd:integer;
								owl11:minInclusive	"21"^^xsd:int;
							]
					]
				);
		];
	owl:equivalentClass g:Grownup
.
	
:Child a owl:Class;
	owl:equivalentClass 
		[ a owl:Class;
			owl:intersectionOf 
				(
					:Person
					[ a owl:Class;
						owl:complementOf 
							[ a owl:Restriction;
								owl:onProperty :hasAge;
								owl:someValuesFrom 
									[ a owl:DataRange;
										owl11:onDataRange 	xsd:integer;
										owl11:minInclusive	"21"^^xsd:int;
									]
							]
					]
				)
		]
.
     
:CivilMarriage a owl:Class .     
     
:Man a owl:Class;
	rdfs:subClassOf :Parent;
	owl:equivalentClass 
		[ a owl:Class;
			owl:intersectionOf 
				(
					:Person
					[ a owl:Restriction;
						owl:onProperty :hasGender;
						owl:hasValue   :male;
					]
				)
		]
.
	
:Marriage a owl:Class;
	owl:equivalentClass
		[ a owl:Class;
			owl:unionOf ( :CivilMarriage :ReligiousMarriage )
		]
.
     
:Narcissist a owl:Class;
	owl:equivalentClass
		[ a owl:Class;
			owl:intersectionOf ( [ a owl11:SelfRestriction; owl:onProperty :loves ] :Person )
		]
.

:Parent a owl:Class;
	rdfs:subClassOf :Parent;
	owl:equivalentClass
		[ a owl:Class;
			owl:intersectionOf 
				( [ a owl:Restriction;
  					  owl:onProperty      :hasChild;
					  owl11:onClass       :Person;
					  owl:minCardinalityQ "1"^^xsd:nonNegativeInteger
				  ]
				  :Person
				)
		]
.

:Person a owl:Class;
	rdfs:subClassOf 
		[ a owl:Class;
			owl:intersectionOf 
				(
					[ a owl:Restriction;
						owl:onProperty :hasGender;
						owl:allValuesOf
							[ a owl:Class;
								owl:oneOf ( :female :male )
							]
					]
					[ a owl:Restriction;
						owl:onProperty  :hasGender;
						owl:cardinality "1"^^xsd:nonNegativeInteger
					]
					[ a owl:Restriction;
						owl:onProperty  :hasAge;
						owl:cardinality "1"^^xsd:nonNegativeInteger
					]
				)
		]
.

:ReligiousMarriage owl:disjointWith :CivilMarriage .

:Teenager a owl:Class;
	owl:equivalentClass
		[ a owl:Class;
			owl:intersectionOf 
				(
					:Person
					[ a owl:Restriction;
						owl:onProperty :hasAge;
						owl:someValuesFrom
							[ a owl:DataRange;
								owl11:minInclusive "13"^^xsd:int;
								owl11:maxInclusive "20"^^xsd:int;
								owl11:onDataRange xsd:integer;
							]
					]
				)
		]
.

:Woman a owl:Class;
	rdfs:subClassOf :Parent;
	owl:equivalentClass
		[ a owl:Class;
			owl:intersectionOf
				(
					:Person
					[ a owl:Restriction;
						owl:onProperty :hasGender;
						owl:hasValue   :female
					]
				)
		]
.

:YoungChild a owl:Class;
	owl:equivalentClass
		[ a owl:Class;
			owl:intersectionOf
				(
					:Person
					[ a owl:Class;
						owl:complementOf
							[ a owl:Class;
								owl:unionOf ( :Adult :Teenager )
							]
					]
				)			
		]
.

:Bill a [ a owl:Class; owl:complementOf :Narcissist ];
	:hasAge    "13"^^xsd:integer;
	:hasGender :male
.
     
:Ellen a  [ a owl:Restriction;
			  owl:onProperty :hasAge;
			  owl:someValuesFrom 
				 [ a owl:DataRange;
					 owl11:minInclusive "15"^^xsd:int;
					 owl11:maxInclusive "21"^^xsd:int;
					 owl11:onDataRange  xsd:integer;
				 ]
		  ]
.

:Emily a [ a owl:Restriction;
			 owl:onProperty :hasAge;
			 owl:someValuesFrom
			 	 [ a owl:DataRange;
			 		 owl:oneOf ( "39"^^xsd:integer "49"^^xsd:integer )
			 	 ]
		 ]
.

[ ] a owl11:NegativeDataPropertyAssertion;
	rdf:subject   :Jack;
	rdf:predicate :hasAge;
	rdf:object    "53"^^xsd:integer
.

:Jeff a [ a owl:Restriction; owl:onProperty :hasChild; owl:cardinality "2"^^xsd:nonNegativeInteger ];
	:hasAge 	"77"^^xsd:integer;
	:hasChild 	:Ellen;
	:hasWife 	:Emily;
	:loves 		:Jeff;
	:hasChild 	:Jack
.

:John a :Person;
	:hasDaughter 	:Susan;
	:hasGender 		:male;
	:hasWife 		:Mary;
	:hasSon 		:Bill;
	:hasAge 		"33"^^xsd:integer;
	owl:sameAs		:Jack
.

:Mary a :Person;
	:hasAge			"31"^^xsd:integer;
	:hasGender		:female;
	:hasSon			:Bill;
	:hasDaughter	:Susan
.

:Susan 
	:hasAge		"8"^^xsd:integer;
	:hasGender	:female
.

:female owl:sameAs g:feminine .

:male owl:sameAs g:masculine .


[ ] a owl:AllDifferent;
	owl:distinctMembers ( :John :Mary :Bill :Susan )

[ ] a owl:AllDifferent;
	owl:distinctMembers ( :Jeff :Emily :Jack :Ellen : Susan )
	
[ ] a owl:AllDifferent;
	owl:distinctMembers ( :male :female )

( :hasSpouse :hasSon ) rdfs:subPropertyOf :hasSon .	
	
( :hasSpouse :hasDaughter ) rdfs:subPropertyOf :hasDaughter .	

Received on Monday, 31 March 2008 13:36:42 UTC