001/* 002 * SPDX-License-Identifier: Apache-2.0 003 * 004 * Copyright 2024-2026 The Enola <https://enola.dev> Authors 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package dev.enola.thing; 019 020import com.google.errorprone.annotations.Immutable; 021 022/** 023 * Link is an IRI "reference" to another {@link Thing}. 024 * 025 * <p>IRI are normally just String in Enola; this type only exists, and is required, so that it can 026 * be returned by {@link Thing#get(String)} and distinguished from a String which is not an IRI but 027 * text. 028 * 029 * @param iri the IRI (Internationalized Resource Identifier) that references another Thing 030 */ 031// TODO Consider using a Datatype to indicate link? But which... 032// TODO Abandon this and just use java.net.URI in Things instead?! No, that's less efficient. 033// Or change this record to a class and have an URI field, for 1 time conversion. 034// TODO Make it extend Thing; and voilĂ , it's a Property Graph! 035@Immutable 036public record Link(String iri) implements HasIRI { 037 038 public Link { 039 if (iri == null || iri.isBlank()) { 040 throw new IllegalArgumentException("IRI cannot be null or trimmed empty."); 041 } 042 } 043 044 @Override 045 public String toString() { 046 // TODO return "<" + iri + ">"; 047 return iri; 048 } 049}