Skip to content

Commit

Permalink
use strings again for storing user names
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbr committed Jan 10, 2025
1 parent bd5dc2d commit 5d50143
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
4 changes: 0 additions & 4 deletions include/osm2rdf/ttl/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ 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";
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";
Expand Down Expand Up @@ -120,8 +118,6 @@ const static inline std::vector<std::string> WAY_NAMESPACE = {
NAMESPACE__OSM_WAY, NAMESPACE__OHM_WAY};
const static inline std::vector<std::string> CHANGESET_NAMESPACE = {
NAMESPACE__OSM_CHANGESET, NAMESPACE__OHM_CHANGESET};
const static inline std::vector<std::string> USER_NAMESPACE = {
NAMESPACE__OSM_USER, NAMESPACE__OHM_USER};

} // namespace osm2rdf::ttl::constants

Expand Down
7 changes: 2 additions & 5 deletions src/osm/FactHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

// ____________________________________________________________________________
Expand Down Expand Up @@ -410,10 +409,8 @@ void osm2rdf::osm::FactHandler<W>::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
Expand Down
6 changes: 0 additions & 6 deletions src/ttl/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ osm2rdf::ttl::Writer<T>::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
Expand All @@ -89,8 +87,6 @@ osm2rdf::ttl::Writer<T>::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/"},
};
Expand Down Expand Up @@ -170,8 +166,6 @@ osm2rdf::ttl::Writer<T>::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 =
Expand Down
8 changes: 4 additions & 4 deletions tests/ttl/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5d50143

Please sign in to comment.