From 5d50143295c18174c757be347d8509c28125d47d Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Fri, 10 Jan 2025 15:19:42 +0100 Subject: [PATCH] use strings again for storing user names --- include/osm2rdf/ttl/Constants.h | 4 ---- src/osm/FactHandler.cpp | 7 ++----- src/ttl/Writer.cpp | 6 ------ tests/ttl/Writer.cpp | 8 ++++---- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/include/osm2rdf/ttl/Constants.h b/include/osm2rdf/ttl/Constants.h index 0cdfcf2..4393b3a 100644 --- a/include/osm2rdf/ttl/Constants.h +++ b/include/osm2rdf/ttl/Constants.h @@ -28,7 +28,6 @@ const static inline std::string NAMESPACE__GEOSPARQL = "geo"; const static inline std::string NAMESPACE__OHM_NODE = "ohmnode"; const static inline std::string NAMESPACE__OHM_RELATION = "ohmrel"; const static inline std::string NAMESPACE__OHM_WAY = "ohmway"; -const static inline std::string NAMESPACE__OHM_USER = "ohmuser"; const static inline std::string NAMESPACE__OHM_CHANGESET = "ohmchangeset"; const static inline std::string NAMESPACE__OHM = "ohm"; const static inline std::string NAMESPACE__OPENGIS = "ogc"; @@ -36,7 +35,6 @@ const static inline std::string NAMESPACE__OSM_NODE = "osmnode"; const static inline std::string NAMESPACE__OSM_RELATION = "osmrel"; const static inline std::string NAMESPACE__OSM_TAG = "osmkey"; const static inline std::string NAMESPACE__OSM_WAY = "osmway"; -const static inline std::string NAMESPACE__OSM_USER = "osmuser"; const static inline std::string NAMESPACE__OSM_CHANGESET = "osmchangeset"; const static inline std::string NAMESPACE__OSM_META = "osmmeta"; const static inline std::string NAMESPACE__OSM = "osm"; @@ -120,8 +118,6 @@ const static inline std::vector WAY_NAMESPACE = { NAMESPACE__OSM_WAY, NAMESPACE__OHM_WAY}; const static inline std::vector CHANGESET_NAMESPACE = { NAMESPACE__OSM_CHANGESET, NAMESPACE__OHM_CHANGESET}; -const static inline std::vector USER_NAMESPACE = { - NAMESPACE__OSM_USER, NAMESPACE__OHM_USER}; } // namespace osm2rdf::ttl::constants diff --git a/src/osm/FactHandler.cpp b/src/osm/FactHandler.cpp index bbc77ff..2b33920 100644 --- a/src/osm/FactHandler.cpp +++ b/src/osm/FactHandler.cpp @@ -86,7 +86,6 @@ using osm2rdf::ttl::constants::NAMESPACE__OSM_WAY; using osm2rdf::ttl::constants::NAMESPACE__WIKIDATA_ENTITY; using osm2rdf::ttl::constants::NODE_NAMESPACE; using osm2rdf::ttl::constants::RELATION_NAMESPACE; -using osm2rdf::ttl::constants::USER_NAMESPACE; using osm2rdf::ttl::constants::WAY_NAMESPACE; // ____________________________________________________________________________ @@ -410,10 +409,8 @@ void osm2rdf::osm::FactHandler::writeMeta(const std::string& subj, // avoid writing empty users, drop entire triple if (!object.user().empty()) { - _writer->writeTriple( - subj, IRI__OSMMETA_USER, - _writer->generateIRI(USER_NAMESPACE[_config.sourceDataset], - object.user())); + _writer->writeTriple(subj, IRI__OSMMETA_USER, + _writer->generateLiteral(object.user(), "")); } // avoid writing empty user IDs, drop entire triple diff --git a/src/ttl/Writer.cpp b/src/ttl/Writer.cpp index 20d7e91..9ed79b3 100644 --- a/src/ttl/Writer.cpp +++ b/src/ttl/Writer.cpp @@ -76,8 +76,6 @@ osm2rdf::ttl::Writer::Writer(const osm2rdf::config::Config& config, "https://www.openstreetmap.org/relation/"}, {osm2rdf::ttl::constants::NAMESPACE__OSM_WAY, "https://www.openstreetmap.org/way/"}, - {osm2rdf::ttl::constants::NAMESPACE__OSM_USER, - "https://www.openstreetmap.org/user/"}, {osm2rdf::ttl::constants::NAMESPACE__OSM_CHANGESET, "https://www.openstreetmap.org/changeset/"}, // ohm prefixes @@ -89,8 +87,6 @@ osm2rdf::ttl::Writer::Writer(const osm2rdf::config::Config& config, "https://www.openhistoricalmap.org/relation/"}, {osm2rdf::ttl::constants::NAMESPACE__OHM_WAY, "https://www.openhistoricalmap.org/way/"}, - {osm2rdf::ttl::constants::NAMESPACE__OHM_USER, - "https://www.openhistoricalmap.org/user/"}, {osm2rdf::ttl::constants::NAMESPACE__OHM_CHANGESET, "https://www.openhistoricalmap.org/changeset/"}, }; @@ -170,8 +166,6 @@ osm2rdf::ttl::Writer::Writer(const osm2rdf::config::Config& config, osm2rdf::ttl::constants::NAMESPACE__OSM_WAY, "uniqueNodeCount"); osm2rdf::ttl::constants::IRI__OSM_NODE = generateIRI(osm2rdf::ttl::constants::NAMESPACE__OSM, "node"); - osm2rdf::ttl::constants::IRI__OSM_USER = - generateIRI(osm2rdf::ttl::constants::NAMESPACE__OSM, "user"); osm2rdf::ttl::constants::IRI__OSM_CHANGESET = generateIRI(osm2rdf::ttl::constants::NAMESPACE__OSM, "changeset"); osm2rdf::ttl::constants::IRI__OSM_RELATION = diff --git a/tests/ttl/Writer.cpp b/tests/ttl/Writer.cpp index c8db7e2..7a2bc50 100644 --- a/tests/ttl/Writer.cpp +++ b/tests/ttl/Writer.cpp @@ -704,8 +704,8 @@ TEST(TTL_WriterTTL, writeStatisticJson) { statsBuffer << statsIFStream.rdbuf(); ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"blankNodes\": 3")); - ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"header\": 24")); - ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"lines\": 29")); + ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"header\": 22")); + ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"lines\": 27")); ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"triples\": 5")); // Cleanup @@ -766,8 +766,8 @@ TEST(TTL_WriterQLEVER, writeStatisticJson) { statsBuffer << statsIFStream.rdbuf(); ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"blankNodes\": 3")); - ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"header\": 24")); - ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"lines\": 29")); + ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"header\": 22")); + ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"lines\": 27")); ASSERT_THAT(statsBuffer.str(), ::testing::HasSubstr("\"triples\": 5")); // Cleanup