dasch-swiss / dsp-api

DaSCH Service Platform API
http://admin.dasch.swiss
Apache License 2.0
74 stars 18 forks source link

knora-base ontology interoperability with other standard ontologies? #398

Open mrivoal opened 7 years ago

mrivoal commented 7 years ago

My question was raised by @SepidehAlassi's answer to #389.

In Knora-base ontology documentation:

A subclass of kb:Resource may additionally be a subclass of any other class, e.g. an industry-standard class such as foaf:Person; this can facilitate searches across projects.

I wonder why knora ontology doesn't comply with owl standards while referencing external ontologies and if it may not cause some problem later when we might want to take advantage of inference? Shouldn't we, at some point, use the following properties ? owl:sameAs owl:equivalentProperty owl:equivalentClass Or does it comes with too much constraints?

benjamingeer commented 7 years ago

As far as I know, we're not violating anything in the OWL specification. What we are trying to do is use only those features of OWL that seem meaningful, relevant, and useful in the context of Knora repositories.

Within a Knora repository, the OWL properties you mentioned would be meaningful only if they affected search queries. We could implement this, but it would require some work.

We currently support inference only on GraphDB, and we currently use only RDFS inference. I'm reluctant to activate OWL inference on GraphDB because of the likely performance penalty. Jena offers inference, but as far as I can tell from the limited documentation, it lacks the flexibility of GraphDB's inference, so I'm not sure we will be able to use it. After the beta release I'd like to investigate this further, as well as explore the capabilities of other open-source triplestores. Without inference, we could still write our own SPARQL code to support those OWL properties. But I think we could justify spending time on this only if it was going to provide a significant benefit to the user, so we would need to think through some specific use cases.

I think the OWL constructs you mentioned could be especially useful for creating mappings between data in Knora and data in other sorts of RDF repositories. We've talked about making it possible to export Knora repositories as simplified RDF that could be made accessible via SPARQL endpoints. Maybe that could be a use case for things like owl:sameAs. But we would need to think through exactly how it should work and what the consequences would be. I think this would have to be part of a broader reflection on how Knora is going to interact with other sorts of repositories.

In short, it's not a simple matter of just adding a few properties to our ontologies. What you're talking about would involve a significant design and implementation effort, involving other features as well as a range of specific use cases. Let's talk about it again after the beta release.

mrivoal commented 7 years ago

Yes, I could imagine it would raise substantial questions regarding the future of Knora and other research data repositories, but I had to ask.

It was also in order to keep track of this question for later, because it is my understanding that the implementation of such properties in Knora would be the key (or one of the keys) to (actual) linked data.

Thanks for your answer and yes, let's talk about this later.

tobiasschweizer commented 6 years ago

With KnarQL, this works now:

      PREFIX beol: <http://0.0.0.0:3333/ontology/beol/simple/v2#>
      PREFIX knora-api: <http://api.knora.org/ontology/knora-api/simple/v2#>
      PREFIX foaf: <http://xmlns.com/foaf/0.1/>

      CONSTRUCT {
          ?person knora-api:isMainResource true .

          ?person foaf:name ?name .  

      } WHERE {
          ?person a knora-api:Resource .
          ?person a foaf:Person .

          ?person foaf:name ?name .
          foaf:name knora-api:objectType xsd:string .

          ?name a xsd:string .

          FILTER(?name = "Euler")      

      } 

Provided that a beol:person is a subclass of a foaf:Person and a beol:hasFamilyName is a subproperty of foaf:name (this would actually include also the first name), we get the following results (this should be in knora-api simple too):

{
  "@type" : "schema:ItemList",
  "schema:itemListElement" : [ {
    "@id" : "http://rdfh.ch/beol/0Rwd-BgJRrGtt_Jg1sExMw",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/0Rwd-BgJRrGtt_Jg1sExMw/values/sxceNabqSuKw4DHs3wcKqw",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerP"
  }, {
    "@id" : "http://rdfh.ch/beol/55D6-dVtTma61qUPUsbeRg",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/55D6-dVtTma61qUPUsbeRg/values/bFqBMUBMSvKoEnMXue0r7w",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerN"
  }, {
    "@id" : "http://rdfh.ch/beol/6eX9DunuQoGK6J_9FqqA3g",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/6eX9DunuQoGK6J_9FqqA3g/values/qYBThNUMRX2b7HROh4LFEw",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerJoK"
  }, {
    "@id" : "http://rdfh.ch/beol/ABU1YGgoQb-3pJG4iQ1-dg",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/ABU1YGgoQb-3pJG4iQ1-dg/values/88w0sExjQMCxSqgqjh3l9w",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerKP"
  }, {
    "@id" : "http://rdfh.ch/beol/D2mP6X2vToecRc3TADG2fw",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/D2mP6X2vToecRc3TADG2fw/values/t2u37RipTIaIhrj25waoYg",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "Euler, Leonhard"
  }, {
    "@id" : "http://rdfh.ch/beol/Eb4bN9ILQ_qjNTOHYLTshw",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/Eb4bN9ILQ_qjNTOHYLTshw/values/C6yOEZroRO-hX2DhksTrog",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerHE"
  }, {
    "@id" : "http://rdfh.ch/beol/LkWzuQArTVqNKSRoYfvCww",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/LkWzuQArTVqNKSRoYfvCww/values/8f8gFv1pSF-VyoLApb-u1Q",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerJL"
  }, {
    "@id" : "http://rdfh.ch/beol/PUusV6MgS_azUOlQCyJsbQ",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/PUusV6MgS_azUOlQCyJsbQ/values/-xacDR3ISXendnZghCD7SA",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerJA"
  }, {
    "@id" : "http://rdfh.ch/beol/W0Zq5Zi4RhqeCgF9gxe2Kg",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/W0Zq5Zi4RhqeCgF9gxe2Kg/values/kFsz4_dQTkqgPusKOmLwZA",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerAl"
  }, {
    "@id" : "http://rdfh.ch/beol/i49k-VEFSpixeKui_kdSZA",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/i49k-VEFSpixeKui_kdSZA/values/_8oDi1YVRm6pZRUPrSNedQ",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerChr"
  }, {
    "@id" : "http://rdfh.ch/beol/n3YrSCKCQSqT7l7iDr4z_g",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/n3YrSCKCQSqT7l7iDr4z_g/values/CuMCNBnkRlalnLmC-Z57pw",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerChAW"
  }, {
    "@id" : "http://rdfh.ch/beol/q6vBHggaR-eVKn57WtCdGQ",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/q6vBHggaR-eVKn57WtCdGQ/values/zp65O3rsQbCgypqWe38jkg",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerJH"
  }, {
    "@id" : "http://rdfh.ch/beol/tdOPIVpwR1O_nMzB5cgudw",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/tdOPIVpwR1O_nMzB5cgudw/values/RdTLjipvQJ-SEH0vyN1BRg",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerL"
  }, {
    "@id" : "http://rdfh.ch/beol/urITDrTnRx6z8gPjzN-_xQ",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/urITDrTnRx6z8gPjzN-_xQ/values/828S46vYRJ-gKHj0c2Oqag",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerAuF"
  }, {
    "@id" : "http://rdfh.ch/beol/vpjov10UQ46dTc7XD_-hPA",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/vpjov10UQ46dTc7XD_-hPA/values/XAJHRsD2Q82UxOPTCYyvfA",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerEL"
  }, {
    "@id" : "http://rdfh.ch/beol/wheTQ5WxRm-bh1RhQrFUmg",
    "@type" : "beol:person",
    "beol:hasFamilyName" : {
      "@id" : "http://rdfh.ch/beol/wheTQ5WxRm-bh1RhQrFUmg/values/31CEq8MfS2S3zwB0TVKIvQ",
      "@type" : "knora-api:TextValue",
      "knora-api:valueAsString" : "Euler"
    },
    "schema:name" : "EulerHF"
  } ],
  "schema:numberOfItems" : 16,
  "@context" : {
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
    "schema" : "http://schema.org/",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "beol" : "http://0.0.0.0:3333/ontology/beol/v2#"
  }
}

"beol:person" : {
  "@id" : "beol:person",
  "@type" : "owl:Class",
  "knora-api:resourceIcon" : "person.png",
  "rdfs:comment" : "A resource representing a person",
  "rdfs:label" : "Person",
  "rdfs:subClassOf" : [ "http://api.knora.org/ontology/knora-api/simple/v2#Resource", "http://xmlns.com/foaf/0.1/Person"
}

...

"beol:hasFamilyName" : {
  "@id" : "beol:hasFamilyName",
  "@type" : "owl:DatatypeProperty",
  "knora-api:objectType" : "http://www.w3.org/2001/XMLSchema#string",
  "knora-api:subjectType" : "http://0.0.0.0:3333/ontology/beol/simple/v2#person",
  "rdfs:comment" : "Represents a family name.",
  "rdfs:label" : "Nachname",
  "rdfs:subPropertyOf" : [ "http://xmlns.com/foaf/0.1/name", "http://api.knora.org/ontology/knora-api/simple/v2#hasValue" ]
  }
tobiasschweizer commented 6 years ago

@benjamingeer pointed out the support for givenName and familyName as defined in http://xmlns.com/foaf/spec/#term_givenName and http://xmlns.com/foaf/spec/#term_familyName

tobiasschweizer commented 6 years ago

added support in https://github.com/dhlab-basel/Knora/commit/3669dd21e05a09ca911a0bfe572345c8fb63c4dc