Re: OWL2 questions

On Tue, May 5, 2009 at 9:21 AM, Thomas Loertsch <loertsch.thomas@guj.de> wrote:
> hello list,
>
> i'm working on a mapping of microformats to rdf. i'm trying to capture all
> the properties of every element of every microformat as well as the
> restrictions on element values. the task is bigger than i had thought
> (hoped) and especially the modelling of the value constraints is rather
> tricky. i have no local OWL guru whom i could pester with detailed questions
> so i'm turning to you, list.
> the full draft of the mapping can be found at http://purl.org/amicroformat

This url doesn't resolve - you need to have a trailing "/"

http://purl.org/amicroformat/

> (a N3 version ready for human consumption as well as a machine generated
> rdf/xml version) but that's a long read. i would be very grateful if someone
> could comment on the following constructs. are they correct? do they express
> what the rdfs:comments suggest? did i get the use of unionOf and
> intersectionOf right? or should i have used oneOf? and what about the blank
> nodes - do they "sit" right?
>
>
> the method element for example i still quite simple. the original
> microformat says "The field MAY include valid HTML markup e.g. paragraphs or
> a list for steps in the method." so both xsd:strings and html are correct.
> that's why i used unionOf
>
>
> :method
>  a  owl:DatatypeProperty ;
>  rdfs:label  "method" ;
>  rdfs:isDefinedBy <http://microformats.org/wiki/hrecipe#method> ;
>  rdfs:domain :Recipe ;
>  rdfs:range
>    [ a owl:Restriction ;
>      owl2:onDatatype
>      [ owl:unionOf
>         ( xsd:string
>           <http://www.w3.org/TR/html/> )
>        ] ;
>      rdfs:comment "The field MAY include valid HTML markup e.g. paragraphs
> or a list for steps in the method."
>                       ] ;
>  rdfs:comment
>    "The method of the recipe."

Find below some translations of the above. Some notes:

- I give two versions as regards the second rdfs:comment as I wasn't
sure whether you wanted the comment "The field ...." to be an
annotation on :method or on the axiom asserting the range. I think the
correct one is to have the comment on :method, as the subject of the
comment is "The field", rather than the range axiom.

- One doesn't use owl:Restriction in this place - it is used in
certain class expressions, rather than in asserting a range or domain.
Hoever, it is the case that DataPropertyRange( DPE DR ) means the same
thing as SubClassOf( owl:Thing DataAllValuesFrom( DPE DR ) ), and in
that case one would use owl:Restriction.  I give an example of this
formulation below (3)

- There is no owl2 namespace, just owl.

- I don't think <http://www.w3.org/TR/html/> denotes a datatype, as
you would have it. Seems to me that it is a document. Be aware that
syntactically this is OK, but that it may not follow common practice,
and would take your ontology out of OWL DL as it is not one of the
supported datatypes. Closer in spirit would be the mime type for html,
but a) I am unaware of a standard URI for this, and b) There is the
same problem about the datatype not being in the OWL 2 datatype map.
I'm afraid that you might be best off having the range be string, and
having a comment about the html.

If you can define a regular expression that matches html
;-) , you could define an html type by create a datatype restriction
on xsd:string with a pattern facet. But in that case you might as well
again write xsd:string as the range as the union of a superclass and
one of it's subclasses is equivalent to the superclass.

- In each of the case I give the OWL 2 Functional-style syntax,
followed by a turtle translation, for your reference.

1) comment on :method

== Functional-style syntax ==

Declaration(DataProperty(:method))
AnnotationAssertion(rdfs:isDefinedBy :method
<http://microformats.org/wiki/hrecipe#method>)
AnnotationAssertion(rdfs:comment :method "The method of the recipe.")
AnnotationAssertion(rdfs:comment :method "The field MAY include valid
HTML markup e.g. paragraphs or a list for steps in the method.")
DataPropertyDomain(:method :recipe)
DataPropertyRange(:method DataUnionOf(xsd:string <http://www.w3.org/TR/html/>)

== Turtle syntax ==

:method
      rdf:type owl:DatatypeProperty ;
      rdfs:comment "The method of the recipe." ,
          "The field MAY include valid HTML markup e.g. paragraphs or
a list for steps in the method." ;
      rdfs:domain :recipe ;
      rdfs:range
              [ rdf:type rdfs:Datatype ;
                owl:unionOf (xsd:string <http://www.w3.org/TR/html/>)
              ] ;
      rdfs:isDefinedBy <http://microformats.org/wiki/hrecipe#method> .

2) comment on the range axiom

== Functional-style syntax ==

Declaration(DataProperty(:method))
AnnotationAssertion(rdfs:isDefinedBy :method
<http://microformats.org/wiki/hrecipe#method>)
AnnotationAssertion(rdfs:comment :method "The method of the recipe.")
DataPropertyDomain(:method :recipe)
DataPropertyRange(
 Annotation(rdfs:comment "The field MAY include valid HTML markup e.g.
paragraphs or a list for steps in the method.")
 :method
 DataUnionOf(xsd:string <http://www.w3.org/TR/html/>))

== Turtle syntax ==

:method
      rdf:type owl:DatatypeProperty ;
      rdfs:comment "The method of the recipe." ;
      rdfs:domain :recipe ;
      rdfs:range _:b1 ;
      rdfs:isDefinedBy <http://microformats.org/wiki/hrecipe#method> .

_:b1  rdf:type rdfs:Datatype ;
      owl:unionOf (xsd:string <http://www.w3.org/TR/html/>) .

[]    rdf:type owl:axiom ;
      rdfs:comment "The field MAY include valid HTML markup e.g.
paragraphs or a list for steps in the method." ;
      owl:subject :method .
      owl:predicate rdfs:domain ;
      owl:object _:b1 ;

3) A form that would use owl:Restriction (comment on :method)

== Functional-style syntax ==

Declaration(DataProperty(:method))
AnnotationAssertion(rdfs:isDefinedBy :method
<http://microformats.org/wiki/hrecipe#method>)
AnnotationAssertion(rdfs:comment :method "The method of the recipe.")
AnnotationAssertion(rdfs:comment :method "The field MAY include valid
HTML markup e.g. paragraphs or a list for steps in the method.")
DataPropertyDomain(:method :recipe)
SubClassOf(owl:Thing DataAllValuesFrom(:method DataUnionOf(xsd:string
<http://www.w3.org/TR/html/>))

== Turtle syntax ==

owl:Thing
      rdfs:subClassOf
              [ rdf:type owl:Restriction ;
                owl:allValuesFrom
                        [ rdf:type rdfs:Datatype ;
                          owl:unionOf (xsd:string <http://www.w3.org/TR/html/>)
                        ] ;
                owl:onProperty :method
              ] .

:method
      rdf:type owl:DatatypeProperty ;
      rdfs:comment "The method of the recipe." ,
         "The field MAY include valid HTML markup e.g. paragraphs or a
list for steps in the method." ;
      rdfs:domain :recipe ;
      rdfs:isDefinedBy <http://microformats.org/wiki/hrecipe#method> .

I will look in to the next example and try to respond later. The
appropriate references to study for the above are

http://www.w3.org/TR/2009/WD-owl2-syntax-20090421/
http://www.w3.org/TR/2009/WD-owl2-mapping-to-rdf-20090421/

Note that OWL 2 is currently in last call. If you read these documents
and have comments, please send them to public-owl-comments@w3.org by
May 13, 2009.

-Alan

http://sciencecommons.org/about/whoweare/ruttenberg/



> the second example is harder to model: the hcard-conventions have to be
> followed and certain html-elements are optional. i used a combination of
> intersectionOf and unionOf (i wouldn't know how to model the difference
> between "SHOULD" and "MAY" though).
>
>
> :photo
>  a owl:ObjectProperty;
>  rdfs:label "photo" ;
>  rdfs:isDefinedBy <http://microformats.org/wiki/hcard> ;
>  rdfs:seeAlso <http://microformats.org/wiki/hrecipe#photo> ;
>  rdfs:domain :Card ,
>              :Recipe;
>  rdfs:range
>    [ a owl:Restriction ;
>      owl2:onDatatype
>      [ owl:intersectionOf
>        [ owl:unionOf
>          ( xsd:string
>            <http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.2>
>            <http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2>
>            <http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3>
>          ) ,
>          mfs:ACard
>        ] ;
>        rdfs:comment
>         "Typically used with an <img> tag. Use the 'src' attribute for URI
> values. Use the 'data:' URI scheme for binary values.
> <http://www.ietf.org/rfc/rfc2426.txt>" ,
>         "The element SHOULD use an <img> element. The element MAY use any
> other element that contains a URL, such as <a> or <object>, but it is not
> recommended.  The contents of the element MUST follow the conventions
> outlined in <a href='http://microformats.org/wiki/hCard'>hCard</a>."
>      ]
>    ] ;
>  rdfs:comment
>    "See section 3.1.4 of RFC 2426. <http://www.ietf.org/rfc/rfc2426.txt>" ,
>    "Accompanying image. "
>  .
>
>
> any comments greatly appreciated!
> thomas
>
>
>
> .
> Thomas Lörtsch
> Business Development
> G+J Exclusive&Living digital GmbH
> Redaktion Online
> ..
> Stubbenhuk 5
> 20459 Hamburg
> ...
> eMail: loertsch.thomas@guj.de
>
>
>
>
>

Received on Sunday, 10 May 2009 04:09:40 UTC