Skip to content

Commit

Permalink
Align object model with the new vocabulary generation strategy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Jan 18, 2024
1 parent 5abac17 commit 0aacea9
Show file tree
Hide file tree
Showing 46 changed files with 66 additions and 81 deletions.
8 changes: 4 additions & 4 deletions src/main/resources/mapping → jopa-config/mapping
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
http://onto.fel.cvut.cz/ontologies/application/termit > ../../../ontology/termit-slovník.ttl
http://onto.fel.cvut.cz/ontologies/application/termit/glosář > ../../../ontology/termit-glosář.ttl
http://onto.fel.cvut.cz/ontologies/application/termit/model > ../../../ontology/termit-model.ttl
http://rdfs.org/sioc/ns# > ../../../ontology/sioc-ns.rdf
http://onto.fel.cvut.cz/ontologies/application/termit > ../ontology/termit-slovník.ttl
http://onto.fel.cvut.cz/ontologies/application/termit/glosář > ../ontology/termit-glosář.ttl
http://onto.fel.cvut.cz/ontologies/application/termit/model > ../ontology/termit-model.ttl
http://rdfs.org/sioc/ns# > ../ontology/sioc-ns.rdf
http://www.w3.org/ns/activitystreams# > https://raw.githubusercontent.com/w3c/activitystreams/master/vocabulary/activitystreams2.owl
https://slovník.gov.cz/datový/pracovní-prostor/glosář > https://raw.githubusercontent.com/opendata-mvcr/ssp/master/content/vocabularies/d-sgov-pracovn%C3%AD-prostor-0.0.1/d-sgov-pracovn%C3%AD-prostor-0.0.1-glos%C3%A1%C5%99.ttl
https://slovník.gov.cz/datový/pracovní-prostor/model > https://raw.githubusercontent.com/opendata-mvcr/ssp/master/content/vocabularies/d-sgov-pracovn%C3%AD-prostor-0.0.1/d-sgov-pracovn%C3%AD-prostor-0.0.1-model.ttl
Expand Down
3 changes: 3 additions & 0 deletions jopa-config/prefixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
http://rdfs.org/sioc/ns#=sioc
http://onto.fel.cvut.cz/ontologies/dataset-descriptor=ddo
https://slovník.gov.cz/datový/pracovní-prostor/model=d-sgov-pracovní-prostor-pojem
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,11 @@
<package>cz.cvut.kbss.termit.util</package>
<output-directory>${project.basedir}/src/main/generated-sources</output-directory>
<ontology-iri>http://onto.fel.cvut.cz/ontologies/application/termit</ontology-iri>
<mapping-file>${project.basedir}/src/main/resources/mapping</mapping-file>
<mapping-file>${project.basedir}/jopa-config/mapping</mapping-file>
<whole-ontology-as-ics>true</whole-ontology-as-ics>
<vocabulary-only>true</vocabulary-only>
<ignore-failed-imports>true</ignore-failed-imports>
<prefix-mapping-file>${project.basedir}/jopa-config/prefixes</prefix-mapping-file>
</configuration>
</execution>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private <T extends AccessControlAgent> AccessHolderDto accessHolderToDto(T holde
dto.setLabel(MultilingualString.create(user.getFullName(),
config.getPersistence().getLanguage()));
break;
case cz.cvut.kbss.termit.util.Vocabulary.s_c_Usergroup:
case cz.cvut.kbss.termit.util.Vocabulary.s_c_sioc_Usergroup:
dto.setLabel(MultilingualString.create(((UserGroup) holder).getLabel(),
config.getPersistence().getLanguage()));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public class FullTextSearchResult implements HasIdentifier, HasTypes, Serializab
@OWLAnnotationProperty(iri = RDFS.LABEL)
private String label;

@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_termit + "/fts/snippet-text")
@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_TERMIT + "/fts/snippet-text")
private String snippetText;

@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_termit + "/fts/snippet-field")
@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_TERMIT + "/fts/snippet-field")
private String snippetField;

@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_termit + "/fts/score")
@OWLDataProperty(iri = Vocabulary.ONTOLOGY_IRI_TERMIT + "/fts/score")
private Double score;

@OWLObjectProperty(iri = Vocabulary.s_p_je_pojmem_ze_slovniku)
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cz/cvut/kbss/termit/model/AbstractTerm.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AbstractTerm)) {
if (!(o instanceof AbstractTerm that)) {
return false;
}
AbstractTerm that = (AbstractTerm) o;
return Objects.equals(getUri(), that.getUri());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TextAnalysisRecord)) {
if (!(o instanceof TextAnalysisRecord that)) {
return false;
}
TextAnalysisRecord that = (TextAnalysisRecord) o;
return Objects.equals(date, that.date) &&
Objects.equals(analyzedResource, that.analyzedResource) &&
Objects.equals(vocabularies, that.vocabularies);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cz/cvut/kbss/termit/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
if (!(o instanceof User that)) {
return false;
}
User that = (User) o;
return Objects.equals(getUri(), that.getUri()) && Objects.equals(username, that.username);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/cz/cvut/kbss/termit/model/UserAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class UserAccount implements HasIdentifier, HasTypes, Serializable {
@OWLDataProperty(iri = Vocabulary.s_p_ma_heslo)
private String password;

@OWLDataProperty(iri = Vocabulary.s_p_last_activity_date)
@OWLDataProperty(iri = Vocabulary.s_p_sioc_last_activity_date)
private Instant lastSeen;

@Types
Expand Down Expand Up @@ -255,10 +255,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UserAccount)) {
if (!(o instanceof UserAccount that)) {
return false;
}
UserAccount that = (UserAccount) o;
return Objects.equals(getUri(), that.getUri()) && Objects.equals(username, that.username);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/cz/cvut/kbss/termit/model/UserGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
import java.util.Objects;
import java.util.Set;

@OWLClass(iri = Vocabulary.s_c_Usergroup)
@OWLClass(iri = Vocabulary.s_c_sioc_Usergroup)
public class UserGroup extends AccessControlAgent {

/**
* Namespace of UserGroup identifiers.
*/
public static final String NAMESPACE = "http://rdfs.org/sioc/ns#";
public static final String NAMESPACE = Vocabulary.ONTOLOGY_IRI_SIOC;

@NotBlank
@ParticipationConstraints(nonEmpty = true)
@OWLAnnotationProperty(iri = DC.Terms.TITLE)
private String label;

@OWLObjectProperty(iri = Vocabulary.s_p_has_member_A, fetch = FetchType.EAGER)
@OWLObjectProperty(iri = Vocabulary.s_p_sioc_has_member, fetch = FetchType.EAGER)
private Set<User> members;

public String getLabel() {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cz/cvut/kbss/termit/model/Vocabulary.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Vocabulary)) {
if (!(o instanceof Vocabulary that)) {
return false;
}
Vocabulary that = (Vocabulary) o;
return Objects.equals(getUri(), that.getUri());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AccessControlRecord)) {
if (!(o instanceof AccessControlRecord<?> that)) {
return false;
}
AccessControlRecord<?> that = (AccessControlRecord<?>) o;
return accessLevel == that.accessLevel && Objects.equals(holder, that.holder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AbstractChangeRecord)) {
if (!(o instanceof AbstractChangeRecord that)) {
return false;
}
AbstractChangeRecord that = (AbstractChangeRecord) o;
return Objects.equals(timestamp, that.timestamp) &&
Objects.equals(changedEntity, that.changedEntity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof UpdateChangeRecord)) {
if (!(o instanceof UpdateChangeRecord that)) {
return false;
}
if (!super.equals(o)) {
if (!super.equals(that)) {
return false;
}
UpdateChangeRecord that = (UpdateChangeRecord) o;
return changedAttribute.equals(that.changedAttribute);
}

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/cz/cvut/kbss/termit/model/comment/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public class Comment extends AbstractEntity {
private URI asset;

@ParticipationConstraints(nonEmpty = true)
@OWLDataProperty(iri = Vocabulary.s_p_content_A)
@OWLDataProperty(iri = Vocabulary.s_p_sioc_content)
private String content;

@ParticipationConstraints(nonEmpty = true)
@OWLObjectProperty(iri = Vocabulary.s_p_has_creator, fetch = FetchType.EAGER)
@OWLObjectProperty(iri = Vocabulary.s_p_sioc_has_creator, fetch = FetchType.EAGER)
private User author;

@ParticipationConstraints(nonEmpty = true)
Expand Down Expand Up @@ -123,10 +123,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Comment)) {
if (!(o instanceof Comment comment)) {
return false;
}
Comment comment = (Comment) o;
return Objects.equals(asset, comment.asset) &&
Objects.equals(content, comment.content) &&
Objects.equals(author, comment.author) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CommentReaction)) {
if (!(o instanceof CommentReaction reaction)) {
return false;
}
CommentReaction reaction = (CommentReaction) o;
return Objects.equals(actor, reaction.actor) &&
Objects.equals(object, reaction.object) &&
Objects.equals(types, reaction.types);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
import cz.cvut.kbss.jopa.model.annotations.OWLClass;
import cz.cvut.kbss.jopa.model.annotations.OWLObjectProperty;
import cz.cvut.kbss.jsonld.annotation.JsonLdAttributeOrder;
import cz.cvut.kbss.termit.exception.TermItException;
import cz.cvut.kbss.termit.model.changetracking.Audited;
import cz.cvut.kbss.termit.model.util.SupportsStorage;
import cz.cvut.kbss.termit.service.IdentifierResolver;
import cz.cvut.kbss.termit.util.Vocabulary;

import java.lang.reflect.Field;
import java.net.URI;
import java.util.HashSet;
import java.util.Objects;
Expand Down Expand Up @@ -103,10 +101,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Document)) {
if (!(o instanceof Document document)) {
return false;
}
Document document = (Document) o;
return Objects.equals(getUri(), document.getUri());
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cz/cvut/kbss/termit/model/resource/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof File)) {
if (!(o instanceof File file)) {
return false;
}
File file = (File) o;
return Objects.equals(getUri(), file.getUri());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Resource)) {
if (!(o instanceof Resource resource)) {
return false;
}
Resource resource = (Resource) o;
return Objects.equals(getUri(), resource.getUri());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CssSelector)) {
if (!(o instanceof CssSelector that)) {
return false;
}
CssSelector that = (CssSelector) o;
return Objects.equals(value, that.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof FragmentSelector)) {
if (!(o instanceof FragmentSelector that)) {
return false;
}
FragmentSelector that = (FragmentSelector) o;
return Objects.equals(value, that.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TextPositionSelector)) {
if (!(o instanceof TextPositionSelector selector)) {
return false;
}
TextPositionSelector selector = (TextPositionSelector) o;
return Objects.equals(start, selector.start) &&
Objects.equals(end, selector.end);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TextQuoteSelector)) {
if (!(o instanceof TextQuoteSelector selector)) {
return false;
}
TextQuoteSelector selector = (TextQuoteSelector) o;
return Objects.equals(exactMatch, selector.exactMatch) &&
Objects.equals(prefix, selector.prefix) &&
Objects.equals(suffix, selector.suffix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof XPathSelector)) {
if (!(o instanceof XPathSelector that)) {
return false;
}
XPathSelector that = (XPathSelector) o;
return Objects.equals(value, that.value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Term)) {
if (!(o instanceof Term term)) {
return false;
}
Term term = (Term) o;
return Objects.equals(getId(), term.getUri());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void load() {
"FILTER NOT EXISTS { ?g ?basedOnVersion ?canonical . } " +
"}}")
.setParameter("type", URI.create(Vocabulary.s_c_slovnik))
.setParameter("basedOnVersion", URI.create(Vocabulary.s_p_vychazi_z_verze))
.setParameter("basedOnVersion", URI.create(Vocabulary.s_p_d_sgov_pracovni_prostor_pojem_vychazi_z_verze))
.getResultStream().forEach(row -> {
assert row instanceof Object[];
assert ((Object[]) row).length == 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public URI getVocabularyContext(URI vocabularyUri) {
"}}", URI.class)
.setParameter("type", URI.create(Vocabulary.s_c_slovnik))
.setParameter("vocabulary", vocabularyUri)
.setParameter("basedOnVersion", URI.create(Vocabulary.s_p_vychazi_z_verze))
.setParameter("basedOnVersion", URI.create(Vocabulary.s_p_d_sgov_pracovni_prostor_pojem_vychazi_z_verze))
.getSingleResult();
} catch (NoResultException e) {
LOG.debug("No context mapped for vocabulary {}, returning the vocabulary IRI as context identifier.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class StaticContexts {
/**
* Repository context for storing {@link cz.cvut.kbss.termit.model.UserGroup} instances.
*/
public static final String USER_GROUPS = Vocabulary.s_c_Usergroup;
public static final String USER_GROUPS = Vocabulary.s_c_sioc_Usergroup;

/**
* Repository context for storing {@link cz.cvut.kbss.termit.model.acl.AccessControlList} instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public Page<RecentlyCommentedAsset> findLastCommentedInReaction(User author, Pag
.setParameter("hasLabel", labelProperty())
.setParameter("hasModifiedTime", URI.create(Vocabulary.s_p_ma_datum_a_cas_posledni_modifikace))
.setParameter("hasCreatedTime", URI.create(Vocabulary.s_p_ma_datum_a_cas_vytvoreni))
.setParameter("hasAuthor", URI.create(Vocabulary.s_p_has_creator))
.setParameter("hasAuthor", URI.create(Vocabulary.s_p_sioc_has_creator))
.setParameter("language", config.getLanguage())
.setParameter("author", author)
.setMaxResults(pageSpec.getPageSize()).setFirstResult((int) pageSpec.getOffset())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public UserGroupDao(EntityManager em, DescriptorFactory descriptorFactory) {
public void persist(UserGroup entity) {
Objects.requireNonNull(entity);
if (entity.getUri() == null) {
entity.setUri(IdentifierResolver.generateSyntheticIdentifier(Vocabulary.s_c_Usergroup));
entity.setUri(IdentifierResolver.generateSyntheticIdentifier(Vocabulary.s_c_sioc_Usergroup));
}
super.persist(entity);
}
Expand Down
Loading

0 comments on commit 0aacea9

Please sign in to comment.