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 @@ -22,6 +22,7 @@ public interface Literal extends Value {
/**
* @return the lexical value of the literal
*/
@Override
String getLabel();

/**
Expand Down Expand Up @@ -52,6 +53,7 @@ public interface Literal extends Value {
/**
* @return the value of the literal as an int if possible
*/
@Override
int intValue();

/**
Expand All @@ -77,6 +79,7 @@ public interface Literal extends Value {
/**
* @return the value of the literal as a double if possible
*/
@Override
double doubleValue();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class SimpleDate extends AbstractTemporalPointLiteral {
private final XMLGregorianCalendar calendar;

public SimpleDate(String lexicalValue) {
this(lexicalValue, XSDDatatype.DATE.getIRI(), XSDDatatype.DATE);
this(lexicalValue, XSDDatatype.DATE.getIRI());
}

public SimpleDate(XMLGregorianCalendar calendar) {
Expand All @@ -33,11 +33,6 @@ public SimpleDate(XMLGregorianCalendar calendar) {
}

public SimpleDate(String lexicalValue, IRI datatype) {
this(lexicalValue, datatype, null);
}

@SuppressWarnings("java:S1172") // Kept for source compatibility with the temporal literal API.
public SimpleDate(String lexicalValue, IRI datatype, CoreDatatype coreDatatype) {
super(datatype == null ? XSDDatatype.DATE.getIRI() : datatype);
this.label = Objects.requireNonNull(lexicalValue, "lexicalValue");
this.calendar = DatatypeFactory.newDefaultInstance().newXMLGregorianCalendar(lexicalValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class SimpleDateTime extends AbstractTemporalPointLiteral {
private final XMLGregorianCalendar calendar;

public SimpleDateTime(String lexicalValue) {
this(lexicalValue, XSDDatatype.DATETIME.getIRI(), XSDDatatype.DATETIME);
this(lexicalValue, XSDDatatype.DATETIME.getIRI());
}

public SimpleDateTime(XMLGregorianCalendar calendar) {
Expand All @@ -33,11 +33,6 @@ public SimpleDateTime(XMLGregorianCalendar calendar) {
}

public SimpleDateTime(String lexicalValue, IRI datatype) {
this(lexicalValue, datatype, null);
}

@SuppressWarnings("java:S1172") // Kept for source compatibility with the temporal literal API.
public SimpleDateTime(String lexicalValue, IRI datatype, CoreDatatype coreDatatype) {
super(datatype == null ? XSDDatatype.DATETIME.getIRI() : datatype);
this.label = Objects.requireNonNull(lexicalValue, "lexicalValue");
this.calendar = DatatypeFactory.newDefaultInstance().newXMLGregorianCalendar(lexicalValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void readObject(ObjectInputStream input) throws IOException, ClassNotFou
}

public SimpleDuration(String lexicalValue) {
this(lexicalValue, XSDDatatype.DURATION.getIRI(), XSDDatatype.DURATION);
this(lexicalValue, XSDDatatype.DURATION.getIRI());
}

public SimpleDuration(TemporalAmount temporalAmount) {
Expand All @@ -53,12 +53,7 @@ public SimpleDuration(TemporalAmount temporalAmount) {
}

public SimpleDuration(String lexicalValue, IRI datatype) {
this(lexicalValue, datatype, null);
}

@SuppressWarnings("java:S1172") // Kept for source compatibility with the temporal literal API.
public SimpleDuration(String lexicalValue, IRI datatype, CoreDatatype coreDatatype) {
super();
super(datatype);
this.label = Objects.requireNonNull(lexicalValue, "lexicalValue");
this.temporalAmount = parseTemporalAmount(lexicalValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class SimpleTime extends AbstractTemporalPointLiteral {
private final XMLGregorianCalendar calendar;

public SimpleTime(String lexicalValue) {
this(lexicalValue, XSDDatatype.TIME.getIRI(), XSDDatatype.TIME);
this(lexicalValue, XSDDatatype.TIME.getIRI());
}

public SimpleTime(XMLGregorianCalendar calendar) {
Expand All @@ -33,11 +33,6 @@ public SimpleTime(XMLGregorianCalendar calendar) {
}

public SimpleTime(String lexicalValue, IRI datatype) {
this(lexicalValue, datatype, null);
}

@SuppressWarnings("java:S1172") // Kept for source compatibility with the temporal literal API.
public SimpleTime(String lexicalValue, IRI datatype, CoreDatatype coreDatatype) {
super(datatype == null ? XSDDatatype.TIME.getIRI() : datatype);
this.label = Objects.requireNonNull(lexicalValue, "lexicalValue");
this.calendar = DatatypeFactory.newDefaultInstance().newXMLGregorianCalendar(lexicalValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public boolean equals(Object other) {
}

@Override
@SuppressWarnings("NullableProblems")
public String toString() {
return "<<(" + subject + " " + predicate + " " + object + ")>>";
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ private void clearAllCharactersBuffers() {
}
}

/*
* The algorithm in <a href="https://www.w3.org/TR/rdfa-core/#s_sequence">W3C recommendation</a> is based on DOM processing, but this implementation is made in SAX.
/**
* The algorithm in <a href="https://www.w3.org/TR/rdfa-core/#s_sequence">W3C recommendation</a> is based on DOM processing, but this implementation is made in SAX.
* To reconcile both approaches, the "local values" are stored in a pile of ProcessingContext. The IRI mapping are shared independently.
* All operations except the ones that create literals are done ine this function.
* All operations except the ones that create literals are done in this function.
*/
@SuppressWarnings({"java:S3776", "java:S3398", "java:S125"})
private void startProcessElement(String qName, Attributes attrs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.xml.sax.Attributes;

import java.util.Optional;
import java.util.regex.Pattern;

import static fr.inria.corese.core.next.data.impl.io.parser.rdfxml.RDFXMLUtils.*;

Expand All @@ -22,6 +23,8 @@ public class RDFXMLStatementEmitter {

private static final Logger logger = LoggerFactory.getLogger(RDFXMLStatementEmitter.class);

private static final Pattern CONTAINER_MEMBERSHIP_PATTERN = Pattern.compile("^_\\d+$");

private final Model model;
private final ValueFactory factory;

Expand Down Expand Up @@ -138,7 +141,7 @@ public void emitPropertyAttribute(Resource subject, Attributes attrs) {
"rdf:li cannot be used as property attribute. " +
"It can only be used as property element inside containers.");
}
if (attrLocal.matches("^_\\d+$")) {
if (CONTAINER_MEMBERSHIP_PATTERN.matcher(attrLocal).matches()) {
throw new ParsingException(
"rdf:" + attrLocal + " cannot be used as property attribute. " +
"Container membership properties can only be used as property elements.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public Optional<Namespace> removeNamespace(String prefix) {
// -- Statement operations: read-only and always empty --

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Statement> iterator() {
return emptySet.iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ private Statement findNext() {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<V> iterator() {
return new ValueSetIterator(AbstractModel.this.iterator());
}
Expand Down Expand Up @@ -308,7 +307,6 @@ public boolean removeAll(Collection<?> collection) {
}

@Override
@SuppressWarnings("NullableProblems")
public Object[] toArray() {
Iterator<Statement> iterator = AbstractModel.this.iterator();
try {
Expand All @@ -323,7 +321,6 @@ public Object[] toArray() {
}

@Override
@SuppressWarnings("NullableProblems")
public <T> T[] toArray(T[] array) {
Iterator<Statement> iterator = AbstractModel.this.iterator();
try {
Expand Down Expand Up @@ -371,7 +368,6 @@ public boolean addAll(Collection<? extends V> collection) {
}

@Override
@SuppressWarnings("NullableProblems")
public boolean retainAll(Collection<?> collection) {
Iterator<V> iterator = iterator();
try {
Expand Down Expand Up @@ -431,7 +427,6 @@ public boolean contains(Object object) {
}

@Override
@SuppressWarnings("NullableProblems")
public Object[] toArray() {
Iterator<Statement> iterator = iterator();
try {
Expand All @@ -448,7 +443,6 @@ public Object[] toArray() {
}

@Override
@SuppressWarnings("NullableProblems")
public <T> T[] toArray(T[] array) {
Iterator<Statement> iterator = iterator();
try {
Expand Down Expand Up @@ -523,7 +517,6 @@ public boolean addAll(Collection<? extends Statement> collection) {
}

@Override
@SuppressWarnings("NullableProblems")
public boolean retainAll(Collection<?> collection) {
boolean modified = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public Model filter(Resource subject, IRI predicate, Value object, Resource... c
* Returns an unmodifiable iterator over the statements in the model.
*/
@Override
@SuppressWarnings("NullableProblems")
public Iterator<Statement> iterator() {
return Collections.unmodifiableSet(delegate).iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import fr.inria.corese.core.next.data.api.literal.CoreDatatype;
import fr.inria.corese.core.next.data.api.literal.XSDDatatype;
import fr.inria.corese.core.next.data.api.term.IRI;

/**
* Abstract class representing a duration literal in RDF.
Expand All @@ -21,7 +22,16 @@ public abstract class AbstractDuration extends AbstractLiteral implements Compar
* Constructor for AbstractDuration.
*/
protected AbstractDuration() {
super(XSDDatatype.DURATION.getIRI());
this(XSDDatatype.DURATION.getIRI());
}

/**
* Constructor for AbstractDuration with explicit datatype.
*
* @param datatype the datatype IRI, or null for default duration
*/
protected AbstractDuration(IRI datatype) {
super(datatype == null ? XSDDatatype.DURATION.getIRI() : datatype);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Thrown when a syntactically valid query fails during evaluation (execution).
*/
@SuppressWarnings("java:S110")
public class QueryEvaluationException extends QueryException {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Thrown when a SPARQL query or update string contains invalid syntax.
*/
@SuppressWarnings("java:S110")
public class QuerySyntaxException extends QueryException {

private final int line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Thrown when a query evaluation exceeds its configured timeout limit.
*/
@SuppressWarnings("java:S110")
public class QueryTimeoutException extends QueryEvaluationException {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Thrown when an operation on a {@link Repository}
* or {@link RepositoryConnection} fails.
*/
@SuppressWarnings("java:S110")
public class RepositoryException extends QueryException {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public Value getValue(String name) {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Binding> iterator() {
return values.entrySet().stream()
.<Binding>map(entry -> new ImmutableBinding(entry.getKey(), entry.getValue()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public interface StatementResult extends Closeable, Iterable<Statement> {
Statement next();

@Override
@SuppressWarnings("NullableProblems")
default Iterator<Statement> iterator() {
return new Iterator<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public interface TupleQueryResult extends Closeable, Iterable<BindingSet> {
* @return an iterator over the binding sets in this result
*/
@Override
@SuppressWarnings("NullableProblems")
default Iterator<BindingSet> iterator() {
return new Iterator<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public List<Node> getSelect() {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Result> iterator() {
Iterator<Mapping> it = maps.iterator();
return new Iterator<>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class KgramEventDispatcher implements Iterable<EventListener> {
List<EventListener> observers = new ArrayList<>();

@Override
@SuppressWarnings("NullableProblems")
public Iterator<EventListener> iterator() {
return observers.iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public synchronized void put(Mapping val, boolean next) {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Mapping> iterator() {
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public Value getValue(String name) {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Binding> iterator() {
return map.entrySet().stream()
.<Binding>map(e -> new CoreseBinding(e.getKey(), e.getValue()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ public static DatasetClauseAst none() {
@Override
public void accept(AstVisitor visitor) {
visitor.visit(this);
this.graphs.forEach(iriAst -> {
iriAst.accept(visitor);
});
this.namedGraphs.forEach(iriAst -> {
iriAst.accept(visitor);
});
this.graphs.forEach(iriAst -> iriAst.accept(visitor));
this.namedGraphs.forEach(iriAst -> iriAst.accept(visitor));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public void accept(AstVisitor visitor) {
visitor.visit(this);
this.prologue.accept(visitor);
this.datasetClause.accept(visitor);
this.described.forEach(termAst -> {
termAst.accept(visitor);
});
this.described.forEach(termAst -> termAst.accept(visitor));
this.whereClause.accept(visitor);
this.valuesClause.accept(visitor);
this.solutionModifier.accept(visitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public record PrefixDeclarationAst(String prefix, IriAst namespace) implements V
throw new IllegalArgumentException("prefix must be non-null");
}
prefix = stripTrailingColon(prefix);
namespace = Objects.requireNonNull(namespace, "namespace");
Objects.requireNonNull(namespace, "namespace");
if(! namespace.raw().isEmpty()) {
namespace = new IriAst(stripAngleBrackets(namespace.raw()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ public Model filter(Resource subject, IRI predicate, Value object, Resource... c
return new FilteredModel(this, subject, predicate, object, contexts) {

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Statement> iterator() {
return StorageModel.this.getFilterIterator(subject, predicate, object, contexts);
}
Expand Down Expand Up @@ -245,7 +244,6 @@ public Optional<Namespace> removeNamespace(String prefix) {
}

@Override
@SuppressWarnings("NullableProblems")
public Iterator<Statement> iterator() {
return getFilterIterator(null, null, null);
}
Expand Down
Loading
Loading