Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider schema:domainsInclude and schema:rangesInclude #274

Closed
dgarijo opened this issue Mar 5, 2018 · 10 comments
Closed

Consider schema:domainsInclude and schema:rangesInclude #274

dgarijo opened this issue Mar 5, 2018 · 10 comments
Assignees
Labels
enhancement pressing Will fix issue in next release

Comments

@dgarijo
Copy link
Owner

dgarijo commented Mar 5, 2018

When producing documentations
Issue requested by Vladimir Alexiev (@VladimirAlexiev)

@dgarijo
Copy link
Owner Author

dgarijo commented Sep 26, 2018

I will have to look at this pull request for LODE: essepuntato/LODE#13 where @VladimirAlexiev has addressed in LODE. However, since I added additional metadata to LODE, I will have to manually incorporate the changes.

@dgarijo dgarijo self-assigned this Dec 16, 2018
@dgarijo dgarijo added enhancement pressing Will fix issue in next release labels Dec 16, 2018
@pyvandenbussche
Copy link

Hi David, great work on the integration and the wizard!
I agree this functionality is quite pressing as a lot of vocabularies now re-use the loose notion of schema domainsInclude / rangesInclude.

@VladimirAlexiev
Copy link

Please also consider essepuntato/LODE#15

@dgarijo
Copy link
Owner Author

dgarijo commented Feb 12, 2019

@VladimirAlexiev thanks, I will check it out! Some of these I already had added :)

@VladimirAlexiev
Copy link

Suggested tests:

@dgarijo
Copy link
Owner Author

dgarijo commented Feb 18, 2019

@VladimirAlexiev,
ok, I have implemented your changes and will commit soon. Regarding the test ontologies:

  1. For the business ontology it works if you remove the annotations on properties made at the end of the document. Since they are declared twice LODE takes them as named individuals.
  2. I tested it on a class with properties (https://schema.org/Book.ttl). It didn't work on the properties because they are rdf:Property instead of owl:ObjectProperty. I tried to add support for rdf:Property, but LODE doesn't recognize it properly. I have no clue why, feedback is welcome.
  3. Works fine (tried on https://www.w3.org/ns/sosa/)

@VladimirAlexiev
Copy link

@dgarijo great! Can you put the tests in this repo, so I can take a more detailed look?

  1. takes them as named individuals

And forgets that they are properties?

I use the following makefile (it uses Saxon and my patched version of extraction.xsl directly since I can't build LODE):

index.html: ebg-ontology.rdf extraction.xsl
	transform -xsl:extraction.xsl -s:ebg-ontology.rdf -o:index.html

ebg-ontology.rdf: ../model/ebg-ontology.ttl
	riot --output=rdfxml ../model/ebg-ontology.ttl > ebg-ontology.rdf

riot collects all triples about a class in one XML element. But extraction.xsl produced only the namespace section, no classes nor properties ?!?

  1. I get the same: only classes, no properties:
transform -xsl:extraction.xsl -s:https://schema.org/Book.rdf -o:schema-book.html

@VladimirAlexiev
Copy link

VladimirAlexiev commented Feb 18, 2019

Re 2: search for ObjectProperty and you fill find several spots where rdf:Property needs to be added:

    <xsl:template match="owl:ObjectProperty | owl:DatatypeProperty | owl:AnnotationProperty">
        <div id="{generate-id()}" class="entity">
            <xsl:call-template name="get.entity.name">
                <xsl:with-param name="toc" select="if (self::owl:ObjectProperty) then 'objectproperties' else if (self::owl:AnnotationProperty) then 'annotationproperties' else 'dataproperties'" tunnel="yes" as="xs:string" />
...
        <xsl:variable name="hasAssertions" select="some $el in element() satisfies (some $prop in (/rdf:RDF/(owl:ObjectProperty|owl:DatatypeProperty)/(@*:about|@*:ID)) satisfies $prop = concat(namespace-uri($el),local-name($el)))" as="xs:boolean" />

...

                    <xsl:if test="some $prop in (/rdf:RDF/(owl:ObjectProperty|owl:DatatypeProperty)/(@*:about|@*:ID)) satisfies $prop = $currentURI">

...

        <xsl:variable name="properties" as="attribute()*" select="/rdf:RDF/(owl:ObjectProperty|owl:DatatypeProperty|owl:AnnotationProperty)[some $res in 

...

        <xsl:variable name="properties" as="attribute()*" select="/rdf:RDF/(owl:ObjectProperty|owl:DatatypeProperty|owl:AnnotationProperty)[some $res in (rdfs:range|schema:rangeIncludes)/(@*:resource|(owl:Class|rdfs:Class)/@*:about) satisfies $res = $about]/(@*:about|@*:ID)" />
...
                <xsl:for-each select="rdfs:subPropertyOf/(@*:resource|(rdf:Property|owl:ObjectProperty|owl:DatatypeProperty|owl:AnnotationProperty)/@*:about)">
...
        <xsl:variable name="sub-properties" as="attribute()*" select="/rdf:RDF/(if ($type = 'property') then owl:DatatypeProperty | owl:ObjectProperty else owl:AnnotationProperty)[some $res in rdfs:subPropertyOf/(@*:resource|(owl:Class|rdfs:Class)/@*:about) satisfies $res = $about]/(@*:about|@*:ID)" />
...
                <xsl:if test="exists(//owl:ObjectProperty/element())">
                    <li><a href="#objectproperties"><xsl:value-of select="f:getDescriptionLabel('objectproperties')" /></a></li>
                </xsl:if>
                <xsl:if test="exists(//owl:DatatypeProperty/element())">
                    <li><a href="#dataproperties"><xsl:value-of select="f:getDescriptionLabel('dataproperties')" /></a></li>
                </xsl:if>
...
    <xsl:template name="get.objectproperties">
        <xsl:if test="exists(//owl:ObjectProperty/element())">
...
    <xsl:template name="get.objectproperties.toc">
        <ul class="hlist">
            <xsl:apply-templates select="/rdf:RDF/owl:ObjectProperty[exists(element())]" mode="toc">
...
            <xsl:when test="($type = '' or $type = 'property') and $el[self::owl:ObjectProperty]">
                <sup title="{f:getDescriptionLabel('objectproperty')}" class="type-op">op</sup>
            </xsl:when>
            <xsl:when test="($type = '' or $type = 'property') and $el[self::owl:DatatypeProperty]">
                <sup title="{f:getDescriptionLabel('dataproperty')}" class="type-dp">dp</sup>
            </xsl:when>
...
        <xsl:value-of select="exists($rdf/(owl:ObjectProperty|owl:DatatypeProperty|owl:AnnotationProperty)[some $res in (rdfs:range|schema:rangeIncludes)/(@*:resource|(owl:Class|rdfs:Class)/@*:about) satisfies $res = $el/(@*:about|@*:ID)])" />
...
        <xsl:value-of select="exists($rdf/(owl:ObjectProperty|owl:DatatypeProperty|owl:AnnotationProperty)[some $res in (rdfs:domain|schema:domainIncludes)/(@*:resource|(owl:Class|rdfs:Class)/@*:about) satisfies $res = $el/(@*:about|@*:ID)])" />

Unfortunately, for Schema it's not so easy to dispatch the props into 'objectproperties' vs 'dataproperties'. Options:

  1. examine rangeIncludes and call it 'dataproperty' if the range includes only some of the 9 datatypes in https://schema.org/docs/full.html#datatype_tree: schema:Boolean, Date, DateTime, Number, Float, Integer, Text, URL, Time
  2. put rdf:Property in a new section 'Properties' (for Schema, only that section will appear)
  3. leave it as is, then all Schema props will be called 'dataproperties'

I think option 2 is the best since 1 will require schema-specific hardcoding, wheres 3 is misleading

@dgarijo
Copy link
Owner Author

dgarijo commented Feb 19, 2019

Hi @VladimirAlexiev,
I have added the 2 examples I used to test it out, including my edited version of http://data.businessgraph.io/ontology to avoid the issue mentioned (see ed5c97d)

I am pushing to the develop branch, so please use the extraction.xsl file from there. Based on your second comment, I think you may not have seen it. I edited the rdf:Property in each of the 17 locations where objectProperty appears, but it still doesn't add them as an objectProperty. In my case, I was assuming that all rdf:Property would have the same behavior as ObjectProperty, but you are right, they can be both datatype properties and object properties. I am going to remove my edits to the file and keep the support only for owl:objectProperty and owl:datatypeProperty. Going for option 2 would be ideal, but I will leave it for the future.

@dgarijo
Copy link
Owner Author

dgarijo commented Feb 19, 2019

65f9433 is the commit that had my rdf:Property additions in case you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pressing Will fix issue in next release
Projects
None yet
Development

No branches or pull requests

3 participants