Skip to content

Commit

Permalink
Rename main RDFResource property getting method to getProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Jan 16, 2025
1 parent 323a8dc commit 2d8b1b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Object invoke(Object object, String property, IEolContext context) throws
// Otherwise, use RDF information
if (object instanceof RDFResource) {
RDFResource res = (RDFResource) object;
return res.listPropertyValues(property, context);
return res.getProperty(property, context);
}

ModuleElement ast = context.getExecutorFactory().getActiveModuleElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Resource getResource() {
return resource;
}

public Collection<Object> listPropertyValues(String property, IEolContext context) {
public Object getProperty(String property, IEolContext context) {
final RDFQualifiedName pName = RDFQualifiedName.from(property, this.owningModel::getNamespaceURI);
Collection<Object> value = listPropertyValues(pName, context, LiteralMode.VALUES_ONLY);

Expand All @@ -61,7 +61,11 @@ public Collection<Object> listPropertyValues(String property, IEolContext contex
RDFQualifiedName withoutLiteral = pName.withLocalName(localNameWithoutSuffix);
value = listPropertyValues(withoutLiteral, context, LiteralMode.RAW);
}


// TODO: if max cardinality is 1, only return that single object (not a
// collection), or null if we haven't found any values (the underlying
// collection is empty).

return value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void listModelRestictions() {
public void getMotherBoard() {
loadModelDefaults();
RDFResource element = model.getElementById(URI_BIGNAME42);
Collection<Object> motherBoard = element.listPropertyValues("eg:hasMotherBoard", context);
Collection<Object> motherBoard = element.getProperty("eg:hasMotherBoard", context);
assertTrue("hasMotherBoard has max cardinality of 1 should only have 1 value returned ", motherBoard.size() == 1);
}

Expand Down

0 comments on commit 2d8b1b4

Please sign in to comment.