io.konig.core.showl.ShowlUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of konig-core Show documentation
Show all versions of konig-core Show documentation
A library for core classes (Graph, Vertex, Edge, etc.)
package io.konig.core.showl;
import org.openrdf.model.URI;
import org.openrdf.model.vocabulary.XMLSchema;
/*
* #%L
* Konig Core
* %%
* Copyright (C) 2015 - 2019 Gregory McFall
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import io.konig.core.vocab.Konig;
import io.konig.formula.KqlType;
public class ShowlUtil {
public static boolean isUndefinedClass(ShowlClass owlClass) {
return owlClass == null || Konig.Undefined.equals(owlClass.getId());
}
public static KqlType kqlType(URI rdfType) {
if (
XMLSchema.INT.equals(rdfType) ||
XMLSchema.INTEGER.equals(rdfType) ||
XMLSchema.LONG.equals(rdfType) ||
XMLSchema.SHORT.equals(rdfType) ||
XMLSchema.BYTE.equals(rdfType) ||
XMLSchema.NON_POSITIVE_INTEGER.equals(rdfType) ||
XMLSchema.NON_NEGATIVE_INTEGER.equals(rdfType) ||
XMLSchema.NEGATIVE_INTEGER.equals(rdfType) ||
XMLSchema.UNSIGNED_BYTE.equals(rdfType) ||
XMLSchema.UNSIGNED_BYTE.equals(rdfType) ||
XMLSchema.UNSIGNED_LONG.equals(rdfType) ||
XMLSchema.UNSIGNED_SHORT.equals(rdfType) ||
XMLSchema.UNSIGNED_BYTE.equals(rdfType)
) {
return KqlType.INTEGER;
}
if (
XMLSchema.DECIMAL.equals(rdfType) ||
XMLSchema.FLOAT.equals(rdfType) ||
XMLSchema.DOUBLE.equals(rdfType)
) {
return KqlType.NUMBER;
}
if (
XMLSchema.DATETIME.equals(rdfType) ||
XMLSchema.DATE.equals(rdfType) ||
XMLSchema.GYEAR.equals(rdfType) ||
XMLSchema.GYEARMONTH.equals(rdfType)
) {
return KqlType.INSTANT;
}
if (
XMLSchema.BASE64BINARY.equals(rdfType) ||
XMLSchema.HEXBINARY.equals(rdfType) ||
XMLSchema.ANYURI.equals(rdfType) ||
XMLSchema.NOTATION.equals(rdfType) ||
XMLSchema.STRING.equals(rdfType) ||
XMLSchema.NORMALIZEDSTRING.equals(rdfType) ||
XMLSchema.TOKEN.equals(rdfType) ||
XMLSchema.LANGUAGE.equals(rdfType) ||
XMLSchema.NAME.equals(rdfType) ||
XMLSchema.NMTOKEN.equals(rdfType) ||
XMLSchema.NCNAME.equals(rdfType) ||
XMLSchema.NMTOKENS.equals(rdfType) ||
XMLSchema.ID.equals(rdfType) ||
XMLSchema.IDREF.equals(rdfType) ||
XMLSchema.ENTITY.equals(rdfType) ||
XMLSchema.QNAME.equals(rdfType)
) {
return KqlType.STRING;
}
return null;
}
}