@Override
	public Location find(String query) throws DataDefinitionException {

		String path = query;
		String nepticalProtocol = "neptical://";
		NSpace currentSpace = rootLocation;
		DataModule parentModule = null;

		boolean changeNSpace = StringUtils.startsWith(path, nepticalProtocol)
				&& !StringUtils.startsWith(path, rootLocation.getResourceIdentity().toString());

		if (changeNSpace) {
			path = new String(path.substring(nepticalProtocol.length()));
			String nspaceToSwitch = PathUtil.firstSegment(path);
			path = PathUtil.chompFirstSegment(path);

			try {
				currentSpace = (NSpace) locationCache.get(new URI(nepticalProtocol + nspaceToSwitch),
						() -> NSpaceManager.getSpace(nspaceToSwitch));
				currentLocation = currentSpace;
			} catch (ExecutionException | URISyntaxException e) {
				throw new DataDefinitionException("Something went wrong when loading a new nspace from the query");
			}
		}

		String segment = PathUtil.firstSegment(path);

		if (currentSpace.containsModule(segment)) {
			parentModule = currentSpace.getDataModule(segment);
			path = PathUtil.chompFirstSegment(path);

			if (StringUtils.isEmpty(path) || StringUtils.endsWith(segment, MODULE_FRAGMENT_SELECTED)) {
				CursorLocation newLocation = new CursorLocation(currentSpace.getName(), segment, SCHEME_FRAGMENT_END);
				locationCache.put(newLocation.getResourceIdentity(), newLocation);
				currentLocation = newLocation;
				return newLocation;
			}

			segment = PathUtil.firstSegment(path);
		}

		if (parentModule == null) {
			parentModule = currentSpace.getDataModuleContaining(segment);
		}

		if (parentModule == null) {
			currentSpace.addModule(segment);
			parentModule = currentSpace.getDataModule(segment);
		}

		List<NepticalData> dataList = parentModule.getDataAt(segment);

		// TODO: imbed the template concept into the locations
		String selectedTemplateId = String.valueOf(dataList.size() - 1);

		if (Integer.valueOf(MODULE_FRAGMENT_SELECTED).equals(selectedTemplateId)) {
			selectedTemplateId = SCHEME_FRAGMENT_END;
		}

		CursorLocation newLocation = new CursorLocation(currentSpace.getName(), segment, selectedTemplateId);

		locationCache.put(newLocation.getResourceIdentity(), newLocation);

		currentLocation = newLocation;

		return newLocation;
	}