Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

math - Encoding mathematical properties in RDF

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...