Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.epimorphics.lda.query.WantsMetadata;
import com.epimorphics.lda.renderers.Factories.FormatNameAndType;
import com.epimorphics.lda.shortnames.CompleteContext;
import com.epimorphics.lda.shortnames.ShortnameService;
import com.epimorphics.lda.sources.Source;
import com.epimorphics.lda.specs.APIEndpointSpec;
import com.epimorphics.lda.specs.EndpointDetails;
Expand Down Expand Up @@ -47,13 +48,16 @@ public class EndpointMetadata {
protected final boolean isListEndpoint;
protected final boolean isParameterBasedFormat;

public EndpointMetadata(EndpointDetails ep, Resource thisPage, String pageNumber, Bindings bindings) {
protected final ShortnameService sns;

public EndpointMetadata(EndpointDetails ep, Resource thisPage, String pageNumber, Bindings bindings, ShortnameService sns) {
this.bindings = bindings;
this.thisPage = thisPage;
this.pageNumber = pageNumber;
this.isListEndpoint = ep.isListEndpoint();
this.isParameterBasedFormat = ep.hasParameterBasedContentNegotiation();
this.thisPageAsURI = URIUtils.newURI(thisPage.getURI());
this.sns = sns;
}

public static void addAllMetadata
Expand Down Expand Up @@ -144,7 +148,7 @@ public EndpointMetadata(EndpointDetails ep, Resource thisPage, String pageNumber
if (suppress_IPTO == false) content.addProperty(FOAF.isPrimaryTopicOf, thisMetaPage);
}
//
EndpointMetadata em = new EndpointMetadata(details, thisMetaPage, "" + page, bindings);
EndpointMetadata em = new EndpointMetadata(details, thisMetaPage, "" + page, bindings, spec.getAPISpec().getShortnameService());
Model metaModel1 = mergedModels.getMetaModel();
Model mergedModels1 = mergedModels.getMergedModel();
//
Expand Down Expand Up @@ -327,6 +331,9 @@ public void addTermBindings(Model toScan, Model meta, Resource exec, CompleteCon
exec.addProperty(API.termBinding, tb);
tb.addProperty(API.label, shorty);
tb.addProperty(API.property, term);
if (sns.expand(shorty) == null) {
tb.addProperty(ELDA_API.isShortName, ResourceFactory.createTypedLiteral(true));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private static Set<Property> magicURIs() {
magic.add(DCTerms.isVersionOf);
magic.add(ELDA_API.listURL);
magic.add(ELDA_API.sparqlQuery);
magic.add(ELDA_API.isShortName);
magic.add(FOAF.isPrimaryTopicOf);
magic.add(FOAF.primaryTopic);
magic.add(OpenSearch.itemsPerPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.apache.jena.rdf.model.*;

/**
* Vocabulary definitions from /mnt/data/kal/Projects/elda/elda-lda/../vocabs/api.ttl
* @author Auto-generated by schemagen on 20 Nov 2025 14:26
* Vocabulary definitions from elda-lda/../vocabs/api.ttl
* @author Auto-generated by schemagen on 18 May 2026 15:56
*/
@SuppressWarnings({"removal", "deprecated"})
public class API {
Expand Down Expand Up @@ -68,6 +68,8 @@ public class API {
*/
public static final Property include = M_MODEL.createProperty( "http://purl.org/linked-data/api/vocab#include" );

public static final Property isShortName = M_MODEL.createProperty( "http://purl.org/linked-data/api/vocab#isShortName" );

/** <p>A template for the URI of the item that the item endpoint should return. Any
* instances of {varName} within the string are replaced by the value of the
* relevant variable.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.apache.jena.rdf.model.*;

/**
* Vocabulary definitions from /home/der/projects/java-workspace/elda/elda-lda/../vocabs/elda_api.ttl
* @author Auto-generated by schemagen on 05 Feb 2026 18:29
* Vocabulary definitions from /home/simon/dev/elda/elda-lda/../vocabs/elda_api.ttl
* @author Auto-generated by schemagen on 18 May 2026 15:56
*/
@SuppressWarnings({"removal", "deprecated"})
public class ELDA_API extends API {
Expand Down Expand Up @@ -136,6 +136,11 @@ public class ELDA_API extends API {
/** <p>Configs can include sub-config fragments.</p> */
public static final Property includesFragment = M_MODEL.createProperty( "http://www.epimorphics.com/vocabularies/lda#includesFragment" );

/** <p>Determines whether a term binding corresponds to a valid short name for filtering
* purposes.</p>
*/
public static final Property isShortName = M_MODEL.createProperty( "http://www.epimorphics.com/vocabularies/lda#isShortName" );

/** <p>Property of a JSONFormatter that says if xsd:date and xsd:dateTime values
* should be encoded based on ISO 8601. Default value is false.</p>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public boolean hasParameterBasedContentNegotiation() {
return false;
}
};
EndpointMetadata em = new EndpointMetadata(spec, thisPage, pageNumber, noBindings);
ShortnameService sns = new StandardShortnameService();
EndpointMetadata em = new EndpointMetadata(spec, thisPage, pageNumber, noBindings, sns);
//
PrefixMapping pm = PrefixMapping.Factory.create().setNsPrefix("this", "http://example.com/root#");
Model toScan = ModelIOUtils.modelFromTurtle(":a <http://example.com/root#predicate> :b.");
toScan.setNsPrefixes(pm);
Resource predicate = toScan.createProperty("http://example.com/root#predicate");
Model meta = ModelFactory.createDefaultModel();
Resource exec = meta.createResource("fake:exec");
ShortnameService sns = new StandardShortnameService();

CompleteContext cc =
new CompleteContext(CompleteContext.Mode.PreferPrefixes, sns.asContext(), pm);
Expand Down
2 changes: 2 additions & 0 deletions vocabs/api.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ api:variableBinding a rdf:Property.

api:termBinding a rdf:Property.

api:isShortName a rdf:Property.

api:Page a rdfs:Class.

api:HtmlFormatter a rdfs:Class.
Expand Down
5 changes: 5 additions & 0 deletions vocabs/elda_api.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ elda:termBinding a rdf:Property
; rdfs:comment "Property from page to term bindings"
.

elda:isShortName a rdf:Property
; rdfs:label "isShortName"
; rdfs:comment "Determines whether a term binding corresponds to a valid short name for filtering purposes."
.

elda:textContentProperty a rdf:Property
; rdfs:comment ""
.
Expand Down
Loading