Skip to content

Ability to load query with prefixes or base IRI for classes and entities (not necessarily for values) #786

@tfrancart

Description

@tfrancart

Considering the length of Agent prompts and the length of output queries, it could be desirable to be able to load queries that declare prefixes or base IRI.

Can you:

  1. uncomment this part:
Image
  1. Also adjust this part:
Image
  1. modify queryLoader v13 so that everytime we read a value of rdfType in a TermTypedVariable, it is first checked against the declared prefixes and base, and also the predicate IRI. The logic is kind of similar to this one:
	public boolean usesKnownPrefix(String qname) {
		boolean result = false;
		if(qname.contains(":")) {
			String prefix = qname.substring(0, qname.indexOf(':'));
			result = prefixes.containsKey(prefix);
		}
		return result;
	}
	
	public String uri(String value, boolean fixHttp) {
		// if the value starts with http, return it directly
		if(value.startsWith("http") || value.startsWith("mailto")) {
			// trim the value to remove trailing whitespaces
			return value.trim();
		}
		// if the value uses a known prefix, expand it
		if(usesKnownPrefix(value)) {
			// always trim, trim, trim
			return expand(value).trim();
		}
		
		if(fixHttp) {
			// ... snip ... not interesting here
		} else {
			return null;
		}
	}

We could first do it for classes and predicates, but not necessarily for values.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions