Skip to content

Commit

Permalink
Use latest JOPA, replaced usages of the deprecated CommonVocabulary c…
Browse files Browse the repository at this point in the history
…lass.
  • Loading branch information
ledsoft committed Jul 19, 2018
1 parent 7a53339 commit c5ef548
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 58 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<cz.cvut.kbss.jopa.version>0.10.2</cz.cvut.kbss.jopa.version>
<cz.cvut.kbss.jopa.version>0.10.3</cz.cvut.kbss.jopa.version>

<junit.version>4.12</junit.version>
<org.mockito.version>1.10.19</org.mockito.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/
package cz.cvut.kbss.jsonld.common;

import cz.cvut.kbss.jopa.CommonVocabulary;
import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty;
import cz.cvut.kbss.jopa.model.annotations.OWLClass;
import cz.cvut.kbss.jopa.vocabulary.RDFS;
import cz.cvut.kbss.jsonld.JsonLd;
import cz.cvut.kbss.jsonld.annotation.JsonLdAttributeOrder;
import cz.cvut.kbss.jsonld.environment.Generator;
Expand Down Expand Up @@ -121,7 +121,7 @@ public void getAttributeIdentifierReturnsIriOfOWLObjectProperty() throws Excepti
@Test
public void getAttributeIdentifierReturnsIriOfOWLAnnotationProperty() throws Exception {
final String id = BeanAnnotationProcessor.getAttributeIdentifier(Organization.class.getDeclaredField("name"));
assertEquals(CommonVocabulary.RDFS_LABEL, id);
assertEquals(RDFS.LABEL, id);
}

@Test
Expand Down Expand Up @@ -154,7 +154,7 @@ public void getInstanceIdentifierReturnsEmptyOptionalWhenInstanceHasNoIdentifier

@OWLClass(iri = "http://krizik.felk.cvut.cz/ontologies/jb4jsonld/ClassWithoutIdentifier")
private static class ClassWithoutIdentifier {
@OWLAnnotationProperty(iri = CommonVocabulary.RDFS_LABEL)
@OWLAnnotationProperty(iri = RDFS.LABEL)
private String label;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
/**
* Copyright (C) 2017 Czech Technical University in Prague
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.jsonld.deserialization.expanded;

import cz.cvut.kbss.jopa.CommonVocabulary;
import cz.cvut.kbss.jopa.model.annotations.Id;
import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty;
import cz.cvut.kbss.jopa.model.annotations.OWLClass;
import cz.cvut.kbss.jopa.vocabulary.RDFS;
import cz.cvut.kbss.jsonld.Configuration;
import cz.cvut.kbss.jsonld.JsonLd;
import cz.cvut.kbss.jsonld.annotation.JsonLdAttributeOrder;
Expand Down Expand Up @@ -84,14 +82,15 @@ public void processValueProcessesAttributesInOrderSpecifiedByJsonLdAttributeOrde
deserializer.processValue((Map<?, ?>) input.get(0));

final InOrder inOrder = inOrder(instanceBuilderMock);
inOrder.verify(instanceBuilderMock).addValue(eq(CommonVocabulary.RDFS_LABEL), any());
inOrder.verify(instanceBuilderMock).addValue(eq(RDFS.LABEL), any());
inOrder.verify(instanceBuilderMock).openCollection(Vocabulary.HAS_PARTICIPANT);
inOrder.verify(instanceBuilderMock).openCollection(Vocabulary.HAS_MEMBER);
}

@Test
public void processValueThrowsJsonLdDeserializationExceptionWhenUnknownFieldNameIsUsedInAttributeOrderSpecification() throws
Exception {
public void processValueThrowsJsonLdDeserializationExceptionWhenUnknownFieldNameIsUsedInAttributeOrderSpecification()
throws
Exception {
when(tcResolverMock.getTargetClass(eq(InvalidOrder.class), anyCollection())).thenReturn(InvalidOrder.class);
when(instanceBuilderMock.getCurrentRoot()).thenReturn(new InvalidOrder());
when(instanceBuilderMock.isPropertyMapped(any())).thenReturn(true);
Expand All @@ -103,7 +102,8 @@ public void processValueThrowsJsonLdDeserializationExceptionWhenUnknownFieldName

thrown.expect(JsonLdDeserializationException.class);
thrown.expectMessage(
"Field called unknown declared in JsonLdAttributeOrder annotation not found in class " + InvalidOrder.class + " .");
"Field called unknown declared in JsonLdAttributeOrder annotation not found in class " +
InvalidOrder.class + " .");
deserializer.processValue((Map<?, ?>) input.get(0));
}

Expand All @@ -114,7 +114,7 @@ public static class InvalidOrder {
@Id
private URI uri;

@OWLAnnotationProperty(iri = CommonVocabulary.RDFS_LABEL)
@OWLAnnotationProperty(iri = RDFS.LABEL)
private String name;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
/**
* Copyright (C) 2017 Czech Technical University in Prague
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.jsonld.environment.model;

import cz.cvut.kbss.jopa.CommonVocabulary;
import cz.cvut.kbss.jopa.model.annotations.*;
import cz.cvut.kbss.jopa.vocabulary.RDFS;
import cz.cvut.kbss.jsonld.environment.Vocabulary;

import java.net.URI;
Expand All @@ -36,7 +34,7 @@ public class Organization {
@OWLAnnotationProperty(iri = Vocabulary.DATE_CREATED)
private Date dateCreated;

@OWLAnnotationProperty(iri = CommonVocabulary.RDFS_LABEL)
@OWLAnnotationProperty(iri = RDFS.LABEL)
private String name;

@OWLDataProperty(iri = Vocabulary.BRAND)
Expand Down
24 changes: 11 additions & 13 deletions src/test/java/cz/cvut/kbss/jsonld/environment/model/Study.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
/**
* Copyright (C) 2017 Czech Technical University in Prague
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.jsonld.environment.model;

import cz.cvut.kbss.jopa.CommonVocabulary;
import cz.cvut.kbss.jopa.model.annotations.Id;
import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty;
import cz.cvut.kbss.jopa.model.annotations.OWLClass;
import cz.cvut.kbss.jopa.model.annotations.OWLObjectProperty;
import cz.cvut.kbss.jopa.vocabulary.RDFS;
import cz.cvut.kbss.jsonld.annotation.JsonLdAttributeOrder;
import cz.cvut.kbss.jsonld.environment.Vocabulary;

Expand All @@ -32,7 +30,7 @@ public class Study {
@Id
private URI uri;

@OWLAnnotationProperty(iri = CommonVocabulary.RDFS_LABEL)
@OWLAnnotationProperty(iri = RDFS.LABEL)
private String name;

@OWLObjectProperty(iri = Vocabulary.HAS_MEMBER)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/**
* Copyright (C) 2017 Czech Technical University in Prague
* <p>
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.jsonld.serialization;

import cz.cvut.kbss.jopa.CommonVocabulary;
import cz.cvut.kbss.jopa.vocabulary.RDFS;
import cz.cvut.kbss.jsonld.JsonLd;
import cz.cvut.kbss.jsonld.environment.Generator;
import cz.cvut.kbss.jsonld.environment.Vocabulary;
Expand Down Expand Up @@ -222,7 +220,7 @@ public void visitFieldExtractsValueOfAnnotationPropertyAndAddsNodeToTheRoot() th
treeBuilder.visitField(Organization.class.getDeclaredField("name"), org.getName());
assertFalse(treeBuilder.getTreeRoot().getItems().isEmpty());
assertTrue(treeBuilder.getTreeRoot().getItems()
.contains(JsonNodeFactory.createLiteralNode(CommonVocabulary.RDFS_LABEL, org.getName())));
.contains(JsonNodeFactory.createLiteralNode(RDFS.LABEL, org.getName())));
}

@Test
Expand Down

0 comments on commit c5ef548

Please sign in to comment.