5

I have been trying to find a solution to adding relationships, such as X has unit A < 20 into an existing ontology, but, could not find a solution so far.

An existing knowledge graph - RDF - has many concepts and relationships. In an attempt improve the accuracy of inferences, we are trying to add some key properties to few of the concepts.

Example:

Concept X causes concept Y. And, we now know that concept Y has property ABC < 30 always.

Please suggest on how to add this kind of relationships for only few concepts in a knowledge graph - RDF

ale
  • 10,012
  • 5
  • 40
  • 49
user1830284
  • 101
  • 6
  • Is it more of a question about knowledge representation or about an inference mechanism (forward-chaining) that can work with RDF? – hardmath Jun 10 '14 at 12:00
  • For arbitrary formulas, this will be rather difficult, but take a look at [my answer](http://stackoverflow.com/a/17319546/1281433) to [Functions to manipulate RDF collections in SPARQL](http://stackoverflow.com/q/17312774/1281433). There's a link to **Wenzel, Ken, and Heiner Reinhardt. ["Mathematical Computations for Linked Data Applications with OpenMath."](http://ceur-ws.org/Vol-921/openmath-01.pdf) Joint Proceedings of the 24th Workshop on OpenMath and the 7th Workshop on Mathematical User Interfaces (MathUI). 2012.** – Joshua Taylor Jun 10 '14 at 16:12
  • @hardmath: this is about representing the knowledge. – user1830284 Jun 11 '14 at 06:56

1 Answers1

3

As I mentioned in an answer to Functions to manipulate RDF collections in SPARQL, you can do some mathematics in SPARQL, which is a query language for RDF. For encoding arbitrary mathematical formulas (which is what the title suggests), you might also be interested in

Wenzel, Ken, and Heiner Reinhardt. "Mathematical Computations for Linked Data Applications with OpenMath." Joint Proceedings of the 24th Workshop on OpenMath and the 7th Workshop on Mathematical User Interfaces (MathUI). 2012.

All that said, what you're describing here (that the value of of some property will have a value less than a certain number), is expressible in OWL. Your particular situation was:

Concept X causes concept Y. And, we now know that concept Y has property ABC < 30 always.

I'm not sure what you mean by a concept causing another, but you can say that every instance of Y has only values less than 30 for the property ABC. That's pretty straightforward. It's the axiom (in Manchester syntax)

Y subClassOf ABC only xsd:integer[< 30]

and in DL syntax:

Y &sqsubseteq; ∀ABC.xsd:integer[< 30]

In Protégé that looks like:

facet subclass axiom

and in the RDF representation of the OWL ontology (in Turtle and RDF/XML):

@prefix :      <https://stackoverflow.com/q/24134785/1281433/facets#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

:ABC    a       owl:DatatypeProperty .

<https://stackoverflow.com/q/24134785/1281433/facets>
        a       owl:Ontology .

:Y      a                owl:Class ;
        rdfs:subClassOf  [ a                  owl:Restriction ;
                           owl:allValuesFrom  [ a                     rdfs:Datatype ;
                                                owl:onDatatype        xsd:integer ;
                                                owl:withRestrictions  ( [ xsd:maxExclusive
                                                                  30 ] )
                                              ] ;
                           owl:onProperty     :ABC
                         ] .
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="https://stackoverflow.com/q/24134785/1281433/facets#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <owl:Ontology rdf:about="https://stackoverflow.com/q/24134785/1281433/facets"/>
  <owl:Class rdf:about="https://stackoverflow.com/q/24134785/1281433/facets#Y">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:DatatypeProperty rdf:about="https://stackoverflow.com/q/24134785/1281433/facets#ABC"/>
        </owl:onProperty>
        <owl:allValuesFrom>
          <rdfs:Datatype>
            <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
            <owl:withRestrictions rdf:parseType="Collection">
              <rdf:Description>
                <xsd:maxExclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
                >30</xsd:maxExclusive>
              </rdf:Description>
            </owl:withRestrictions>
          </rdfs:Datatype>
        </owl:allValuesFrom>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
</rdf:RDF>
Community
  • 1
  • 1
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thanks Joshua: got clear Idea on it. Could you please help with inferencing as well in this case. Like, If my incoming document has ABC value "25" - how to retrieve 'Y'? Also in case, some other Class Z has same ABC property ">30" - how to retrieve respective classes based on the value of property ABC. Thanks for your help. – user1830284 Jun 11 '14 at 07:05
  • All you've said so far is that "**if** something is a Y, **then** its ABC value is less than 30." It sounds like you also want the other direction, so that "Y if and only if its ABC is less than 30?" Just change the subclass axiom to an equivalent class axiom. – Joshua Taylor Jun 13 '14 at 11:45
  • hello joshua, can i do math with xsd ? – crapthings Jun 13 '18 at 08:58
  • 1
    @crapthings that question is not completely clear. XSD is just a vocabulary. But the operators in SPARQL do work with many literals that have XSD data types. – Joshua Taylor Jun 13 '18 at 10:57