diff --git a/oc_ocdm/__init__.py b/oc_ocdm/__init__.py index 6078e86..287d67d 100644 --- a/oc_ocdm/__init__.py +++ b/oc_ocdm/__init__.py @@ -13,7 +13,7 @@ # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -__version__ = '7.0.1' +__version__ = '9.1.1' from oc_ocdm.storer import Storer from oc_ocdm.reader import Reader diff --git a/oc_ocdm/graph/graph_entity.py b/oc_ocdm/graph/graph_entity.py index caf9259..a201f68 100644 --- a/oc_ocdm/graph/graph_entity.py +++ b/oc_ocdm/graph/graph_entity.py @@ -17,9 +17,8 @@ from typing import TYPE_CHECKING -from rdflib import Graph, Namespace, URIRef - from oc_ocdm.abstract_entity import AbstractEntity +from rdflib import Graph, Namespace, URIRef if TYPE_CHECKING: from typing import ClassVar, Dict, List, Optional, Tuple diff --git a/oc_ocdm/graph/graph_set.py b/oc_ocdm/graph/graph_set.py index 36ce793..4236db4 100755 --- a/oc_ocdm/graph/graph_set.py +++ b/oc_ocdm/graph/graph_set.py @@ -17,18 +17,15 @@ from typing import TYPE_CHECKING -from SPARQLWrapper import RDFXML, SPARQLWrapper - from oc_ocdm.abstract_set import AbstractSet from oc_ocdm.reader import Reader -from oc_ocdm.support.support import get_count, get_short_name, get_prefix +from oc_ocdm.support.support import get_count, get_prefix, get_short_name +from SPARQLWrapper import RDFXML, SPARQLWrapper if TYPE_CHECKING: from typing import Dict, ClassVar, Tuple, Optional, List, Set from rdflib import ConjunctiveGraph -from rdflib import Graph, Namespace, URIRef - from oc_ocdm.counter_handler.counter_handler import CounterHandler from oc_ocdm.counter_handler.filesystem_counter_handler import \ FilesystemCounterHandler @@ -53,6 +50,7 @@ ResponsibleAgent from oc_ocdm.graph.entities.identifier import Identifier from oc_ocdm.graph.graph_entity import GraphEntity +from rdflib import Graph, Namespace, URIRef class GraphSet(AbstractSet): diff --git a/oc_ocdm/storer.py b/oc_ocdm/storer.py index 3c10513..30a953c 100644 --- a/oc_ocdm/storer.py +++ b/oc_ocdm/storer.py @@ -22,9 +22,7 @@ from typing import TYPE_CHECKING from zipfile import ZIP_DEFLATED, ZipFile -from rdflib import ConjunctiveGraph, URIRef -from SPARQLWrapper import SPARQLWrapper - +from filelock import FileLock from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.metadata.metadata_entity import MetadataEntity from oc_ocdm.prov.prov_entity import ProvEntity @@ -32,7 +30,8 @@ from oc_ocdm.support.query_utils import get_update_query from oc_ocdm.support.reporter import Reporter from oc_ocdm.support.support import find_paths -from filelock import FileLock +from rdflib import ConjunctiveGraph, URIRef +from SPARQLWrapper import SPARQLWrapper if TYPE_CHECKING: from typing import Any, Dict, List, Optional, Set, Tuple diff --git a/oc_ocdm/support/support.py b/oc_ocdm/support/support.py index a89468e..803dae3 100644 --- a/oc_ocdm/support/support.py +++ b/oc_ocdm/support/support.py @@ -156,6 +156,7 @@ def encode_url(u: str) -> str: def create_literal(g: Graph, res: URIRef, p: URIRef, s: str, dt: URIRef = None, nor: bool = True) -> None: if not is_string_empty(s): + dt = dt if dt is not None else XSD.string g.add((res, p, Literal(s, datatype=dt, normalize=nor))) @@ -371,7 +372,7 @@ def build_graph_from_results(results: List[Dict]) -> Graph: o = URIRef(triple['o']['value']) else: datatype = triple['o'].get('datatype', None) - datatype = URIRef(datatype) if datatype is not None else None + datatype = URIRef(datatype) if datatype is not None else XSD.string o = Literal(triple['o']['value'], datatype=datatype) graph.add((s, p, o)) return graph diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_reference.py b/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_reference.py index 365d268..58266ba 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_reference.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_reference.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import XSD, Literal class TestBibliographicReference(unittest.TestCase): @@ -38,7 +37,7 @@ def test_has_content(self): result = self.be.has_content(content) self.assertIsNone(result) - triple = self.be.res, GraphEntity.iri_has_content, Literal(content) + triple = self.be.res, GraphEntity.iri_has_content, Literal(content, datatype=XSD.string) self.assertIn(triple, self.be.g) def test_has_annotation(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_resource.py b/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_resource.py index af38441..dea9a3d 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_resource.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_bibliographic_resource.py @@ -41,7 +41,7 @@ def test_has_title(self): result = self.br1.has_title(title) self.assertIsNone(result) - triple = self.br1.res, GraphEntity.iri_title, Literal(title) + triple = self.br1.res, GraphEntity.iri_title, Literal(title, datatype=XSD.string) self.assertIn(triple, self.br1.g) def test_has_subtitle(self): @@ -49,7 +49,7 @@ def test_has_subtitle(self): result = self.br1.has_subtitle(subtitle) self.assertIsNone(result) - triple = self.br1.res, GraphEntity.iri_has_subtitle, Literal(subtitle) + triple = self.br1.res, GraphEntity.iri_has_subtitle, Literal(subtitle, datatype=XSD.string) self.assertIn(triple, self.br1.g) def test_is_part_of(self): @@ -107,7 +107,7 @@ def test_create_number(self): result = self.br1.has_number(number) self.assertIsNone(result) - triple = self.br1.res, GraphEntity.iri_has_sequence_identifier, Literal(number) + triple = self.br1.res, GraphEntity.iri_has_sequence_identifier, Literal(number, datatype=XSD.string) self.assertIn(triple, self.br1.g) def test_has_edition(self): @@ -115,7 +115,7 @@ def test_has_edition(self): result = self.br1.has_edition(edition) self.assertIsNone(result) - triple = self.br1.res, GraphEntity.iri_has_edition, Literal(edition) + triple = self.br1.res, GraphEntity.iri_has_edition, Literal(edition, datatype=XSD.string) self.assertIn(triple, self.br1.g) def test_contains_in_reference_list(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_discourse_element.py b/oc_ocdm/test/graph/entities/bibliographic/test_discourse_element.py index 0ef61ca..02bfa36 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_discourse_element.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_discourse_element.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal, RDF - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import RDF, XSD, Literal class TestDiscourseElement(unittest.TestCase): @@ -39,7 +38,7 @@ def test_has_title(self): result = self.de1.has_title(title) self.assertIsNone(result) - triple = self.de1.res, GraphEntity.iri_title, Literal(title) + triple = self.de1.res, GraphEntity.iri_title, Literal(title, datatype=XSD.string) self.assertIn(triple, self.de1.g) def test_contains_discourse_element(self): @@ -75,7 +74,7 @@ def test_has_content(self): result = self.de1.has_content(content) self.assertIsNone(result) - triple = self.de1.res, GraphEntity.iri_has_content, Literal(content) + triple = self.de1.res, GraphEntity.iri_has_content, Literal(content, datatype=XSD.string) self.assertIn(triple, self.de1.g) def test_create_section(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_pointer_list.py b/oc_ocdm/test/graph/entities/bibliographic/test_pointer_list.py index 79f9c82..ac01435 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_pointer_list.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_pointer_list.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import XSD, Literal class TestPointerList(unittest.TestCase): @@ -37,7 +36,7 @@ def test_has_content(self): result = self.pl.has_content(content) self.assertIsNone(result) - triple = self.pl.res, GraphEntity.iri_has_content, Literal(content) + triple = self.pl.res, GraphEntity.iri_has_content, Literal(content, datatype=XSD.string) self.assertIn(triple, self.pl.g) def test_contains_element(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_reference_pointer.py b/oc_ocdm/test/graph/entities/bibliographic/test_reference_pointer.py index 01c8c71..ccd981d 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_reference_pointer.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_reference_pointer.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import XSD, Literal class TestReferencePointer(unittest.TestCase): @@ -39,7 +38,7 @@ def test_has_content(self): result = self.rp1.has_content(content) self.assertIsNone(result) - triple = self.rp1.res, GraphEntity.iri_has_content, Literal(content) + triple = self.rp1.res, GraphEntity.iri_has_content, Literal(content, datatype=XSD.string) self.assertIn(triple, self.rp1.g) def test_has_next_rp(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_resource_embodiment.py b/oc_ocdm/test/graph/entities/bibliographic/test_resource_embodiment.py index 6eb55a2..a8d1a69 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_resource_embodiment.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_resource_embodiment.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import URIRef, Literal, RDF - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import RDF, XSD, Literal, URIRef class TestResourceEmbodiment(unittest.TestCase): @@ -44,7 +43,7 @@ def test_has_starting_page(self): result = self.re.has_starting_page(starting_page) self.assertIsNone(result) - triple = self.re.res, GraphEntity.iri_starting_page, Literal(starting_page) + triple = self.re.res, GraphEntity.iri_starting_page, Literal(starting_page, datatype=XSD.string) self.assertIn(triple, self.re.g) def test_has_ending_page(self): @@ -52,7 +51,7 @@ def test_has_ending_page(self): result = self.re.has_ending_page(ending_page) self.assertIsNone(result) - triple = self.re.res, GraphEntity.iri_ending_page, Literal(ending_page) + triple = self.re.res, GraphEntity.iri_ending_page, Literal(ending_page, datatype=XSD.string) self.assertIn(triple, self.re.g) def test_has_url(self): diff --git a/oc_ocdm/test/graph/entities/bibliographic/test_responsible_agent.py b/oc_ocdm/test/graph/entities/bibliographic/test_responsible_agent.py index 2535937..285d4fa 100644 --- a/oc_ocdm/test/graph/entities/bibliographic/test_responsible_agent.py +++ b/oc_ocdm/test/graph/entities/bibliographic/test_responsible_agent.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal, URIRef - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import XSD, Literal, URIRef class TestResponsibleAgent(unittest.TestCase): @@ -37,7 +36,7 @@ def test_has_name(self): result = self.ra.has_name(name) self.assertIsNone(result) - triple = self.ra.res, GraphEntity.iri_name, Literal(name) + triple = self.ra.res, GraphEntity.iri_name, Literal(name, datatype=XSD.string) self.assertIn(triple, self.ra.g) def test_has_given_name(self): @@ -45,7 +44,7 @@ def test_has_given_name(self): result = self.ra.has_given_name(given_name) self.assertIsNone(result) - triple = self.ra.res, GraphEntity.iri_given_name, Literal(given_name) + triple = self.ra.res, GraphEntity.iri_given_name, Literal(given_name, datatype=XSD.string) self.assertIn(triple, self.ra.g) def test_has_family_name(self): @@ -53,7 +52,7 @@ def test_has_family_name(self): result = self.ra.has_family_name(family_name) self.assertIsNone(result) - triple = self.ra.res, GraphEntity.iri_family_name, Literal(family_name) + triple = self.ra.res, GraphEntity.iri_family_name, Literal(family_name, datatype=XSD.string) self.assertIn(triple, self.ra.g) def test_has_related_agent(self): diff --git a/oc_ocdm/test/graph/entities/test_identifier.py b/oc_ocdm/test/graph/entities/test_identifier.py index cb15184..4cd765a 100644 --- a/oc_ocdm/test/graph/entities/test_identifier.py +++ b/oc_ocdm/test/graph/entities/test_identifier.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import Literal - from oc_ocdm.graph.graph_entity import GraphEntity from oc_ocdm.graph.graph_set import GraphSet +from rdflib import XSD, Literal class TestIdentifier(unittest.TestCase): @@ -36,7 +35,7 @@ def test_create_orcid(self): result = self.identifier.create_orcid(orcid) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(orcid) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(orcid, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_orcid @@ -47,7 +46,7 @@ def test_create_doi(self): result = self.identifier.create_doi(doi) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(doi) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(doi, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_doi @@ -58,7 +57,7 @@ def test_create_pmid(self): result = self.identifier.create_pmid(pmid) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(pmid) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(pmid, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_pmid @@ -69,7 +68,7 @@ def test_create_pmcid(self): result = self.identifier.create_pmcid(pmcid) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(pmcid) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(pmcid, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_pmcid @@ -80,7 +79,7 @@ def test_create_issn(self): result = self.identifier.create_issn(issn) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(issn) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(issn, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_issn @@ -91,7 +90,7 @@ def test_create_isbn(self): result = self.identifier.create_isbn(isbn) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(isbn) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(isbn, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_isbn @@ -102,7 +101,7 @@ def test_create_url(self): result = self.identifier.create_url(url) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(url) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(url, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_url @@ -113,7 +112,7 @@ def test_create_xpath(self): result = self.identifier.create_xpath(xpath) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(xpath) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(xpath, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_xpath @@ -124,7 +123,7 @@ def test_create_intrepid(self): result = self.identifier.create_intrepid(intrepid) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(intrepid) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(intrepid, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_intrepid @@ -135,7 +134,7 @@ def test_create_xmlid(self): result = self.identifier.create_xmlid(xmlid) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(xmlid) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(xmlid, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_xmlid @@ -146,7 +145,7 @@ def test_create_wikidata(self): result = self.identifier.create_wikidata(wikidata) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(wikidata) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(wikidata, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_wikidata @@ -157,7 +156,7 @@ def test_create_wikipedia(self): result = self.identifier.create_wikipedia(wikipedia) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(wikipedia) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(wikipedia, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_wikipedia @@ -168,7 +167,7 @@ def test_create_crossref(self): result = self.identifier.create_crossref(crossref) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(crossref) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(crossref, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_crossref @@ -179,7 +178,7 @@ def test_create_datacite(self): result = self.identifier.create_datacite(datacite) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(datacite) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(datacite, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_datacite @@ -190,7 +189,7 @@ def test_create_viaf(self): result = self.identifier.create_viaf(viaf) self.assertIsNone(result) - triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(viaf) + triple = self.identifier.res, GraphEntity.iri_has_literal_value, Literal(viaf, datatype=XSD.string) self.assertIn(triple, self.identifier.g) triple = self.identifier.res, GraphEntity.iri_uses_identifier_scheme, GraphEntity.iri_viaf diff --git a/oc_ocdm/test/metadata/entities/test_dataset.py b/oc_ocdm/test/metadata/entities/test_dataset.py index cf15b75..ca943ab 100644 --- a/oc_ocdm/test/metadata/entities/test_dataset.py +++ b/oc_ocdm/test/metadata/entities/test_dataset.py @@ -15,10 +15,9 @@ # SOFTWARE. import unittest -from rdflib import URIRef, Literal, XSD - -from oc_ocdm.metadata.metadata_set import MetadataSet from oc_ocdm.metadata.metadata_entity import MetadataEntity +from oc_ocdm.metadata.metadata_set import MetadataSet +from rdflib import XSD, Literal, URIRef class TestDataset(unittest.TestCase): @@ -38,7 +37,7 @@ def test_has_title(self): result = self.dataset.has_title(title) self.assertIsNone(result) - triple = self.dataset.res, MetadataEntity.iri_title, Literal(title) + triple = self.dataset.res, MetadataEntity.iri_title, Literal(title, datatype=XSD.string) self.assertIn(triple, self.dataset.g) def test_has_description(self): @@ -46,7 +45,7 @@ def test_has_description(self): result = self.dataset.has_description(description) self.assertIsNone(result) - triple = self.dataset.res, MetadataEntity.iri_description, Literal(description) + triple = self.dataset.res, MetadataEntity.iri_description, Literal(description, datatype=XSD.string) self.assertIn(triple, self.dataset.g) def test_has_publication_date(self): @@ -72,7 +71,7 @@ def test_has_keyword(self): result = self.dataset.has_keyword(keyword) self.assertIsNone(result) - triple = self.dataset.res, MetadataEntity.iri_keyword, Literal(keyword) + triple = self.dataset.res, MetadataEntity.iri_keyword, Literal(keyword, datatype=XSD.string) self.assertIn(triple, self.dataset.g) def test_has_subject(self): diff --git a/oc_ocdm/test/metadata/entities/test_distribution.py b/oc_ocdm/test/metadata/entities/test_distribution.py index d305261..d59a0cb 100644 --- a/oc_ocdm/test/metadata/entities/test_distribution.py +++ b/oc_ocdm/test/metadata/entities/test_distribution.py @@ -36,7 +36,7 @@ def test_has_title(self): result = self.di.has_title(title) self.assertIsNone(result) - triple = self.di.res, MetadataEntity.iri_title, Literal(title) + triple = self.di.res, MetadataEntity.iri_title, Literal(title, datatype=XSD.string) self.assertIn(triple, self.di.g) def test_has_description(self): @@ -44,7 +44,7 @@ def test_has_description(self): result = self.di.has_description(description) self.assertIsNone(result) - triple = self.di.res, MetadataEntity.iri_description, Literal(description) + triple = self.di.res, MetadataEntity.iri_description, Literal(description, datatype=XSD.string) self.assertIn(triple, self.di.g) def test_has_publication_date(self): diff --git a/oc_ocdm/test/prov/entities/test_snapshot_entity.py b/oc_ocdm/test/prov/entities/test_snapshot_entity.py index 9934993..b8551c9 100644 --- a/oc_ocdm/test/prov/entities/test_snapshot_entity.py +++ b/oc_ocdm/test/prov/entities/test_snapshot_entity.py @@ -83,7 +83,7 @@ def test_has_update_action(self): result = self.se.has_update_action(update_query) self.assertIsNone(result) - triple = self.se.res, ProvEntity.iri_has_update_query, Literal(update_query) + triple = self.se.res, ProvEntity.iri_has_update_query, Literal(update_query, datatype=XSD.string) self.assertIn(triple, self.se.g) def test_has_description(self): @@ -91,7 +91,7 @@ def test_has_description(self): result = self.se.has_description(description) self.assertIsNone(result) - triple = self.se.res, ProvEntity.iri_description, Literal(description) + triple = self.se.res, ProvEntity.iri_description, Literal(description, datatype=XSD.string) self.assertIn(triple, self.se.g) def test_has_resp_agent(self): diff --git a/oc_ocdm/test/prov/prov_counter.db b/oc_ocdm/test/prov/prov_counter.db index 8964e9d..cd8b1e0 100644 Binary files a/oc_ocdm/test/prov/prov_counter.db and b/oc_ocdm/test/prov/prov_counter.db differ diff --git a/oc_ocdm/test/storer/test_storer.py b/oc_ocdm/test/storer/test_storer.py index b786a0b..519af8f 100644 --- a/oc_ocdm/test/storer/test_storer.py +++ b/oc_ocdm/test/storer/test_storer.py @@ -110,7 +110,7 @@ def test_store_graphs_in_file(self): . . . - "The entity 'http://test/br/0601' has been created." . + "The entity 'http://test/br/0601' has been created."^^ . """, format="nquads") for s, p, o, c in data_g.quads(): if p == URIRef("http://www.w3.org/ns/prov#generatedAtTime"): @@ -133,7 +133,7 @@ def test_store_graphs_in_file(self): . . . - "The entity 'http://test/br/0601' has been created." . + "The entity 'http://test/br/0601' has been created."^^ . """, format="nquads") for s, p, o, c in prov_unzipped.quads(): if p == URIRef("http://www.w3.org/ns/prov#generatedAtTime"): diff --git a/pyproject.toml b/pyproject.toml index c055ac4..f478817 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "oc_ocdm" -version = "9.1.0" +version = "9.1.1" description = "Object mapping library for manipulating RDF graphs that are compliant with the OpenCitations datamodel." authors = [ "Silvio Peroni ",