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

fix (ontologies): Use Knora-specific properties instead of rdfs properties to check consistency during updates #49

Merged
merged 11 commits into from
Feb 24, 2016

Conversation

benjamingeer
Copy link

This pull request replaces rdfs:domain and rdfs:range, which we were misusing for consistency checking, with Knora-specific properties, following the discussion in #34 and #33.

  • rdfs:domain is replaced with knora-base:subjectClassConstraint.
  • rdfs:range is replaced with knora-base:objectClassConstraint and knora-base:objectDatatypeConstraint.

A subsequent pull request will enable us to use GraphDB's built-in consistency checking for both knora-base:subjectClassConstraint and knora-base:objectClassConstraint.

I've also cleaned up the ontologies a bit in general.

The old SALSAH export script will also need to be changed to output these Knora-specific properties instead of rdfs:domain and rdfs:range.

Benjamin Geer added 6 commits February 13, 2016 00:21
…ra-specific properties.

- Remove unused definitions.
- Correct and shorten comments.
- Fix various inconsistencies.
- Add copyright notices.

(All this is untested.)
- Change test data to match ontology changes.
- Remove failing, unsupported embedded triplestore tests from TriplestoreManagerActorSpec.
Conflicts:
	webapi/src/test/scala/org/knora/webapi/store/triplestore/TriplestoreManagerActorSpec.scala
Conflicts:
	webapi/src/main/scala/org/knora/webapi/responders/v1/ResourcesResponderV1.scala
	webapi/src/main/scala/org/knora/webapi/responders/v1/ValueUtilV1.scala
	webapi/src/main/scala/org/knora/webapi/responders/v1/ValuesResponderV1.scala
@benjamingeer benjamingeer added the help wanted extra attention from another developer is needed label Feb 23, 2016
@benjamingeer benjamingeer added this to the On Deck milestone Feb 23, 2016
@benjamingeer benjamingeer added bug something isn't working and removed help wanted extra attention from another developer is needed labels Feb 23, 2016
@benjamingeer benjamingeer changed the title Use Knora-specific properties instead of rdfs properties to check consistency during updates fix (ontologies): Use Knora-specific properties instead of rdfs properties to check consistency during updates Feb 23, 2016
@tobiasschweizer
Copy link
Contributor

In knora-base.ttl, shouldn't there be a knora-base:objectDataTypeConstraint on resourceIcon replacing the original rdfs:range (xsd:string)? As far as I understood, knora-base:objectClassConstraint is used to replace rdfs:range in case of an OWL-class, whereas knora-base::objectDataTypeConstraint should be used for a datatype like xsd:string. I understood that the latter case is not involved in consistency checking, but should still be there for documentation purposes.

@tobiasschweizer
Copy link
Contributor

Could you update the knora-base documentation (docs/latex/knora-base/knora-base.tex)?

@benjamingeer
Copy link
Author

In knora-base.ttl, shouldn't there be a knora-base:objectDataTypeConstraint on resourceIcon replacing the original rdfs:range (xsd:string)?

Yes. Fixed.

Could you update the knora-base documentation (docs/latex/knora-base/knora-base.tex)?

Done.

@benjamingeer
Copy link
Author

I missed a few rdfs:range in the LaTeX doc, fixed now.

@tobiasschweizer
Copy link
Contributor

Did you replace rdfs:domain and rdfs_range manually using a text editor?

I am concerned that - given the multitude of changes made to the ontology files - we cannot really assure that we actually did not change the ontology by accident.

@benjamingeer
Copy link
Author

Did you replace rdfs:domain and rdfs_range manually using a text editor?

Yes.

I am concerned that - given the multitude of changes made to the ontology files - we cannot really assure that we actually did not change the ontology by accident.

If I made a mistake, it's your job as reviewer to find it. :) But all the tests still pass.

@benjamingeer
Copy link
Author

Other things I changed, besides rdfs:domain and rdfs:range:

  • Shorten a lot of rdfs:comment strings (and correct the English in them). We don't need such long comments in the ontologies now that we have separate documentation.
  • Add copyrights to the ontology files.
  • Use the knora-base prefix in knora-dc.ttl instead of full IRIs.

@benjamingeer
Copy link
Author

And I took out the statements that imported ontologies into other ontologies. These seemed to be there only because of some limitation of Protégé, and that didn't seem like a good enough reason to keep them.

@tobiasschweizer
Copy link
Contributor

We should be sure that when we make a lot changes that they were actually done in a consistent way.

What about counting all the original occurrences of rdfs:range and rdfs:domain and comparing them to the occurrences of subjectClassConstraint as well as objectClassConstraint and objectDataTypeConstraintsummed up?

Since it is a search and replace operation, the numbers should be the same.

In the actual branch:

grep "subjectClassConstraint" knora-base.ttl | wc -l

On development branch:

grep "rdfs:domain" knora-base.ttl | wc -l

As a reviewer, it is my job to mistakes and inconsistencies. But I cannot go through every line you changed.

@benjamingeer
Copy link
Author

What about counting all the original occurrences... Since it is a search and replace operation, the numbers should be the same.

It wasn't just a search and replace operation. I had to look at every case manually, and I corrected a lot of things that were either incorrect or impractical, so just counting the changes won't work. For example, I removed owl:unionOf, which was used like this:

                   rdfs:domain [ rdf:type owl:Class ;
                                 owl:unionOf ( :Resource
                                               :User
                                               :Value
                                             )
                               ] .

I removed these because I think they probably won't work with constraint checking. Once constraint checking works, I can try to put them back.

I've just gone through all the changes in knora-base manually again.

These properties had owl:unionOf in rdfs:domain, which I removed:

  • attachedToProject
  • attachedToUser
  • hasPermission
  • hasRestrictedViewPermission
  • hasViewPermission
  • hasModifyPermission
  • hasDeletePermission
  • hasChangeRightsPermission
  • seqnum
  • isDeleted
  • preferredLanguage

These properties had owl:unionOf in rdfs:range, which I removed:

  • hasValue
  • hasExtResValue

The property deleteDate had no rdfs:domain, but the comment says it only applies to resources, so I gave it a subjectClassConstraint.

The property phone had no rdfs:range, but is clearly a string, so I gave it an objectDatatypeConstraint.

These properties had an rdfs:domain of owl:Thing, which is meaningless, so I removed it:

  • description
  • name

The property protocol had a list of literals as an rdfs:range. I don't think this can work with constraint checking, and I don't see the point of having a list of all possible Internet protocols in the ontology, so I replaced it with an objectDatatypeConstraint of xsd:string.

Other changes:

I changed owl:qualifiedCardinality, owl:minQualifiedCardinality, and owl:maxQualifiedCardinality to owl:cardinality, owl:minCardinality, and owl:maxCardinality, because Knora doesn't support qualified cardinalities.

I changed some cardinalities that were clearly wrong (e.g. in LinkValue, where subject and object were optional but should be required).

I removed knora-base:mimetypes, which was taking a huge amount of space in the ontology, but isn't used in the application.

I removed the root user, which doesn't belong in knora-base.

As a reviewer, it is my job to mistakes and inconsistencies. But I cannot go through every line you changed.

What do you think I do when I review your changes? :)

@tobiasschweizer
Copy link
Contributor

Ok, let me have a final look at it :-)

@tobiasschweizer
Copy link
Contributor

In knora-base.tex, the examples still use rdfs:domain in chapter 3.

@tobiasschweizer
Copy link
Contributor

Otherwise, the changes seem fine to me. In the Scala code, you simply had to replace one constant by another and adapt method, parameter and variable names.

@benjamingeer
Copy link
Author

In knora-base.tex, the examples still use rdfs:domain in chapter 3.

Thanks, fixed now.

benjamingeer pushed a commit that referenced this pull request Feb 24, 2016
fix (ontologies): Use Knora-specific properties instead of rdfs properties to check consistency during updates
@benjamingeer benjamingeer merged commit 7c5b4fc into develop Feb 24, 2016
@benjamingeer benjamingeer deleted the wip/ontology-fixes branch February 24, 2016 18:26
@benjamingeer benjamingeer mentioned this pull request Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants