File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
160
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
185
|
}
else {
// the identifier must be a Concept
if (check(expr.getLeftParameter(), false, true, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe range identifier must be a Concept, " +
"not a " + error + "\n" + leSerializer.serialize(expr));
}
// the arguments must be datatypes
if (check(expr.getRightParameter(), true, true, true, false, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe arguments must be " +
"Datatypes, not " + error + "\n" + leSerializer.serialize(expr));
}
// the attribute's name must be a Relation with concrete range
if ((check(expr.getAttribute(), true, true, false, true, true))
|| (!checkConcreteRelations(expr.getAttribute()))){
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe name must be a Relation with concrete range, " +
"not a " + error + "\n" + leSerializer.serialize(expr));
}
}
}
/**
* @see org.deri.wsmo4j.validator.WsmlFullExpressionValidator#visitAttributeInferenceMolecule(org.omwg.logicalexpression.AttributeInferenceMolecule)
*/
public void visitAttributeInferenceMolecule(AttributeInferenceMolecule expr) {
|
File |
Line |
com/ontotext/wsmo4j/parser/owl/WSMLFromOWL.java |
905
|
com/ontotext/wsmo4j/parser/owl/WSMLFromOWL.java |
979
|
} else if (allRestrictions.containsKey(element)){
IRI asId = _factory.createIRI(uriStr + (++axiom_counter));
Axiom ax = _factory.createAxiom(asId);
theOntology.addAxiom(ax);
ax.addNFPValue(_factory.createIRI(Constants.DC_relation), id);
String foo = (String)allRestrictions.get(element);
do {
int pos = foo.indexOf("|class|");
if (pos < 0)
break;
foo = foo.substring(0, pos)+ xForm(uriStr)+foo.substring(pos + "|class|".length());
} while (true);
try {
ax.addDefinition(_leFactory.createLogicalExpression(foo, theOntology));
} catch (ParserException pe) {
throw new InvalidModelException(pe);
}
concept.addNFPValue(_factory.createIRI(Constants.DC_relation), asId);
}
}
try {
|
File |
Line |
org/deri/wsmo4j/io/parser/rdf/RDFParserImpl.java |
126
|
org/deri/wsmo4j/io/parser/xml/LogExprParserImpl.java |
46
|
Object o = map.get(Factory.WSMO_FACTORY);
if (o == null || ! (o instanceof WsmoFactory)) {
o = Factory.createWsmoFactory(new HashMap <String, Object> ());
}
factory = (WsmoFactory)o;
assert (factory != null);
o = map.get(Factory.LE_FACTORY);
if (o == null || ! (o instanceof LogicalExpressionFactory)) {
o = Factory.createLogicalExpressionFactory(new HashMap <String, Object> ());
}
leFactory = (LogicalExpressionFactory)o;
assert (leFactory != null);
o = map.get(Factory.DATA_FACTORY);
if (o == null || ! (o instanceof DataFactory)) {
o = Factory.createDataFactory(new HashMap <String, Object> ());
}
dataFactory = (DataFactory)o;
assert (dataFactory != null);
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
1129
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
1419
|
List <Term> l = listMap.get(v1);
if (l.contains(v2)) {
return true;
}
else {
connected.add(v1);
Iterator it = l.iterator();
while (it.hasNext()) {
Variable v = (Variable) it.next();
for (int i=0; i<connected.size(); i++) {
if (v.equals(connected.get(i))) {
used = true;
}
}
if (!used) {
found = checkGraphConnected(v, v2);
}
if (found) {
return true;
}
used = false;
}
return false;
}
}
/*
* Checks if a given graph contains a cycle.
*/
private boolean checkGraphAcyclic(Variable from, Variable v, List checkList) {
if ((numberOfMolecules + 1) == variables.size()) {
|
File |
Line |
org/deri/wsmo4j/factory/DataFactoryImpl.java |
292
|
org/deri/wsmo4j/factory/DataFactoryImpl.java |
318
|
if (cal.isSet(Calendar.ZONE_OFFSET)) {
int zoneOffSetHour = cal.getTimeZone().getRawOffset() / 1000 / 60;
int zoneOffSetMinute = cal.get(Calendar.ZONE_OFFSET) / 1000 % 60;
return new SimpleDataValue[] {
createWsmlInteger(new BigInteger("" + cal.get(Calendar.YEAR))),
createWsmlInteger(new BigInteger("" + (cal.get(Calendar.MONTH) + 1))),
createWsmlInteger(new BigInteger("" + cal.get(Calendar.DAY_OF_MONTH))),
createWsmlInteger(new BigInteger("" + zoneOffSetHour)),
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
414
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
380
|
}
else {
error = "";
// the identifier must be a Concept
if (check(expr.getLeftParameter(), false, true, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe identifier must be a Concept, " +
"not a " + error + "\n" + leSerializer.serialize(expr));
}
// the arguments must be Concepts
if (check(expr.getRightParameter(), false, true, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe arguments must be Concepts, " +
"not " + error + "\n" + leSerializer.serialize(expr));
}
}
}
/**
* Checks if a Negation is valid to wsml-dl.
*
* @see org.deri.wsmo4j.validator.WsmlFullExpressionValidator#visitNegation(org.omwg.logicalexpression.Negation)
*/
public void visitNegation(Negation expr) {
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
149
|
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
191
|
+ leSerializer.serialize(expr);
// An AttributeInferenceMolecule is no valid right-hand side formula
if (rhs) {
if (errorFlag) {
addError(expr, ValidationError.AX_RHS_ERR + error);
}
}
else if (lhs) {
if (errorFlag) {
addError(expr, ValidationError.AX_LHS_ERR + error);
}
}
else {
// the identifier must be a Concept
if (check(expr.getLeftParameter(), false, true, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe range identifier must be a Concept, " +
"not a " + error + "\n" + leSerializer.serialize(expr));
}
// the arguments of an infering attribute must be datatypes or concepts
if (check(expr.getRightParameter(), false, true, true, false, true)) {
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
378
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
343
|
}
}
else {
// the identifier must be an Instance
if (check(expr.getLeftParameter(), true, false, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe identifier must be an Instance, " +
"not a " + error + "\n" + leSerializer.serialize(expr));
}
// the arguments must be Concepts
if (check(expr.getRightParameter(), false, true, true, true, true)) {
addError(expr, ValidationError.AX_ATOMIC_ERR + ":"
+ "\nThe arguments must be Concepts, " +
"not " + error + "\n" + leSerializer.serialize(expr));
}
}
}
/**
* @see org.deri.wsmo4j.validator.WsmlFullExpressionValidator#visitSubConceptMolecule(org.omwg.logicalexpression.SubConceptMolecule)
*/
public void visitSubConceptMolecule(SubConceptMolecule expr) {
|
File |
Line |
org/deri/wsmo4j/validator/AttributeErrorImpl.java |
39
|
org/deri/wsmo4j/validator/LogicalExpressionErrorImpl.java |
44
|
}
/**
* Formats the String representation of the ValidationError.
*
* @see java.lang.Object#toString()
*/
public String toString() {
String id = "<Identifier>";
//short id if possible:
if (getEntity() != null) {
id = getEntity().getIdentifier().toString();
if (getEntity().getIdentifier()instanceof IRI) {
id = ((IRI)getEntity().getIdentifier()).getLocalName();
}
}
//short for variant if possible
String shortVariant = getViolatesVariant();
if (getViolatesVariant().lastIndexOf('/') != -1) {
shortVariant =getViolatesVariant().substring(getViolatesVariant().lastIndexOf('/') + 1);
}
return id + "\n" + getReason() +
|
File |
Line |
com/ontotext/wsmo4j/parser/owl/WSMLFromOWL.java |
906
|
com/ontotext/wsmo4j/parser/owl/WSMLFromOWL.java |
943
|
IRI asId = _factory.createIRI(uriStr + (++axiom_counter));
Axiom ax = _factory.createAxiom(asId);
theOntology.addAxiom(ax);
ax.addNFPValue(_factory.createIRI(Constants.DC_relation), id);
String foo = (String)allRestrictions.get(element);
do {
int pos = foo.indexOf("|class|");
if (pos < 0)
break;
foo = foo.substring(0, pos)+ xForm(uriStr)+foo.substring(pos + "|class|".length());
} while (true);
|
File |
Line |
org/deri/wsmo4j/logicalexpression/util/OntologyUtil.java |
102
|
org/deri/wsmo4j/logicalexpression/util/OntologyUtil.java |
137
|
checkLogicalExpressions(c.getOntology());
if (!attributeMap.isEmpty()) {
Set entrySet = attributeMap.entrySet();
Iterator itSet = entrySet.iterator();
while (itSet.hasNext()) {
Entry entry = (Entry) itSet.next();
Term conId = (Term) entry.getKey();
Term attId = (Term) entry.getValue();
if (conId.equals(c)) {
if (!attributeList.contains(attId)) {
attributeList.add(attId);
}
}
}
}
return attributeList;
}
/**
* Collecting all instances from a given ontology.
*
* @param o Ontology to be checked for contained instances
* @return List of terms, identifying all instances from the ontology
* @throws InvalidModelException
* @throws SynchronisationException
*/
public static List getInstances(Ontology o)
|
File |
Line |
org/deri/wsmo4j/factory/DataFactoryImpl.java |
296
|
org/deri/wsmo4j/factory/DataFactoryImpl.java |
307
|
return new SimpleDataValue[] {
createWsmlInteger(new BigInteger("" + cal.get(Calendar.YEAR))),
createWsmlInteger(new BigInteger("" + (cal.get(Calendar.MONTH) + 1))),
createWsmlInteger(new BigInteger("" + cal.get(Calendar.DAY_OF_MONTH))),
createWsmlInteger(new BigInteger("" + cal.get(Calendar.HOUR_OF_DAY))),
createWsmlInteger(new BigInteger("" + cal.get(Calendar.MINUTE))),
createWsmlDecimal(new BigDecimal(seconds))};
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
1108
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
1398
|
List <Term> l = itMol.next();
if (l.get(0).equals(v1)) {
v = (Variable) l.get(1);
list.add(v);
}
else if (l.get(1).equals(v1)) {
v = (Variable) l.get(0);
list.add(v);
}
}
listMap.put(v1, list);
}
}
/*
* Checks if variable v1 is connected to variable v2.
*/
private boolean checkGraphConnected(Variable v1, Variable v2) {
boolean found = false;
boolean used = false;
List <Term> l = listMap.get(v1);
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreValidator.java |
94
|
org/deri/wsmo4j/validator/WsmlRuleValidator.java |
68
|
le.accept(ruleExprVal);
}
}
/**
* Checks if a concept is valid to wsml-rule.
*
* @see org.deri.wsmo4j.validator.WsmlFullValidator#visitConcept(org.omwg.ontology.Concept)
*/
protected void visitConcept(Concept concept) {
super.visitConcept(concept);
}
/**
* Checks if an instance is valid to wsml-rule.
*
* @see org.deri.wsmo4j.validator.WsmlFullValidator#visitInstance(org.omwg.ontology.Instance)
*/
protected void visitInstance(Instance instance) {
super.visitInstance(instance);
}
/**
* Checks if a relation is valid to wsml-rule.
*
* @see org.deri.wsmo4j.validator.WsmlFullValidator#visitRelation(org.omwg.ontology.Relation)
*/
protected void visitRelation(Relation relation) {
super.visitRelation(relation);
}
/**
* Checks if a relation instance is valid to wsml-rule.
*
* @throws InvalidModelException
* @throws SynchronisationException
* @see org.deri.wsmo4j.validator.WsmlFullValidator#visitRelationInstance(org.omwg.ontology.RelationInstance)
*/
protected void visitRelationInstance(RelationInstance relationInstance)
throws SynchronisationException, InvalidModelException {
super.visitRelationInstance(relationInstance);
}
public boolean isValid(LogicalExpression logExpr, List <ValidationError> errorMessages, List <ValidationWarning> warningMessages) {
super.isValid(logExpr, errorMessages, warningMessages);
errors = errorMessages;
warnings = warningMessages;
|
File |
Line |
org/deri/wsmo4j/io/serializer/rdf/NodeValue.java |
96
|
org/deri/wsmo4j/io/serializer/rdf/NodeValue.java |
112
|
ensure00(val.getArgumentValue((byte)1).getValue().toString()) + ":" +
ensure00(val.getArgumentValue((byte)2).getValue().toString());
switch(val.getArity()) {
case 4:
return ret + ensure00(serializeTimezone(
val.getArgumentValue((byte)3).getValue(),null));
case 5:
return ret + ensure00(serializeTimezone(
val.getArgumentValue((byte)3).getValue(),
val.getArgumentValue((byte)4).getValue()));
}
return ret;
}
private static String serializeDateTime(ComplexDataValue val) {
|
File |
Line |
org/deri/wsmo4j/validator/WsmlCoreExpressionValidator.java |
1071
|
org/deri/wsmo4j/validator/WsmlDLExpressionValidator.java |
1359
|
connected.clear();
valid = checkGraphConnected(v1, v);
if (!valid) {
addError(expr, ValidationError.AX_GRAPH_ERR + ":\nGraph is " +
"not connected:\n" + leSerializer.serialize(expr));
return false;
}
}
// check if the given graph is acyclic
List <Variable> checkList = new Vector <Variable> ();
checkList.add(v1);
valid = checkGraphAcyclic(v1, v1, checkList);
if (valid) {
return true;
}
else {
addError(expr, ValidationError.AX_GRAPH_ERR + ":\nGraph contains " +
"cycle:\n" + leSerializer.serialize(expr));
return false;
}
}
|
File |
Line |
org/deri/wsmo4j/io/parser/rdf/RDFExprParser.java |
974
|
org/deri/wsmo4j/io/parser/rdf/RDFExprParser.java |
1068
|
throws SynchronisationException, InvalidModelException {
IRI iri = null;
// check for spaces in names
if (name.indexOf(" ") != -1) {
name = name.replaceAll(" ", "%20");
addWarning("No spaces allowed in identifiers! - Spaces in " +
"one or more instances identifiers " +
"have been replaced by '%20'!", statement);
}
// check for anonymous ids
try {
iri = factory.createIRI(name);
} catch (IllegalArgumentException e) {
if(name.startsWith("node")) {
iri = factory.createIRI("blank:" + name);
} else {
addWarning("Anonymous identifiers problem - One or more " +
"anonymous instances have not been added to " +
"the WSMO object model!", statement);
return null;
}
}
if (ontology.findInstance(iri) == null) {
|
File |
Line |
com/ontotext/wsmo4j/parser/wsml/ParserImpl.java |
50
|
org/deri/wsmo4j/io/parser/rdf/RDFParserImpl.java |
125
|
public RDFParserImpl(Map map) {
Object o = map.get(Factory.WSMO_FACTORY);
if (o == null || !(o instanceof WsmoFactory)) {
o = Factory.createWsmoFactory(new HashMap <String, Object> ());
}
factory = (WsmoFactory) o;
assert (factory != null);
o = map.get(Factory.LE_FACTORY);
if (o == null || !(o instanceof LogicalExpressionFactory)) {
o = Factory.createLogicalExpressionFactory(new HashMap <String, Object> ());
}
|