|
From: <tom...@us...> - 2008-03-16 17:44:52
|
Revision: 1155
http://jason.svn.sourceforge.net/jason/?rev=1155&view=rev
Author: tomklapiscak
Date: 2008-03-16 10:44:47 -0700 (Sun, 16 Mar 2008)
Log Message:
-----------
Run-time class definition implemented. Switched to use the OWL-API Manchester OWL Syntax parser as opposed to Clexer. Additionally, class-definitions now include namespace prefixes for entities and can span any entity from any ontology known to the agent.
Dropped "origin" annotation -> run-time defined classes are distinguished inherently now since they "reside" in an agent's "personal" ontology. Individuals defined at run-time also reside in this ontology.
Further work on semantically-enriched knowledge sharing. Switched to using OWL-API Manchester OWL Syntax renderer for generation of class expressions to be shared.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralFactory.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl
trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/OntologyURIManager.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/PhysicalURIManager.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-16 17:44:47 UTC (rev 1155)
@@ -33,11 +33,14 @@
travel_agent
travel_agent.asl
[
- jasdl_ontologies="travel",
+ jasdl_ontologies="travel,places",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
- jasdl_travel_mapping_manual="small_beach=beach"
+ jasdl_travel_mapping_manual="small_beach=beach",
+ jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
+ jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
+
//,jasdl_aktors_uri="http://www.aktors.org/ontology/portal.owl",
//jasdl_aktors_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
]
@@ -50,8 +53,8 @@
customer.asl
[
jasdl_ontologies="holidays",
+ //jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- //jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel" // arbitrary primitive mappings handled correctly
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-16 17:44:47 UTC (rev 1155)
@@ -21,12 +21,12 @@
+luxuriousHotel(L)[o(holidays), source(Source)]
<-
/* 1 */ .print("The ", L, " luxurious hotel is available");
- /* 2 */ jasdl.ia.define_class(query, "city and hasAccommodation value ", L, holidays);
+ /* 2 */ jasdl.ia.define_class(query, "city and hasAccommodation value ", L);
/* 3 */ .send(Source, askOne, query(City)[o(holidays)], query(City)[o(holidays)]);
/* 4 */ .print(L, " is located in the city ", City);
// check given hotel is located in a destination that has some museums
- jasdl.ia.define_class(q2, "{",L,"} and isLocatedAt some (hasActivity some museums)", holidays);
+ jasdl.ia.define_class(q2, "{",L,"} and isLocatedAt some (hasActivity some museums)");
.send(Source, askOne, q2(Hotel)[o(holidays)], q2(Hotel)[o(holidays)]);
.print(Hotel, " is located in a city with some museums");
Added: trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl 2008-03-16 17:44:47 UTC (rev 1155)
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+ <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+ <!ENTITY owl11 "http://www.w3.org/2006/12/owl11#" >
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY owl11xml "http://www.w3.org/2006/12/owl11-xml#" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+ <!ENTITY places "http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl#" >
+]>
+
+
+<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl#"
+ xml:base="http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl"
+ xmlns:places="http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl#"
+ xmlns:owl11="http://www.w3.org/2006/12/owl11#"
+ xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#">
+ <owl:Ontology rdf:about=""/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Classes
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl#Building -->
+
+ <owl:Class rdf:about="#Building">
+ <rdfs:subClassOf rdf:resource="#Place"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/ontologies/places.owl#Place -->
+
+ <owl:Class rdf:about="#Place">
+ <rdfs:subClassOf rdf:resource="&owl;Thing"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.w3.org/2002/07/owl#Thing -->
+
+ <owl:Class rdf:about="&owl;Thing"/>
+</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-03-16 17:44:47 UTC (rev 1155)
@@ -323,9 +323,6 @@
<rdfs:subClassOf rdf:resource="#Destination"/>
</owl:Class>
- <owl:Class rdf:about="#beach">
- <rdfs:subClassOf rdf:resource="#Destination"/>
- </owl:Class>
<!-- http://www.owl-ontologies.com/travel.owl#BedAndBreakfast -->
@@ -677,6 +674,14 @@
+ <!-- http://www.owl-ontologies.com/travel.owl#beach -->
+
+ <owl:Class rdf:about="#beach">
+ <rdfs:subClassOf rdf:resource="#Destination"/>
+ </owl:Class>
+
+
+
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
@@ -709,9 +714,9 @@
<!-- http://www.owl-ontologies.com/travel.owl#TwoStarRating -->
<AccommodationRating rdf:about="#TwoStarRating"/>
+
-
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-16 17:44:47 UTC (rev 1155)
@@ -45,6 +45,15 @@
+hasActivity(london, scienceMuseum)[o(travel)];
+hotel(travel_lodge)[o(travel)];
+ +building(hilton)[o(places)];
+
+ ?place(Place)[o(places)];
+ .print(Place);
+
+ jasdl.ia.define_class(q2, "(places:place and places:building) and travel:hotel");
+ ?q2(X)[o(self)];
+ .print(X);
+
.print("Completed: Updating Belief Base 1").
@@ -121,11 +130,11 @@
+hasActivity(butlins, butlins_yoga)[o(travel)];
+hasActivity(butlins, butlins_sunbathing)[o(travel)];
//jasdl.ia.all_different([butlins_yoga, butlins_sunbathing], travel); - DEPRECATED (see below)
- +all_different([butlins_yoga, butlins_sunbathing])[o(travel), something]; // all_different now represented as an se-literal. We can now query, inspect and send these assertions
+ +all_different([butlins_yoga, butlins_sunbathing])[o(self), something]; // all_different now represented as an se-literal. We can now query, inspect and send these assertions
// Query below will not succeed unless butlins_yoga and butlins_sunbathing are different individuals since family destination requires min 2 *different* activities.
// Note: OWL doesn't make UNA and since these individuals do not belong to disjoint classes, therefore they must be explicitly asserted as different.
?familyDestination(butlins)[o(travel)];
- ?all_different([butlins_yoga, butlins_sunbathing, hilton])[o(travel)];
+ ?all_different([butlins_yoga, butlins_sunbathing, hilton])[o(self)];
/* ?all_different([hilton, fourSeasons])[o(travel)]; */ // Will fail, since hilton and fourSeasons cannot be established as distinct
.print("Completed: all_different assertion").
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -19,6 +19,8 @@
*/
package jasdl.architecture;
+import static jasdl.architecture.JasdlAgArch.NAMED_ANNOTATION_FUNCTOR;
+import static jasdl.architecture.JasdlAgArch.ANON_ANNOTATION_FUNCTOR;
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.util.JasdlException;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -36,6 +36,8 @@
public class JasdlAgArch extends AgArch {
+ public static String NAMED_ANNOTATION_FUNCTOR = "named";
+ public static String ANON_ANNOTATION_FUNCTOR = "anon";
IncomingPropContProcessingStrategy incomingStrategy = new IncomingPropContProcessingStrategy();
OutgoingPropContProcessingStrategy outgoingStrategy = new OutgoingPropContProcessingStrategy();
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -19,14 +19,27 @@
*/
package jasdl.architecture;
+import static jasdl.architecture.JasdlAgArch.ANON_ANNOTATION_FUNCTOR;
+import static jasdl.architecture.JasdlAgArch.NAMED_ANNOTATION_FUNCTOR;
import jasdl.asSemantics.JasdlAgent;
+import jasdl.bridge.alias.Alias;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.util.JasdlException;
import jasdl.util.NotEnrichedException;
+import jason.asSyntax.ListTerm;
+import jason.asSyntax.ListTermImpl;
import jason.asSyntax.Literal;
+import jason.asSyntax.StringTerm;
import jason.asSyntax.StringTermImpl;
import jason.asSyntax.Structure;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.semanticweb.owl.model.OWLOntology;
+
public class OutgoingPropContProcessingStrategy implements PropContProcessingStrategy {
@@ -40,13 +53,52 @@
*/
public Literal process(Literal l, JasdlAgent agent) throws JasdlException {
try{
- SELiteral sl = new SELiteral(l, agent); // note, l might not (yet) be a valid se-literal (mappings may be performed below) so factory cannot be used
- sl.qualifyOntologyAnnotation();
+ SELiteral sl = new SELiteral(l, agent);
- Structure expr = new Structure("expr");
- expr.addTerm(new StringTermImpl( agent.getManchesterObjectRenderer().render(sl.toOWLObject()) ));
- sl.addAnnot(expr);
+ StringTerm expression = new StringTermImpl( agent.getManchesterObjectRenderer().render(sl.toOWLObject()));
+
+ Alias alias = sl.toAlias();
+ if(alias.getLabel().equals(agent.getPersonalOntologyLabel())){ // do we have an anonymous run-time defined class?
+
+ Structure anon = new Structure(ANON_ANNOTATION_FUNCTOR);
+ anon.addTerm(expression);
+
+ // add set of prerequisite ontologies
+ Set<OWLOntology> prereqs = new HashSet<OWLOntology>();
+ String[] tokens = expression.toString().split(" ");
+ for(String token : tokens){
+ try {
+ URI entityURI = new URI(token);
+ URI ontologyURI = new URI(entityURI.getScheme(), entityURI.getSchemeSpecificPart(), null);
+ prereqs.add(agent.getLogicalURIManager().getLeft(ontologyURI));
+ } catch (URISyntaxException e) {
+ // do nothing, probably a keyword
+ }
+ }
+ ListTerm list = new ListTermImpl();
+ for(OWLOntology prereq : prereqs){
+ list.add(agent.getLabelManager().getLeft(prereq));
+ }
+ anon.addTerm(list);
+
+ l.addAnnot(anon);
+
+ // drop o, not needed
+ sl.dropOntologyAnnotation();
+
+ }else{
+ // qualify o
+ sl.qualifyOntologyAnnotation();
+
+ // unambiguously refer to named entity
+ Structure named = new Structure(NAMED_ANNOTATION_FUNCTOR);
+ named.addTerm(expression);
+ sl.addAnnot(named);
+ }
+
+
+
return sl;
}catch(NotEnrichedException e){
// do nothing
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -4,11 +4,14 @@
import jasdl.bb.JasdlBeliefBase;
import jasdl.bridge.ToAxiomConverter;
import jasdl.bridge.ToSELiteralConverter;
+import jasdl.bridge.alias.Alias;
+import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.alias.AliasManager;
import jasdl.bridge.label.LabelManager;
-import jasdl.bridge.label.PhysicalURIManager;
+import jasdl.bridge.label.OntologyURIManager;
import jasdl.bridge.seliteral.SELiteralFactory;
import jasdl.util.JasdlException;
+import jasdl.util.UnknownMappingException;
import jason.JasonException;
import jason.architecture.AgArch;
import jason.asSemantics.TransitionSystem;
@@ -17,19 +20,32 @@
import jason.runtime.Settings;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Set;
import jmca.asSemantics.JmcaAgent;
+import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxDescriptionParser;
import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
+import org.semanticweb.owl.expression.OWLEntityChecker;
+import org.semanticweb.owl.model.OWLClass;
+import org.semanticweb.owl.model.OWLDataProperty;
+import org.semanticweb.owl.model.OWLDataType;
+import org.semanticweb.owl.model.OWLDescription;
+import org.semanticweb.owl.model.OWLEntity;
+import org.semanticweb.owl.model.OWLIndividual;
+import org.semanticweb.owl.model.OWLObject;
+import org.semanticweb.owl.model.OWLObjectProperty;
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLOntologyManager;
+import org.semanticweb.owl.model.OWLRuntimeException;
+import org.semanticweb.owl.util.ShortFormProvider;
+import uk.ac.manchester.cs.owl.OWLClassImpl;
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
-import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxObjectRenderer;
public class JasdlAgent extends JmcaAgent {
private OWLOntologyManager ontologyManager;
@@ -39,23 +55,38 @@
private SELiteralFactory seLiteralFactory;
private ToSELiteralConverter toSELiteralConverter;
private ToAxiomConverter toAxiomConverter;
- private PhysicalURIManager physicalURIManager;
+ private OntologyURIManager logicalURIManager;
+ private OntologyURIManager physicalURIManager;
private ManchesterOWLSyntaxOWLObjectRendererImpl manchesterObjectRenderer;
+ private ManchesterOWLSyntaxDescriptionParser manchesterDescriptionParser;
+
+
public JasdlAgent(){
super();
// instantiate managers
aliasManager = new AliasManager();
labelManager = new LabelManager();
ontologyManager = OWLManager.createOWLOntologyManager();
- physicalURIManager = new PhysicalURIManager();
+ physicalURIManager = new OntologyURIManager();
+ logicalURIManager = new OntologyURIManager();
+
seLiteralFactory = new SELiteralFactory(this);
toAxiomConverter = new ToAxiomConverter(this);
toSELiteralConverter = new ToSELiteralConverter(this);
manchesterObjectRenderer = new ManchesterOWLSyntaxOWLObjectRendererImpl();
+ manchesterObjectRenderer.setShortFormProvider(new ShortFormProvider(){
+ public void dispose() {
+ }
+ public String getShortForm(OWLEntity entity) {
+ return entity.getURI().toString();
+ }
+ }); // we want fully qualified entity references
+ manchesterDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixEntityChecker(this));
+
// instantiate (Pellet) reasoner
PelletOptions.USE_TRACING = true;
reasoner = new Reasoner(ontologyManager);
@@ -78,7 +109,7 @@
// load .mas2j JASDL configuration
JasdlConfigurator config = new JasdlConfigurator(this);
- config.configure(stts);
+ config.configure(stts);
return super.initAg(arch, bb, src, stts);
}
@@ -97,13 +128,54 @@
reasoner.classify();
labelManager.put(label, ontology);
physicalURIManager.put(ontology, uri);
+ logicalURIManager.put(ontology, ontology.getURI());
}catch(OWLOntologyCreationException e){
throw new JasdlException("Error loading ontology "+uri+". Reason: "+e);
}
}
+
+
+ public void createOntology(Atom label, URI uri) throws JasdlException{
+ try{
+ OWLOntology ontology = getOntologyManager().createOntology( uri );
+ getLabelManager().put(label, ontology);
+ getPhysicalURIManager().put(ontology, uri);
+ getLogicalURIManager().put(ontology, uri);
+ getReasoner().loadOntology(ontology);
+ } catch (OWLOntologyCreationException e) {
+ throw new JasdlException("Error instantiating OWL ontology. Reason: "+e);
+ }
+ }
+
+ public Atom getPersonalOntologyLabel(){
+ return new Atom("self");
+ }
+
+ public URI getPersonalOntologyURI() {
+ return URI.create("http://www.dur.ac.uk/t.g.klapiscak/"+getPersonalOntologyLabel()+".owl");
+ }
+
+
+
+ public OWLDescription defineClass(Atom functor, String expression) throws JasdlException{
+ OWLDescription desc;
+ try{
+ desc = getManchesterDescriptionParser().parse(expression);
+ }catch(Exception e){
+ e.printStackTrace();
+ throw new JasdlException("Could not parse expression "+expression+". Reason: "+e);
+ }
+
+ Alias alias = AliasFactory.INSTANCE.create(functor, getPersonalOntologyLabel());
+ getAliasManager().put(alias, desc);
+
+ return desc;
+ }
+
+
public AliasManager getAliasManager() {
return aliasManager;
}
@@ -124,12 +196,19 @@
- public PhysicalURIManager getPhysicalURIManager() {
+ public OntologyURIManager getPhysicalURIManager() {
return physicalURIManager;
}
+
+
+ public OntologyURIManager getLogicalURIManager() {
+ return logicalURIManager;
+ }
+
+
public Reasoner getReasoner() {
return reasoner;
}
@@ -164,11 +243,135 @@
public ManchesterOWLSyntaxOWLObjectRendererImpl getManchesterObjectRenderer() {
return manchesterObjectRenderer;
}
+
+
+
+ public ManchesterOWLSyntaxDescriptionParser getManchesterDescriptionParser() {
+ return manchesterDescriptionParser;
+ }
+ /**
+ * Convenience method to (polymorphically) create an entity from resource URI (if known).
+ * TODO: where should this sit?
+ * @param uri URI of resource to create entity from
+ * @return entity identified by URI
+ * @throws UnknownReferenceException if OWLObject not known
+ */
+ public OWLEntity toEntity(URI uri) throws JasdlException{
+ URI ontURI;
+ try {
+ ontURI = new URI(uri.getScheme(), uri.getSchemeSpecificPart(), null);
+ } catch (URISyntaxException e) {
+ throw new JasdlException("Invalid entity URI "+uri);
+ }
+ OWLOntology ontology = getLogicalURIManager().getLeft(ontURI);;
+
+ // clumsy approach, but I can't find any way of achieving this polymorphically (i.e. retrieve an OWLObject from a URI) using OWL-API
+ OWLEntity entity;
+ if(ontology.containsClassReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLClass(uri);
+ }else if (ontology.containsObjectPropertyReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLObjectProperty(uri);
+ }else if (ontology.containsDataPropertyReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLDataProperty(uri);
+ }else if (ontology.containsIndividualReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLIndividual(uri);
+ }else{
+ throw new UnknownMappingException("Unknown ontology resource URI: "+uri);
+ }
+ return entity;
+ }
+
+
+
+ private class NSPrefixEntityChecker implements OWLEntityChecker{
+
+ private JasdlAgent agent;
+ public NSPrefixEntityChecker(JasdlAgent agent){
+ this.agent = agent;
+ }
+ public OWLClass getOWLClass(String name) {
+ OWLEntity entity = convert(name);
+ if(entity == null){
+ return null;
+ }
+ if(entity.isOWLClass()){
+ return entity.asOWLClass();
+ }else{
+ return null;
+ }
+ }
+ public OWLDataProperty getOWLDataProperty(String name) {
+ OWLEntity entity = convert(name);
+ if(entity == null){
+ return null;
+ }
+ if(entity.isOWLDataProperty()){
+ return entity.asOWLDataProperty();
+ }else{
+ return null;
+ }
+ }
+ public OWLDataType getOWLDataType(String name) {
+ OWLEntity entity = convert(name);
+ if(entity == null){
+ return null;
+ }
+ if(entity.isOWLDataType()){
+ return entity.asOWLDataType();
+ }else{
+ return null;
+ }
+ }
+
+ public OWLIndividual getOWLIndividual(String name) {
+ OWLEntity entity = convert(name);
+ if(entity == null){
+ return null;
+ }
+ if(entity.isOWLIndividual()){
+ return entity.asOWLIndividual();
+ }else{
+ return null;
+ }
+ }
+
+ public OWLObjectProperty getOWLObjectProperty(String name) {
+ OWLEntity entity = convert(name);
+ if(entity == null){
+ return null;
+ }
+ if(entity.isOWLObjectProperty()){
+ return entity.asOWLObjectProperty();
+ }else{
+ return null;
+ }
+ }
+
+ private OWLEntity convert(String name){
+ String[] tokens = name.split(":");
+ try {
+ Atom functor = new Atom(tokens[1]);
+ Atom label = new Atom(tokens[0]);
+ Alias alias = AliasFactory.INSTANCE.create(functor, label);
+ return (OWLEntity)agent.getAliasManager().getRight(alias); // guaranteed to be an entity? Not for anonymous classes!
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ }
+
+
+
+
+
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -14,6 +14,7 @@
import java.lang.reflect.Constructor;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.List;
import java.util.Set;
import java.util.Vector;
@@ -76,7 +77,7 @@
if(split.length == 2){
Alias alias = AliasFactory.INSTANCE.create(new Atom(split[0].trim()), label);
URI uri = URI.create(ontology.getURI() + "#" + split[1].trim());
- OWLEntity entity = toEntity(ontology, uri);
+ OWLEntity entity = agent.toEntity(uri);
agent.getAliasManager().put(alias, entity);
}
}
@@ -147,18 +148,11 @@
*/
private void applyMiscMappings() throws JasdlException{
-
// create a "placeholder" ontology so we can safely map thing and nothing without actually loading the ontology
- try {
- URI uri = URI.create("http://www.w3.org/2002/07/owl");
- OWLOntology ontology = agent.getOntologyManager().createOntology( uri );
- agent.getLabelManager().put(AliasFactory.OWL_THING.getLabel(), ontology);
- agent.getPhysicalURIManager().put(ontology, uri);
- agent.getReasoner().loadOntology(ontology);
+ agent.createOntology(AliasFactory.OWL_THING.getLabel(), URI.create("http://www.w3.org/2002/07/owl"));
- } catch (OWLOntologyCreationException e) {
- throw new JasdlException("Error instantiating blank OWL ontology placeholder. Reason: "+e);
- }
+ // create a personal ontology for (axioms that reference) run-time defined class
+ agent.createOntology(agent.getPersonalOntologyLabel(), agent.getPersonalOntologyURI());
agent.getAliasManager().put( AliasFactory.OWL_THING, agent.getOntologyManager().getOWLDataFactory().getOWLThing());
agent.getAliasManager().put( AliasFactory.OWL_NOTHING, agent.getOntologyManager().getOWLDataFactory().getOWLNothing());
@@ -217,38 +211,5 @@
- /**
- * Convenience method to (polymorphically) create an entity from resource URI (if known).
- * TODO: where should this sit?
- * @param uri URI of resource to create entity from
- * @return entity identified by URI
- * @throws UnknownReferenceException if OWLObject not known
- */
- private OWLEntity toEntity(OWLOntology ontology, URI uri) throws UnknownMappingException{
- // clumsy approach, but I can't find any way of achieving this polymorphically (i.e. retrieve an OWLObject from a URI) using OWL-API
- OWLEntity entity;
-
- /*
- // TODO: make from uri only version once OWLOntologyManager#getOntology(URI) is fixed
- URI ns = URI.create(uri.getScheme() + uri.getSchemeSpecificPart());
- OWLOntology ontology;
- try {
- ontology = ontologyManager.getOntology(ns);
- } catch (UnknownOWLOntologyException e) {
- throw new UnknownMappingException("Unknown ontology URI "+ns);
- }
- */
- if(ontology.containsClassReference(uri)){
- entity = agent.getOntologyManager().getOWLDataFactory().getOWLClass(uri);
- }else if (ontology.containsObjectPropertyReference(uri)){
- entity = agent.getOntologyManager().getOWLDataFactory().getOWLObjectProperty(uri);
- }else if (ontology.containsDataPropertyReference(uri)){
- entity = agent.getOntologyManager().getOWLDataFactory().getOWLDataProperty(uri);
- }else if (ontology.containsIndividualReference(uri)){
- entity = agent.getOntologyManager().getOWLDataFactory().getOWLIndividual(uri);
- }else{
- throw new UnknownMappingException("Unknown ontology resource URI: "+uri);
- }
- return entity;
- }
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java 2008-03-16 16:43:27 UTC (rev 1154)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java 2008-03-16 17:44:47 UTC (rev 1155)
@@ -35,6 +35,7 @@
* @throws DuplicateMappingException if either alias or entity is already mapped (thus breaking 1 <-> 1 constraint)
*/
public void put(X x, Y y) throws DuplicateMappingException{
+ logger.fine("mapping "+x+" <-> "+y);
if(isKnownLeft(x)){
throw new DuplicateMappingException("Duplicate mapping on "+x);
@@ -72,7 +73,7 @@
public Y getRight(X x) throws UnknownMappingException{
Y y = xToYMap.get(x);
if(y == null){
- throw new UnknownMappingException("Unknown mapping "+y);
+ throw new UnknownMappingException("Unknown mapping "+x);
}
return y;
}
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/OntologyURIManager.java (from rev 1147, trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/PhysicalURIManager.java)
================...
[truncated message content] |
|
From: <tom...@us...> - 2008-03-17 19:13:39
|
Revision: 1157
http://jason.svn.sourceforge.net/jason/?rev=1157&view=rev
Author: tomklapiscak
Date: 2008-03-17 12:13:28 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
New and improved semantically-enriched knowledge sharing protocol implemented and working.
Improvements to mapping system.
Architectural improvements (SELiteral class now follows "decorator" design pattern).
Various bug-fixes.
travel_agent example updated
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/URIEntityChecker.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-17 19:13:28 UTC (rev 1157)
@@ -32,10 +32,16 @@
agents:
travel_agent
travel_agent.asl
- [
- jasdl_ontologies="travel,places",
+ [
+ jasdl_agent_name = "travelagent",
+ // implication, "default" is a reserved ontology name
+ // also, "self"
+ jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
+ //TODO: what about when automapping causes a conflict?! anonymous aliasing?
+
+ jasdl_ontologies="travel",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
+ //jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
jasdl_travel_mapping_manual="small_beach=beach",
jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
@@ -51,13 +57,18 @@
customer
customer.asl
- [
- jasdl_ontologies="holidays",
+ [
+ jasdl_agent_name = "customer",
+
+ jasdl_ontologies="holidays,places",
//jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
- jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel" // arbitrary primitive mappings handled correctly
+ jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // arbitrary primitive mappings handled correctly
+ jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
+ jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
+
/* Example per-agent proxy settings used for ontology instantiation */
//jasdl_http_proxy="127.0.0.1:3128"
//jasdl_https_proxy="127.0.0.1:8080"
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-17 19:13:28 UTC (rev 1157)
@@ -18,27 +18,37 @@
*
*/
+//+luxuriousHotel(L)[o(holidays), source(Source)]
+luxuriousHotel(L)[o(holidays), source(Source)]
<-
- /* 1 */ .print("The ", L, " luxurious hotel is available");
- /* 2 */ jasdl.ia.define_class(query, "city and hasAccommodation value ", L);
- /* 3 */ .send(Source, askOne, query(City)[o(holidays)], query(City)[o(holidays)]);
- /* 4 */ .print(L, " is located in the city ", City);
+ ?hotel(L)[o(holidays)];
+ .print("The ", L, " luxurious hotel is available");
+ jasdl.ia.define_class(query, "holidays:city and holidays:hasAccommodation value self:", L);
+ .send(Source, askOne, query(City)[o(self)], query(City)[o(self)]);
+ .print(L, " is located in the city ", City);
+
// check given hotel is located in a destination that has some museums
- jasdl.ia.define_class(q2, "{",L,"} and isLocatedAt some (hasActivity some museums)");
- .send(Source, askOne, q2(Hotel)[o(holidays)], q2(Hotel)[o(holidays)]);
+ jasdl.ia.define_class(q2, "{self:",L,"} and holidays:isLocatedAt some (holidays:hasActivity some holidays:museums)");
+ .send(Source, askOne, q2(Hotel)[o(self)], q2(Hotel)[o(self)]);
.print(Hotel, " is located in a city with some museums");
// bundle([h_1...h_n]) demonstrates how JASDL deals with nested se-content
// in particular, this query bundles together an arbitrary number of queries into a single message
- .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)] ] ), Response);
+ .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)], q2(H4)[o(self)] ] ), Response);
.print("Bundled query response: ", Response);
.send(Source, tell, example_KSAA_complete).
+
+all_different(XS)[o(holidays), source(Source)]
<-
- .print(XS, " are mutually distinct individuals, according to ", Source).
+ .print(XS, " are mutually distinct individuals, according to ", Source);
+ .send(Source, tell, building(travel_lodge)[o(places)]);
+ .wait(1000); // wait to ensure travel_agent has had a chance to add this information to its belief base
+ jasdl.ia.define_class(q3, "(places:place and places:building) and holidays:hotel");
+ .send(Source, askOne, q3(Hotel)[o(self)], q3(Hotel)[o(self)]);
+ .print(Hotel, " is a building and a hotel").
+
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-17 19:13:28 UTC (rev 1157)
@@ -44,16 +44,7 @@
+museums(scienceMuseum)[o(travel)];
+hasActivity(london, scienceMuseum)[o(travel)];
+hotel(travel_lodge)[o(travel)];
-
- +building(hilton)[o(places)];
-
- ?place(Place)[o(places)];
- .print(Place);
-
- jasdl.ia.define_class(q2, "(places:place and places:building) and travel:hotel");
- ?q2(X)[o(self)];
- .print(X);
-
+
.print("Completed: Updating Belief Base 1").
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-03-17 19:13:28 UTC (rev 1157)
@@ -19,29 +19,152 @@
*/
package jasdl.architecture;
+import static jasdl.architecture.JasdlAgArch.ANON_ANNOTATION_FUNCTOR;
import static jasdl.architecture.JasdlAgArch.NAMED_ANNOTATION_FUNCTOR;
-import static jasdl.architecture.JasdlAgArch.ANON_ANNOTATION_FUNCTOR;
+import static jasdl.util.Common.strip;
import jasdl.asSemantics.JasdlAgent;
+import jasdl.bridge.alias.Alias;
+import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.seliteral.SELiteral;
+import jasdl.util.DuplicateMappingException;
import jasdl.util.JasdlException;
import jasdl.util.NotEnrichedException;
+import jason.asSyntax.Atom;
+import jason.asSyntax.ListTerm;
import jason.asSyntax.Literal;
+import jason.asSyntax.StringTerm;
+import jason.asSyntax.Structure;
+import jason.asSyntax.Term;
+import java.net.URI;
+import java.net.URISyntaxException;
+
public class IncomingPropContProcessingStrategy implements PropContProcessingStrategy{
- public Literal process(Literal l, JasdlAgent agent) throws JasdlException{
+ public Literal process(Literal l, JasdlAgent agent, String src) throws JasdlException{
try{
- SELiteral sl = new SELiteral(l, agent); // note, l might not (yet) be a valid se-literal (mappings may be performed below) so factory cannot be used
- // replace physical URI with ontology label if known, else instantiate and assign anonymous label
+ Literal result;
+ agent.getLogger().fine("Processing incoming "+l);
+
+ SELiteral sl = new SELiteral(l, agent);
sl.unqualifyOntologyAnnotation();
+ result = processAllDifferent(sl);
+ if(result!=null) return result;
+ result = processNamed(sl, agent);
+ if(result!=null) return result;
- return sl; // not able to modify literal functors directly
+ result = processAnon(sl, agent);
+ if(result!=null) return result;
+
}catch(NotEnrichedException e){
// do nothing
- return l;
}
+ return l;
+
}
+ private Literal processAllDifferent(SELiteral sl){
+ if(sl.getLiteral().getFunctor().equals(AliasFactory.OWL_ALL_DIFFERENT_FUNCTOR.toString())){
+ return sl.getLiteral();
+ }else{
+ return null;
+ }
+ }
+
+ private Literal processNamed(SELiteral sl, JasdlAgent agent) throws JasdlException{
+ ListTerm nameds = sl.getLiteral().getAnnots(NAMED_ANNOTATION_FUNCTOR);
+ if(nameds.size() == 1){
+ // get named annotation
+ Term _named = nameds.get(0);
+ if(!(_named instanceof Structure)){
+ throw new JasdlException("Invalid "+NAMED_ANNOTATION_FUNCTOR+" annotation: "+_named);
+ }
+ Structure named = (Structure)_named;
+ if(named.getArity() != 1){
+ throw new JasdlException("Invalid "+NAMED_ANNOTATION_FUNCTOR+" annotation arity: "+_named);
+ }
+
+ // get expression
+ Term expressionTerm = named.getTerm(0);
+ if(!(expressionTerm instanceof StringTerm)){
+ throw new JasdlException("Invalid "+NAMED_ANNOTATION_FUNCTOR+" annotation term: "+expressionTerm);
+ }
+ String expression = strip(expressionTerm.toString(), "\""); // quotes stripped
+
+
+ URI uri;
+ try {
+ uri = new URI(expression);
+ } catch (URISyntaxException e) {
+ throw new JasdlException("Invalid entity URI in "+expression);
+ }
+ Alias local = agent.getAliasManager().getLeft(agent.toEntity(uri)); // will already be present by definition
+
+ // create new (SE) Literal
+ sl.mutateFunctor(local.getFunctor().toString());
+
+
+ sl.getLiteral().delAnnot(named); // drop named, no longer needed
+ return sl.getLiteral(); // not able to modify literal functors directly
+ }else{
+ return null;
+ }
+ }
+
+ private Literal processAnon(SELiteral sl, JasdlAgent agent) throws JasdlException{
+ ListTerm anons = sl.getLiteral().getAnnots(ANON_ANNOTATION_FUNCTOR);
+ if(anons.size() == 1){
+ // Get Anon annotation
+ Term _anon = anons.get(0);
+ if(!(_anon instanceof Structure)){
+ throw new JasdlException("Invalid "+ANON_ANNOTATION_FUNCTOR+" annotation: "+_anon);
+ }
+ Structure anon = (Structure)_anon;
+ if(anon.getArity() != 2){
+ throw new JasdlException("Invalid "+ANON_ANNOTATION_FUNCTOR+" annotation arity: "+_anon);
+ }
+
+ // Get expression
+ Term expressionTerm = anon.getTerm(0);
+ if(!(expressionTerm instanceof StringTerm)){
+ throw new JasdlException("Invalid "+ANON_ANNOTATION_FUNCTOR+" annotation expression term: "+expressionTerm);
+ }
+ String expression = strip(expressionTerm.toString(), "\""); // quotes stripped
+
+ // Parse prequisite ontology URIs
+ Term prereqsTerm = anon.getTerm(1);
+ if(!(prereqsTerm instanceof ListTerm)){
+ throw new JasdlException("Invalid "+ANON_ANNOTATION_FUNCTOR+" annotation prereqs term: "+expressionTerm);
+ }
+ ListTerm prereqs = (ListTerm)prereqsTerm;
+ for(Term _prereqTerm : prereqs){
+ if(!(_prereqTerm instanceof StringTerm)){
+ throw new JasdlException("Invalid "+ANON_ANNOTATION_FUNCTOR+" prereq: "+_prereqTerm);
+ }
+ StringTerm prereqTerm = (StringTerm)_prereqTerm;
+ String prereq = strip(prereqTerm.toString(), "\""); // quotes stripped
+ agent.getOntology(prereq);
+ }
+
+ // do we already know this expression?
+ Atom functor = new Atom(sl.getLiteral().getFunctor());
+ try{
+ agent.defineClass(functor, sl.getOntologyLabel(), expression, agent.getManchesterURIDescriptionParser()); // Instantiate defined expression
+ }catch(DuplicateMappingException e){
+ // do nothing
+ }
+
+ // drop anon annotation, no longer needed
+ sl.getLiteral().delAnnot(anon);
+
+ return sl.getLiteral();
+ }else{
+ return null;
+ }
+
+ }
+
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-03-17 19:13:28 UTC (rev 1157)
@@ -30,8 +30,8 @@
import jason.asSyntax.Term;
import jason.asSyntax.VarTerm;
-import java.util.PriorityQueue;
import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Logger;
public class JasdlAgArch extends AgArch {
@@ -48,7 +48,7 @@
super.checkMail();
// temporary set to hold processed message clones
- Queue<Message> tempMail = new PriorityQueue<Message>();
+ Queue<Message> tempMail = new ConcurrentLinkedQueue<Message>();
Queue<Message> mail = getTS().getC().getMailBox();
// mustn't affect original message object, otherwise effects are global (i.e. at infrastructure level)
@@ -67,21 +67,21 @@
mail.addAll(tempMail);
if(!mail.isEmpty()){
- getLogger().info("Pending messages: "+mail);
+ getLogger().fine("Pending messages: "+mail);
}
}
@Override
public void sendMsg(Message msg) throws Exception {
processMessage(msg, outgoingStrategy);
- getLogger().info("Sending message: "+msg);
+ getLogger().fine("Sending message: "+msg);
super.sendMsg(msg);
}
@Override
public void broadcast(Message msg) throws Exception {
processMessage(msg, outgoingStrategy);
- getLogger().finest("Broadcasting message: "+msg);
+ getLogger().fine("Broadcasting message: "+msg);
super.broadcast(msg);
}
@@ -98,28 +98,30 @@
Object propcont = msg.getPropCont();
if(propcont == null){
return;
- }
+ }
if(propcont instanceof Structure){ // only Structures require processing
- propcont = processStructure((Structure)propcont, strategy);
+ msg.setPropCont(processStructure((Structure)propcont, strategy, msg.getSender()));
}
- msg.setPropCont(propcont);
+
}
- private Structure processStructure(Structure struct, PropContProcessingStrategy strategy) throws JasdlException{
+ private Structure processStructure(Structure struct, PropContProcessingStrategy strategy, String src) throws JasdlException{
- // Process outer SE-enriched content
- if(struct instanceof Literal){ // processing strategies only apply to Literals
- Literal l = (Literal)struct;
- try{
- struct = strategy.process(l, getAgent());
- }catch(JasdlException e){
- e.printStackTrace();
- }
- }
+
// recurse down terms and lists (for "bundled" SE-enriched content)
if(struct.getArity()>0){ // if we have any terms to process!
+ // Process outer SE-enriched content
+ if(struct instanceof Literal){ // processing strategies only apply to Literals
+ Literal l = (Literal)struct;
+ try{
+ struct = strategy.process(l, getAgent(), src);
+ }catch(JasdlException e){
+ e.printStackTrace();
+ }
+ }
+
//int i=0;
//for(Term _term : struct.getTerms()){ - mustn't use in case struct is a list
if(struct.isVar()){
@@ -129,7 +131,7 @@
ListTermImpl newList = new ListTermImpl(); // a "clone"
for(Term e : ((ListTerm)struct).getAsList()){
if(e instanceof Structure){
- Structure alteredTerm = (Structure)processStructure((Structure)e, strategy);
+ Structure alteredTerm = (Structure)processStructure((Structure)e, strategy, src);
newList.append(alteredTerm);
}
}
@@ -139,7 +141,7 @@
Term _term = struct.getTerm(i);
if(_term instanceof Structure){
Structure term = (Structure)_term;
- Structure alteredTerm = (Structure)processStructure(term, strategy);
+ Structure alteredTerm = (Structure)processStructure(term, strategy, src);
struct.setTerm(i, alteredTerm); // modifies original struct
}
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-17 19:13:28 UTC (rev 1157)
@@ -24,8 +24,10 @@
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.alias.Alias;
import jasdl.bridge.seliteral.SELiteral;
+import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
import jasdl.util.JasdlException;
import jasdl.util.NotEnrichedException;
+import jasdl.util.UnknownMappingException;
import jason.asSyntax.ListTerm;
import jason.asSyntax.ListTermImpl;
import jason.asSyntax.Literal;
@@ -38,6 +40,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.semanticweb.owl.model.OWLNamedObject;
+import org.semanticweb.owl.model.OWLObject;
import org.semanticweb.owl.model.OWLOntology;
public class OutgoingPropContProcessingStrategy implements PropContProcessingStrategy {
@@ -51,22 +55,39 @@
* @param l
* @throws JasdlException
*/
- public Literal process(Literal l, JasdlAgent agent) throws JasdlException {
+ public Literal process(Literal l, JasdlAgent agent, String src) throws JasdlException {
+ agent.getLogger().fine("Processing outgoing "+l);
+
+ Literal result = l;
try{
- SELiteral sl = new SELiteral(l, agent);
+ SELiteral sl = agent.getSELiteralFactory().create(l);
+
+ // qualify o
+ sl.qualifyOntologyAnnotation();
- StringTerm expression = new StringTermImpl( agent.getManchesterObjectRenderer().render(sl.toOWLObject()));
+ OWLObject obj = sl.toOWLObject();
+ String expression = agent.getManchesterObjectRenderer().render(obj);
+ StringTerm expressionTerm = new StringTermImpl(expression);
+ Alias alias = sl.toAlias();
-
- Alias alias = sl.toAlias();
- if(alias.getLabel().equals(agent.getPersonalOntologyLabel())){ // do we have an anonymous run-time defined class?
+ if(obj instanceof OWLNamedObject){
+ // unambiguously refer to named entity
+ if(!(sl instanceof SELiteralAllDifferentAssertion)){// not required if all_different
+ Structure named = new Structure(NAMED_ANNOTATION_FUNCTOR);
+ named.addTerm(expressionTerm);
+ sl.getLiteral().addAnnot(named);
+ }
+
+ }else{ // we have an anonymous run-time defined class
+
+ // construct anon annotation
Structure anon = new Structure(ANON_ANNOTATION_FUNCTOR);
- anon.addTerm(expression);
+ anon.addTerm(expressionTerm);
// add set of prerequisite ontologies
Set<OWLOntology> prereqs = new HashSet<OWLOntology>();
- String[] tokens = expression.toString().split(" ");
+ String[] tokens = expression.toString().split("[ |\n]");
for(String token : tokens){
try {
URI entityURI = new URI(token);
@@ -74,36 +95,24 @@
prereqs.add(agent.getLogicalURIManager().getLeft(ontologyURI));
} catch (URISyntaxException e) {
// do nothing, probably a keyword
+ } catch(UnknownMappingException e){
+ // do nothing, probably a keyword
}
}
ListTerm list = new ListTermImpl();
for(OWLOntology prereq : prereqs){
- list.add(agent.getLabelManager().getLeft(prereq));
+ list.add( new StringTermImpl(agent.getPhysicalURIManager().getRight(prereq).toString()) );
}
anon.addTerm(list);
- l.addAnnot(anon);
-
- // drop o, not needed
- sl.dropOntologyAnnotation();
-
- }else{
- // qualify o
- sl.qualifyOntologyAnnotation();
-
- // unambiguously refer to named entity
- Structure named = new Structure(NAMED_ANNOTATION_FUNCTOR);
- named.addTerm(expression);
- sl.addAnnot(named);
- }
-
-
-
- return sl;
+ sl.getLiteral().addAnnot(anon);
+ }
+ result = sl.getLiteral();
}catch(NotEnrichedException e){
// do nothing
- return l;
}
+ return result;
}
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java 2008-03-17 19:13:28 UTC (rev 1157)
@@ -24,5 +24,5 @@
import jason.asSyntax.Literal;
public interface PropContProcessingStrategy {
- public Literal process(Literal propcont, JasdlAgent agent) throws JasdlException;
+ public Literal process(Literal propcont, JasdlAgent agent, String src) throws JasdlException;
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-17 08:41:44 UTC (rev 1156)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-17 19:13:28 UTC (rev 1157)
@@ -1,5 +1,8 @@
package jasdl.asSemantics;
+import static jasdl.util.Common.strip;
+import jasdl.asSemantics.parsing.NSPrefixEntityChecker;
+import jasdl.asSemantics.parsing.URIEntityChecker;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
import jasdl.bridge.ToAxiomConverter;
@@ -7,9 +10,13 @@
import jasdl.bridge.alias.Alias;
import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.alias.AliasManager;
+import jasdl.bridge.alias.DecapitaliseMappingStrategy;
+import jasdl.bridge.alias.MappingStrategy;
import jasdl.bridge.label.LabelManager;
import jasdl.bridge.label.OntologyURIManager;
import jasdl.bridge.seliteral.SELiteralFactory;
+import jasdl.util.DuplicateMappingException;
+import jasdl.util.InvalidSELiteralException;
import jasdl.util.JasdlException;
import jasdl.util.UnknownMappingException;
import jason.JasonException;
@@ -21,7 +28,10 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.List;
import java.util.Set;
+import java.util.Vector;
import jmca.asSemantics.JmcaAgent;
@@ -29,25 +39,18 @@
import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
-import org.semanticweb.owl.expression.OWLEntityChecker;
-import org.semanticweb.owl.model.OWLClass;
-import org.semanticweb.owl.model.OWLDataProperty;
-import org.semanticweb.owl.model.OWLDataType;
import org.semanticweb.owl.model.OWLDescription;
import org.semanticweb.owl.model.OWLEntity;
-import org.semanticweb.owl.model.OWLIndividual;
-import org.semanticweb.owl.model.OWLObject;
-import org.semanticweb.owl.model.OWLObjectProperty;
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLOntologyManager;
-import org.semanticweb.owl.model.OWLRuntimeException;
import org.semanticweb.owl.util.ShortFormProvider;
-import uk.ac.manchester.cs.owl.OWLClassImpl;
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
public class JasdlAgent extends JmcaAgent {
+ public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMappingStrategy()} );
+
private OWLOntologyManager ontologyManager;
private Reasoner reasoner;
private AliasManager aliasManager;
@@ -58,12 +61,26 @@
private OntologyURIManager logicalURIManager;
private OntologyURIManager physicalURIManager;
private ManchesterOWLSyntaxOWLObjectRendererImpl manchesterObjectRenderer;
- private ManchesterOWLSyntaxDescriptionParser manchesterDescriptionParser;
+ private ManchesterOWLSyntaxDescriptionParser manchesterNsPrefixDescriptionParser;
+ private ManchesterOWLSyntaxDescriptionParser manchesterURIDescriptionParser;
+
+ private List<MappingStrategy> defaultMappingStrategies;
+
+ public static String ANON_LABEL_PREFIX = "anon_label_";
+ public static String ANON_ALIAS_PREFIX = "anon_alias_";
+
+ /**
+ * Since Jason doesn't initialise an agent name in time
+ */
+ private String agentName;
+
public JasdlAgent(){
super();
+ defaultMappingStrategies = DEFAULT_MAPPING_STRATEGIES;
+
// instantiate managers
aliasManager = new AliasManager();
labelManager = new LabelManager();
@@ -84,9 +101,9 @@
}
}); // we want fully qualified entity references
- manchesterDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixEntityChecker(this));
-
-
+ manchesterNsPrefixDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixEntityChecker(this));
+ manchesterURIDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new URIEntityChecker(this));
+
// instantiate (Pellet) reasoner
PelletOptions.USE_TRACING = true;
reasoner = new Reasoner(ontologyManager);
@@ -102,25 +119,112 @@
public TransitionSystem initAg(AgArch arch, BeliefBase bb, String src, Settings stts) throws JasonException {
if(!(bb instanceof JasdlBeliefBase)){
throw new JasdlException("JASDL must be used in combination with the jasdl.bb.OwlBeliefBase class");
- }
-
- ((JasdlBeliefBase)bb).setAgent(this);
-
-
+ }
+ ((JasdlBeliefBase)bb).setAgent(this);
// load .mas2j JASDL configuration
JasdlConfigurator config = new JasdlConfigurator(this);
- config.configure(stts);
+ config.configure(stts);
return super.initAg(arch, bb, src, stts);
}
+
+
+
+ /**
+ * Convenience method to (polymorphically) create an entity from resource URI (if known).
+ * TODO: where should this sit?
+ * @param uri URI of resource to create entity from
+ * @return entity identified by URI
+ * @throws UnknownReferenceException if OWLObject not known
+ */
+ public OWLEntity toEntity(URI uri) throws JasdlException{
+ URI ontURI;
+ try {
+ ontURI = new URI(uri.getScheme(), uri.getSchemeSpecificPart(), null);
+ } catch (URISyntaxException e) {
+ throw new JasdlException("Invalid entity URI "+uri);
+ }
+ OWLOntology ontology = getLogicalURIManager().getLeft(ontURI);
+ // clumsy approach, but I can't find any way of achieving this polymorphically (i.e. retrieve an OWLEntity from a URI) using OWL-API
+ OWLEntity entity;
+ if(ontology.containsClassReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLClass(uri);
+ }else if (ontology.containsObjectPropertyReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLObjectProperty(uri);
+ }else if (ontology.containsDataPropertyReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLDataProperty(uri);
+ }else if (ontology.containsIndividualReference(uri)){
+ entity = getOntologyManager().getOWLDataFactory().getOWLIndividual(uri);
+ }else{
+ throw new UnknownMappingException("Unknown ontology resource URI: "+uri);
+ }
+ return entity;
+ }
+ /**
+ * Convenience method to parse a string into a URI and return the associated ontology.
+ * Ontology is instantiated and assigned a unique anonymous label if unknown.
+ * @param uri
+ * @return
+ * @throws JasdlException
+ */
+ public OWLOntology getOntology(String _uri) throws JasdlException{
+ URI uri;
+ try {
+ uri = new URI( strip(_uri, "\"")); // quotes stripped
+ } catch (URISyntaxException e) {
+ throw new InvalidSELiteralException("Invalid physical ontology URI "+_uri+". Reason: "+e);
+ }
+ return getOntology(uri);
+ }
+
+ /**
+ * Convenience method to return the ontology associated with a URI.
+ * Ontol...
[truncated message content] |
|
From: <tom...@us...> - 2008-03-18 02:06:03
|
Revision: 1160
http://jason.svn.sourceforge.net/jason/?rev=1160&view=rev
Author: tomklapiscak
Date: 2008-03-17 19:05:59 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
Class definitions can now be composed of other run-time defined classes. This was achieved by:
* Adding equivalent named classes for anonymous defined classes (thus inherently allowing parsing to work).
* Mapping such named classes to their original anonymous descriptions.
* Recursively "normalising" outgoing expressions by replacing all references to run-time defined classes with the rendering of their corresponding anonymous description.
travel_agent example updated.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/LabelManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DefinitionManager.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-18 02:05:59 UTC (rev 1160)
@@ -29,13 +29,17 @@
.print(L, " is located in the city ", City);
// check given hotel is located in a destination that has some museums
- jasdl.ia.define_class(q2, "{self:",L,"} and holidays:isLocatedAt some (holidays:hasActivity some holidays:museums)");
- .send(Source, askOne, q2(Hotel)[o(self)], q2(Hotel)[o(self)]);
- .print(Hotel, " is located in a city with some museums");
+ jasdl.ia.define_class(hotelNearMuseums, "holidays:isLocatedAt some (holidays:hasActivity some holidays:museums)");
+ .send(Source, askOne, hotelNearMuseums(HotelNearMuseums)[o(self)], hotelNearMuseums(HotelNearMuseums)[o(self)]);
+ .print(HotelNearMuseums, " is a hotel located in a city with some museums");
+ jasdl.ia.define_class(luxuriousHotelNearMuseums, "self:hotelNearMuseums AND holidays:luxuriousHotel");
+ .send(Source, askOne, luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)], luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)]);
+ .print(LuxuriousHotelNearMuseums, " is a luxurious hotel located in a city with some museums");
+
// bundle([h_1...h_n]) demonstrates how JASDL deals with nested se-content
// in particular, this query bundles together an arbitrary number of queries into a single message
- .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)], q2(H4)[o(self)] ] ), Response);
+ .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)], hotelNearMuseums(H4)[o(self)] ] ), Response);
.print("Bundled query response: ", Response);
.send(Source, tell, example_KSAA_complete).
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -22,7 +22,6 @@
import static jasdl.architecture.JasdlAgArch.ANON_ANNOTATION_FUNCTOR;
import static jasdl.architecture.JasdlAgArch.NAMED_ANNOTATION_FUNCTOR;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.bridge.alias.Alias;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
import jasdl.util.JasdlException;
@@ -40,8 +39,8 @@
import java.util.HashSet;
import java.util.Set;
-import org.semanticweb.owl.model.OWLNamedObject;
-import org.semanticweb.owl.model.OWLObject;
+import org.semanticweb.owl.model.OWLDescription;
+import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLOntology;
public class OutgoingPropContProcessingStrategy implements PropContProcessingStrategy {
@@ -65,22 +64,12 @@
// qualify o
sl.qualifyOntologyAnnotation();
- OWLObject obj = sl.toOWLObject();
- String expression = agent.getManchesterObjectRenderer().render(obj);
- StringTerm expressionTerm = new StringTermImpl(expression);
- Alias alias = sl.toAlias();
+ OWLEntity entity = (OWLEntity)sl.toOWLObject();
+ String expression = normaliseExpression(agent.getManchesterObjectRenderer().render(entity), agent);
+ StringTerm expressionTerm = new StringTermImpl(expression);
- if(obj instanceof OWLNamedObject){
+ if(entity.isOWLClass() && agent.getDefinitionManager().isKnownLeft(entity.asOWLClass())){ // we have an anonymous run-time defined class
- // unambiguously refer to named entity
- if(!(sl instanceof SELiteralAllDifferentAssertion)){// not required if all_different
- Structure named = new Structure(NAMED_ANNOTATION_FUNCTOR);
- named.addTerm(expressionTerm);
- sl.getLiteral().addAnnot(named);
- }
-
- }else{ // we have an anonymous run-time defined class
-
// construct anon annotation
Structure anon = new Structure(ANON_ANNOTATION_FUNCTOR);
anon.addTerm(expressionTerm);
@@ -105,7 +94,17 @@
}
anon.addTerm(list);
- sl.getLiteral().addAnnot(anon);
+ sl.getLiteral().addAnnot(anon);
+
+ }else{
+
+ // unambiguously refer to named entity
+ if(!(sl instanceof SELiteralAllDifferentAssertion)){// not required if all_different
+ Structure named = new Structure(NAMED_ANNOTATION_FUNCTOR);
+ named.addTerm(expressionTerm);
+ sl.getLiteral().addAnnot(named);
+ }
+
}
result = sl.getLiteral();
}catch(NotEnrichedException e){
@@ -114,5 +113,44 @@
return result;
}
+ /**
+ * Returns an expression in which all references to run-time defined classes have been (recursuvely) replaced
+ * with the rendering of their anonymous descriptions, thus ensuring this rendering only refers to predefined classes.
+ * @param expression expression to normalise
+ * @param agent
+ * @return normalised form of expression
+ * @throws JasdlException
+ */
+ private String normaliseExpression(String expression, JasdlAgent agent) throws JasdlException{
+ String[] tokens = expression.toString().split("[ |\n]");
+ String newExpression = "";
+ for(String token : tokens){
+ try {
+ URI entityURI = new URI(token);
+ OWLEntity entity = agent.toEntity(entityURI);
+ if(entity.isOWLClass()){
+ try{
+ OWLDescription desc = agent.getDefinitionManager().getRight(entity.asOWLClass());
+ String rendering = agent.getManchesterObjectRenderer().render(desc);
+ newExpression += "("+normaliseExpression(rendering, agent)+")";
+ }catch(UnknownMappingException e1){
+ // this is a predefined class
+ newExpression += token;
+ }
+ }else{
+ // this is a predefined non-class entity (property, individual, etc)
+ newExpression += token;
+ }
+ }catch(URISyntaxException e){
+ // this is (probably) a keyword
+ newExpression += " " + token + " ";
+ }catch(UnknownMappingException e2){
+ // this is (probably) a keyword
+ newExpression += " " + token + " ";
+ }
+
+ }
+ return newExpression;
+ }
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -11,6 +11,7 @@
import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.alias.AliasManager;
import jasdl.bridge.alias.DecapitaliseMappingStrategy;
+import jasdl.bridge.alias.DefinitionManager;
import jasdl.bridge.alias.MappingStrategy;
import jasdl.bridge.label.LabelManager;
import jasdl.bridge.label.OntologyURIManager;
@@ -29,6 +30,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Vector;
@@ -39,9 +41,12 @@
import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
+import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLDescription;
import org.semanticweb.owl.model.OWLEntity;
+import org.semanticweb.owl.model.OWLEquivalentClassesAxiom;
import org.semanticweb.owl.model.OWLOntology;
+import org.semanticweb.owl.model.OWLOntologyChangeException;
import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLOntologyManager;
import org.semanticweb.owl.util.ShortFormProvider;
@@ -74,6 +79,8 @@
* Since Jason doesn't initialise an agent name in time
*/
private String agentName;
+
+ private DefinitionManager definitionManager;
@@ -87,6 +94,7 @@
ontologyManager = OWLManager.createOWLOntologyManager();
physicalURIManager = new OntologyURIManager();
logicalURIManager = new OntologyURIManager();
+ definitionManager = new DefinitionManager();
seLiteralFactory = new SELiteralFactory(this);
toAxiomConverter = new ToAxiomConverter(this);
@@ -230,15 +238,17 @@
Set<OWLOntology> imports = ontologyManager.getImportsClosure(ontology);
reasoner.loadOntologies(imports);
reasoner.classify();
- labelManager.put(label, ontology);
+ labelManager.put(label, ontology, false); // (successfully) loaded ontologies never personal
physicalURIManager.put(ontology, uri);
logicalURIManager.put(ontology, ontology.getURI());
getLogger().fine("Loaded ontology from "+uri+" and assigned label "+label);
applyMappingStrategies(ontology, strategies);
return ontology;
}catch(OWLOntologyCreationException e){
- getLogger().warning("Placeholder ontology substituted for unreachable "+uri);
- return createOntology(label, uri); // can't load it, just create a blank (for unqualification of ontology annotations for example)
+ getLogger().warning("Placeholder personal ontology substituted for unreachable "+uri);
+ // can't load it, just create a blank (for unqualification of ontology annotations for example)
+ // personal by definition
+ return createOntology(label, uri, true);
}
}
@@ -250,10 +260,10 @@
* @param uri
* @throws JasdlException
*/
- public OWLOntology createOntology(Atom label, URI uri) throws JasdlException{
+ public OWLOntology createOntology(Atom label, URI uri, boolean isPersonal) throws JasdlException{
try{
OWLOntology ontology = getOntologyManager().createOntology( uri );
- getLabelManager().put(label, ontology);
+ getLabelManager().put(label, ontology, isPersonal);
getPhysicalURIManager().put(ontology, uri);
getLogicalURIManager().put(ontology, uri);
getReasoner().loadOntology(ontology);
@@ -325,8 +335,26 @@
desc = parser.parse(expression);
}catch(Exception e){
throw new JasdlException("Could not parse expression "+expression+". Reason: "+e);
- }
- getAliasManager().put(alias, desc);
+ }
+
+ // We need this class to be named for parsing.
+ // Create an equivalent class and add this instead with alias as fragment.
+ // Clashes shouldn't be an issue here (thanks to distinct personal ontologies).
+ OWLOntology ontology = getLabelManager().getRight(label);
+ String _uri = getLogicalURIManager().getRight(ontology).toString();
+ _uri+="#"+functor;
+ URI uri = URI.create(_uri);
+ OWLClass naming = ontologyManager.getOWLDataFactory().getOWLClass(uri);
+ OWLEquivalentClassesAxiom axiom = ontologyManager.getOWLDataFactory().getOWLEquivalentClassesAxiom(naming, desc);
+ try {
+ ontologyManager.addAxioms(ontology, Collections.singleton(axiom));
+ } catch (OWLOntologyChangeException e) {
+ throw new JasdlException("Error adding "+uri+" naming of "+desc+" to "+label);
+ }
+ reasoner.refresh();
+ getLogger().fine("Adding named class "+uri+" for "+desc+" in "+label);
+ getAliasManager().put(alias, naming); // consequence, we can no longer easily distinguish run-time defined classes from pre-defined - need to maintain a map
+ getDefinitionManager().put(naming, desc);
getLogger().fine("Defined new class with alias "+alias);
return desc;
}
@@ -391,6 +419,12 @@
return logicalURIManager;
}
+ public DefinitionManager getDefinitionManager() {
+ return definitionManager;
+ }
+
+
+
public Reasoner getReasoner() {
return reasoner;
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -142,10 +142,10 @@
private void applyMiscMappings() throws JasdlException{
// create a "placeholder" ontology so we can safely map thing and nothing without actually loading the ontology
- agent.createOntology(AliasFactory.OWL_THING.getLabel(), URI.create("http://www.w3.org/2002/07/owl"));
+ agent.createOntology(AliasFactory.OWL_THING.getLabel(), URI.create("http://www.w3.org/2002/07/owl"), false);
// create a personal ontology for (axioms that reference) run-time defined class
- agent.createOntology(agent.getPersonalOntologyLabel(), agent.getPersonalOntologyURI());
+ agent.createOntology(agent.getPersonalOntologyLabel(), agent.getPersonalOntologyURI(), true);
agent.getAliasManager().put( AliasFactory.OWL_THING, agent.getOntologyManager().getOWLDataFactory().getOWLThing());
agent.getAliasManager().put( AliasFactory.OWL_NOTHING, agent.getOntologyManager().getOWLDataFactory().getOWLNothing());
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -94,6 +94,9 @@
Atom label = new Atom(tokens[0]);
Alias alias = AliasFactory.INSTANCE.create(functor, label);
return (OWLEntity)agent.getAliasManager().getRight(alias); // guaranteed to be an entity? Not for anonymous classes!
+ }catch(ClassCastException e){
+ // we are dealing with an anonymous class description
+ return null;
} catch (Exception e) {
return null;
}
Added: trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DefinitionManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DefinitionManager.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DefinitionManager.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -0,0 +1,15 @@
+package jasdl.bridge.alias;
+
+import jasdl.bridge.MappingManager;
+
+import org.semanticweb.owl.model.OWLClass;
+import org.semanticweb.owl.model.OWLDescription;
+
+/**
+ * Maintains mappings between run-time defined classes and their anonymous descriptions.
+ * Required for recursive rendering of run-time defined classes in terms of predefined.
+ * @author Tom Klapiscak
+ *
+ */
+public class DefinitionManager extends MappingManager<OWLClass, OWLDescription> {
+}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/LabelManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/LabelManager.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/LabelManager.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -1,8 +1,12 @@
package jasdl.bridge.label;
import jasdl.bridge.MappingManager;
+import jasdl.util.DuplicateMappingException;
import jason.asSyntax.Atom;
+import java.util.HashSet;
+import java.util.Set;
+
import org.semanticweb.owl.model.OWLOntology;
/**
@@ -12,4 +16,31 @@
*
*/
public class LabelManager extends MappingManager<Atom, OWLOntology>{
+
+ /**
+ * Members of this set are defined as "personal" ontology instances used for storing axioms
+ * about run-time defined classes and individuals. This information is needed, for example, when preparing
+ * outgoing message content (named or anon?).
+ */
+ private Set<OWLOntology> personals;
+
+
+
+
+ public LabelManager() {
+ super();
+ personals = new HashSet<OWLOntology>();
+ }
+
+ public boolean isPersonal(OWLOntology y){
+ return personals.contains(y);
+ }
+
+
+ public void put(Atom x, OWLOntology y, boolean isPersonal) throws DuplicateMappingException {
+ if(isPersonal) personals.add(y);
+ super.put(x, y);
+ }
+
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-03-17 23:30:54 UTC (rev 1159)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-03-18 02:05:59 UTC (rev 1160)
@@ -79,7 +79,7 @@
if(o.getTerm(0).isStructure()){ // Checking for atomicity directly does not seem to work
return agent.getLabelManager().getRight((Atom)o.getTerm(0));
}else if(o.getTerm(0).isString()){
- return agent.getOntology(o.getTerm(0).toString());
+ return agent.getOntology(o.getTerm(0).toString()); // may instantiate a new ontology
}else{
throw new InvalidSELiteralException("Invalid ontology annotation format on "+o);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-03-18 03:01:29
|
Revision: 1161
http://jason.svn.sourceforge.net/jason/?rev=1161&view=rev
Author: tomklapiscak
Date: 2008-03-17 20:01:18 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
travel_agent example improved and tidied up.
JASDL no longer relies on jasdl_agent_name setting - agent name is (more appropriately) taken from agent architecture.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-18 02:05:59 UTC (rev 1160)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-18 03:01:18 UTC (rev 1161)
@@ -21,9 +21,7 @@
/* Jason Project */
-/* Note: Uses c-build.xml for two reasons:
- * 1) to prevent need for large classpath specification in this file
- * 2) to automatically run ant jar task for jasdl and jmca so up-to-date versions are used
+/* Note: Uses c-build.xml to automatically run ant jar task for jasdl and jmca so up-to-date versions are used
*/
MAS dalt08 {
@@ -32,23 +30,13 @@
agents:
travel_agent
travel_agent.asl
- [
- jasdl_agent_name = "travelagent",
- // implication, "default" is a reserved ontology name
- // also, "self"
+ [
jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
- //TODO: what about when automapping causes a conflict?! anonymous aliasing?
-
+
jasdl_ontologies="travel",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- //jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
- jasdl_travel_mapping_manual="small_beach=beach",
-
- jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
- jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
-
- //,jasdl_aktors_uri="http://www.aktors.org/ontology/portal.owl",
- //jasdl_aktors_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
+ /*jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
+ jasdl_travel_mapping_manual="small_beach=beach" // these manual mappings will override any automatic mappings made by strategies
]
agentArchClass jasdl.architecture.JasdlAgArch
agentClass jasdl.asSemantics.JasdlAgent
@@ -57,30 +45,23 @@
customer
customer.asl
- [
- jasdl_agent_name = "customer",
+ [
+ /* jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", */ // defaults to this
jasdl_ontologies="holidays,places",
- //jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
+ /*jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl", */
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
- jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // arbitrary primitive mappings handled correctly
+ jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
-
- /* Example per-agent proxy settings used for ontology instantiation */
- //jasdl_http_proxy="127.0.0.1:3128"
- //jasdl_https_proxy="127.0.0.1:8080"
- //jasdl_ftp_proxy="127.0.0.1:8080"
- //jasdl_socks_proxy="127.0.0.1:1080"
]
agentArchClass jasdl.architecture.JasdlAgArch
agentClass jasdl.asSemantics.JasdlAgent
beliefBaseClass jasdl.bb.JasdlBeliefBase
#1;
-
classpath: "../../lib/**/*.jar";"../../../jmca/lib/jmca.jar";
}
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-18 02:05:59 UTC (rev 1160)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-18 03:01:18 UTC (rev 1161)
@@ -18,41 +18,44 @@
*
*/
-//+luxuriousHotel(L)[o(holidays), source(Source)]
+luxuriousHotel(L)[o(holidays), source(Source)]
- <-
+ <-
+ .print("The ", L, " luxurious hotel is available");
- ?hotel(L)[o(holidays)];
- .print("The ", L, " luxurious hotel is available");
- jasdl.ia.define_class(query, "holidays:city and holidays:hasAccommodation value self:", L);
- .send(Source, askOne, query(City)[o(self)], query(City)[o(self)]);
+ // construct a class containing all cities in which L is located
+ jasdl.ia.define_class(cityOfL, "holidays:city and holidays:hasAccommodation value self:", L);
+ .send(Source, askOne, cityOfL(City)[o(self)], cityOfL(City)[o(self)]); // use to "query" to sender of this luxuriousHotel (travel_agent)
.print(L, " is located in the city ", City);
// check given hotel is located in a destination that has some museums
jasdl.ia.define_class(hotelNearMuseums, "holidays:isLocatedAt some (holidays:hasActivity some holidays:museums)");
- .send(Source, askOne, hotelNearMuseums(HotelNearMuseums)[o(self)], hotelNearMuseums(HotelNearMuseums)[o(self)]);
+ .send(Source, askOne, hotelNearMuseums(HotelNearMuseums)[o(self)], hotelNearMuseums(HotelNearMuseums)[o(self)]); // use to "query" to sender of this luxuriousHotel (travel_agent)
.print(HotelNearMuseums, " is a hotel located in a city with some museums");
+ // Shows a class definition in part composed of other run-time class definitions
jasdl.ia.define_class(luxuriousHotelNearMuseums, "self:hotelNearMuseums AND holidays:luxuriousHotel");
- .send(Source, askOne, luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)], luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)]);
+ .send(Source, askOne, luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)], luxuriousHotelNearMuseums(LuxuriousHotelNearMuseums)[o(self)]); // use to "query" to sender of this luxuriousHotel (travel_agent)
.print(LuxuriousHotelNearMuseums, " is a luxurious hotel located in a city with some museums");
// bundle([h_1...h_n]) demonstrates how JASDL deals with nested se-content
// in particular, this query bundles together an arbitrary number of queries into a single message
- .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)], hotelNearMuseums(H4)[o(self)] ] ), Response);
+ .send(Source, askOne, bundle( [ luxuriousHotel(H1)[o(holidays)], hotel(H2)[o(holidays)], activity(H3)[o(holidays)], hotelNearMuseums(H4)[o(self)] ] ), Response); // use to "query" to sender of this luxuriousHotel (travel_agent)
.print("Bundled query response: ", Response);
+ // ontology refered to by "places" is not known by travel_agent, but will be instantiated at run-time so it can usefully deal with this message
+ .send(Source, tell, building(travel_lodge)[o(places)]);
+ .send(Source, askOne, building(travel_lodge)[o(places)], _, 1000); // ensure information has been recieved by sender (travel_agent)
+
+ // demonstrates use of class definitions that mix entities from different ontologies
+ jasdl.ia.define_class(buildingAndHotel, "places:building and holidays:hotel");
+ .send(Source, askOne, buildingAndHotel(BuildingAndHotel)[o(self)], buildingAndHotel(BuildingAndHotel)[o(self)]);
+ .print(BuildingAndHotel, " is a building and a hotel");
+
.send(Source, tell, example_KSAA_complete).
-
+// Shows how we can receive all_different assertions that can now be sent (since they are no longer asserted using internal actions)
+all_different(XS)[o(holidays), source(Source)]
<-
- .print(XS, " are mutually distinct individuals, according to ", Source);
- .send(Source, tell, building(travel_lodge)[o(places)]);
- .wait(1000); // wait to ensure travel_agent has had a chance to add this information to its belief base
+ .print(XS, " are mutually distinct individuals, according to ", Source).
- jasdl.ia.define_class(q3, "(places:place and places:building) and holidays:hotel");
- .send(Source, askOne, q3(Hotel)[o(self)], q3(Hotel)[o(self)]);
- .print(Hotel, " is a building and a hotel").
-
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-18 02:05:59 UTC (rev 1160)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-18 03:01:18 UTC (rev 1161)
@@ -39,16 +39,12 @@
+urbanArea(windsor)[o(travel)]; // windsor is an urban area
+isPartOf(windsor, london)[o(travel)]; // windsor is a part of london
+isPartOf(london, england)[o(travel)]; // london is a part of england
- +hasPricePerNight(hilton, 22.0)[o(travel)]; // hilton costs £22 a night
-
+ +hasPricePerNight(hilton, 22.0)[o(travel)]; // hilton costs £22 a night
+museums(scienceMuseum)[o(travel)];
+hasActivity(london, scienceMuseum)[o(travel)];
+hotel(travel_lodge)[o(travel)];
-
.print("Completed: Updating Belief Base 1").
-
-
@example_ubb_2[atomic]
+!example_UBB_2
<-
@@ -88,8 +84,10 @@
<-
.print("Example: Knowledge Sharing Among Agents");
.send(customer, tell, luxuryHotel(hilton)[o(travel)]);
- .send(customer, tell, all_different([hilton, fourSeasons])[o(travel)]). // since all_different assertions are treated as SE-literals, we can now send them between agents
-
+ // since all_different assertions are treated as SE-literals, we can now send them between agents
+ .send(customer, tell, all_different([hilton, fourSeasons])[o(travel)]).
+
+
// for dealing with bundled queries - see customer.asl
@bundle_1[atomic]
+?bundle([]).
@@ -144,9 +142,11 @@
+urbanArea(x)[o(travel), source(tom)];
+ruralArea(y)[o(travel), source(ben)];
- ?all_different([x,y])[o(travel), source(tom), source(ben)]; // because knowledge from tom and ben contributed to the inference that x and y are distinct
+ // because knowledge from tom and ben contributed to the inference that x and y are distinct
+ ?all_different([x,y])[o(travel), source(tom), source(ben)];
- ?familyDestination(butlins)[o(travel), something]; // notice "something" annotation is gathered here since it all_different assertion contributes to this inference
+ // notice "something" annotation is gathered (added in !example_all_different) here since it all_different assertion contributes to this inference
+ ?familyDestination(butlins)[o(travel), something];
.print("Complete: annotation gathering").
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-18 02:05:59 UTC (rev 1160)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-18 03:01:18 UTC (rev 1161)
@@ -5,6 +5,7 @@
import jasdl.asSemantics.parsing.URIEntityChecker;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
+import jasdl.bridge.AllDifferentPlaceholder;
import jasdl.bridge.ToAxiomConverter;
import jasdl.bridge.ToSELiteralConverter;
import jasdl.bridge.alias.Alias;
@@ -132,7 +133,20 @@
// load .mas2j JASDL configuration
JasdlConfigurator config = new JasdlConfigurator(this);
config.configure(stts);
- return super.initAg(arch, bb, src, stts);
+
+ TransitionSystem ts = super.initAg(arch, bb, src, stts);
+
+ // *** The following must be performed after super.initAg since we require an agent name to be set ***
+
+ // create a personal ontology for (axioms that reference) run-time defined class
+ createOntology(getPersonalOntologyLabel(), getPersonalOntologyURI(), true);
+
+ // create a "placeholder" ontology so we can safely map thing and nothing without actually loading the ontology
+ createOntology(AliasFactory.OWL_THING.getLabel(), URI.create("http://www.w3.org/2002/07/owl"), false);
+ getAliasManager().put( AliasFactory.OWL_THING, getOntologyManager().getOWLDataFactory().getOWLThing());
+ getAliasManager().put( AliasFactory.OWL_NOTHING, getOntologyManager().getOWLDataFactory().getOWLNothing());
+
+ return ts;
}
@@ -237,12 +251,10 @@
OWLOntology ontology = ontologyManager.loadOntologyFromPhysicalURI(uri);
Set<OWLOntology> imports = ontologyManager.getImportsClosure(ontology);
reasoner.loadOntologies(imports);
- reasoner.classify();
- labelManager.put(label, ontology, false); // (successfully) loaded ontologies never personal
- physicalURIManager.put(ontology, uri);
- logicalURIManager.put(ontology, ontology.getURI());
+ reasoner.classify();
+ initOntology(ontology, label, uri, ontology.getURI(), false); // (successfully) loaded ontologies never personal
+ applyMappingStrategies(ontology, strategies);
getLogger().fine("Loaded ontology from "+uri+" and assigned label "+label);
- applyMappingStrategies(ontology, strategies);
return ontology;
}catch(OWLOntologyCreationException e){
getLogger().warning("Placeholder personal ontology substituted for unreachable "+uri);
@@ -252,6 +264,8 @@
}
}
+
+
/**
* Creates and fully maps a blank ontology. Used for example for "owl" ontology, containing
* axioms referencing "owl:thing" and "owl:nothing", and for personal ontologies containing
@@ -263,10 +277,8 @@
public OWLOntology createOntology(Atom label, URI uri, boolean isPersonal) throws JasdlException{
try{
OWLOntology ontology = getOntologyManager().createOntology( uri );
- getLabelManager().put(label, ontology, isPersonal);
- getPhysicalURIManager().put(ontology, uri);
- getLogicalURIManager().put(ontology, uri);
getReasoner().loadOntology(ontology);
+ initOntology(ontology, label, uri, uri, isPersonal);
return ontology;
} catch (OWLOntologyCreationException e) {
throw new JasdlException("Error instantiating OWL ontology. Reason: "+e);
@@ -274,6 +286,23 @@
}
/**
+ * Common ontology initialisation functionality, sets up various mappings.
+ * @param ontology
+ * @param label
+ * @param physicalURI
+ * @param logicalURI
+ * @param isPersonal
+ * @throws JasdlException
+ */
+ private void initOntology(OWLOntology ontology, Atom label, URI physicalURI, URI logicalURI, boolean isPersonal) throws JasdlException{
+ labelManager.put(label, ontology, isPersonal);
+ physicalURIManager.put(ontology, physicalURI);
+ logicalURIManager.put(ontology, logicalURI);
+ // create the AllDifferent placeholder entity for this ontology
+ getAliasManager().put( AliasFactory.INSTANCE.all_different(label), new AllDifferentPlaceholder(label)); // must be new instance to avoid duplicate mapping exceptions
+ }
+
+ /**
* When a duplicate mapping is encountered, an anonymous alias is created for the offending resource
* @param ontology
* @param strategies
@@ -364,14 +393,8 @@
* @return
*/
public String getAgentName(){
- return agentName;
+ return getTS().getUserAgArch().getAgName();
}
-
- public void setAgentName(String agentName){
- this.agentName = agentName;
- }
-
-
public List<MappingStrategy> getDefaultMappingStrategies() {
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-18 02:05:59 UTC (rev 1160)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-18 03:01:18 UTC (rev 1161)
@@ -27,6 +27,14 @@
private static String MAS2J_MAPPING_MANUAL = "_mapping_manual";
private static String MAS2J_AGENT_NAME = "_agent_name";
+ /**
+ * List of reserved ontology labels. Currently:
+ * <ul>
+ * <li> "default" - allows jasdl_default_mapping_strategies to be conveniently used to define the default mapping strategies performed
+ * by this agent on unknown incoming ontologies and predefined ontologies lacking mapping strategy definition</li>
+ * <li> "self" - refers to the "personal" ontology used by this agent to store axioms referencing run-time defined classes and individuals </li>
+ * </ul>
+ */
public static List<Atom> reservedOntologyLabels = Arrays.asList( new Atom[] {new Atom("default"), new Atom("self")});
@@ -38,15 +46,11 @@
public void configure(Settings stts) throws JasdlException{
try{
- // load agent name
- agent.setAgentName(prepareUserParameter( stts, MAS2J_PREFIX + MAS2J_AGENT_NAME ));
-
// load default mapping strategies
agent.setDefaultMappingStrategies(getMappingStrategies(stts, new Atom("default"))); //implication "default" is a reserved ontology label
loadOntologies(stts);
- applyManualMappings(stts);
- applyMiscMappings();
+ applyManualMappings(stts);
}catch(JasdlException e){
@@ -134,34 +138,12 @@
return strategies;
}
- /**
- * Maps thing and nothing. Must use "owl" label to refer to these, e.g. thing(x)[o(owl)]
- *
- * @throws JasdlException
- */
- private void applyMiscMappings() throws JasdlException{
-
- // create a "placeholder" ontology so we can safely map thing and nothing without actually loading the ontology
- agent.createOntology(AliasFactory.OWL_THING.getLabel(), URI.create("http://www.w3.org/2002/07/owl"), false);
-
- // create a personal ontology for (axioms that reference) run-time defined class
- agent.createOntology(agent.getPersonalOntologyLabel(), agent.getPersonalOntologyURI(), true);
-
- agent.getAliasManager().put( AliasFactory.OWL_THING, agent.getOntologyManager().getOWLDataFactory().getOWLThing());
- agent.getAliasManager().put( AliasFactory.OWL_NOTHING, agent.getOntologyManager().getOWLDataFactory().getOWLNothing());
-
- for(Atom label : agent.getLabelManager().getLefts()){
- agent.getAliasManager().put( AliasFactory.INSTANCE.all_different(label), new AllDifferentPlaceholder(label)); // must be new instance to avoid duplicate mapping exceptions
- }
- }
-
-
/**
* Convenience method to strip quotes and trim a .mas2j setting
* @param stts .mas2j settings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-03-18 20:13:12
|
Revision: 1162
http://jason.svn.sourceforge.net/jason/?rev=1162&view=rev
Author: tomklapiscak
Date: 2008-03-18 13:12:54 -0700 (Tue, 18 Mar 2008)
Log Message:
-----------
travel_agent's c-build.xml fixed, travel_agent now performs all necessary ant tasks in the right order and ensures latest jason.jar is used. travel_agent should now run out of the box.
README updated.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/README
trunk/applications/jasdl-owlapi/examples/travel_agent/bin/c-build.xml
Modified: trunk/applications/jasdl-owlapi/README
===================================================================
--- trunk/applications/jasdl-owlapi/README 2008-03-18 03:01:18 UTC (rev 1161)
+++ trunk/applications/jasdl-owlapi/README 2008-03-18 20:12:54 UTC (rev 1162)
@@ -1,5 +1,23 @@
-JASDL: "Jason AgentSpeak-DescriptionLogic"
+JASDL: "Jason AgentSpeak-Description Logic"
Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
JASDL is distributed under the LGPL license (see COPYING and COPYING.LESSER)
-Thank you for your interest in JASDL!
+
+*** Running JASDL ***
+
+Firstly, please check you are using the latest revision of the entire Jason trunk from the SVN before use.
+
+To run a JASDL agent, its class-path must include all jars under the sub-directories:
+ * trunk/applications/jasdl-owlapi/lib
+ * trunk/applications/jmca/lib
+ * All standard Jason libraries, please ensure that these are built from the latest revision of the Jason trunk.
+
+The (unmodified) travel_agent example (trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j)
+must be run in-situ within the Jason trunk. All necessary ant tasks will be performed by its custom build script.
+
+*** Configuring JASDL ***
+
+Please refer to /trunk/jason/applications/jasdl-owlapi/examples/travel_agent/config.mas2j for an example of how to configure JASDL agents.
+
+
+Thank you for your interest in JASDL!
\ No newline at end of file
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/bin/c-build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/bin/c-build.xml 2008-03-18 03:01:18 UTC (rev 1161)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/bin/c-build.xml 2008-03-18 20:12:54 UTC (rev 1162)
@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name ="custombuild" basedir="..">
+ <property name="jasonJar" value="../../../../lib/jason.jar"/>
+
<import file="build.xml"/>
- <target name="user-init">
+
+ <target name="user-init">
+ <ant dir="../../../../" inheritAll="false" target="plugin"/>
+ <ant dir="../../../jmca" inheritAll="false"/>
<ant dir="../.." inheritAll="false"/>
- <ant dir="../../../jmca" inheritAll="false"/>
</target>
+
<target name="user-end">
- <echo message="JASDL end"/>
</target>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-03-20 23:22:48
|
Revision: 1169
http://jason.svn.sourceforge.net/jason/?rev=1169&view=rev
Author: tomklapiscak
Date: 2008-03-20 16:22:41 -0700 (Thu, 20 Mar 2008)
Log Message:
-----------
Description Logic based belief-revision implemented. Given a modification to the ontology that would result in an inconsistency, consistency is be maintained by either contracting the least trusted of the contradictory assertions, or preventing the addition of the incoming belief.
JASDL's implementation of the "incision" function (used establish which justifications to contract) makes use of agent trust ratings (which can now be specified in the mas2j file) established using the source annotation.
JASDL's implementation of the "KernelsetFilter" ensures that only assertions about individuals (i.e. those that can be represented as SE-Literals) can be contracted.
The BeliefBaseRevisor is designed as a general library for belief base revision of OWL-DL ontologies using the OWL-API and will soon be placed in a seperate library.
Since this feature is highly experimental, it can disabled in the mas2j file. In which case, JASDL's legacy consistency maintenence mechanism is adopted (earlier assertions always precede over later ones).
Failed and ineffectual belief additions now handled correctly by JASDL.
travel_agent example updated.
Agent mind-inspector support re-implemented.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/lib/pellet/pellet.jar
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/lib/pellet/jena/
trunk/applications/jasdl-owlapi/lib/pellet/jena/antlr-2.7.5.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/arq-extra.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/arq.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/commons-logging-1.1.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/concurrent.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/icu4j_3_4.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/iri.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/jena.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/jenatest.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/json.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/junit.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/log4j-1.2.12.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/lucene-core-2.0.0.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/stax-api-1.0.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/wstx-asl-3.0.0.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/xercesImpl.jar
trunk/applications/jasdl-owlapi/lib/pellet/jena/xml-apis.jar
trunk/applications/jasdl-owlapi/lib/pellet/jetty/
trunk/applications/jasdl-owlapi/lib/pellet/jetty/jetty.jar
trunk/applications/jasdl-owlapi/lib/pellet/junit/
trunk/applications/jasdl-owlapi/lib/pellet/junit/junit.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/antlr-runtime-3.0.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/commons-lang-2.2.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-api.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-apibinding.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-change.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-debugging.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-dig1_1.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalrenderer.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-impl.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-krssparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxrenderer.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-metrics.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-oboparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlrenderer.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfapi.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlparser.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlrenderer.jar
trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-util.jar
trunk/applications/jasdl-owlapi/lib/pellet/pcj.jar
trunk/applications/jasdl-owlapi/lib/pellet/servlet.jar
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseContractor.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/IncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/IsolatedOntologyOperation.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/KernelsetFilter.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/TBoxAxiomKernelsetFilter.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-20 18:15:42 UTC (rev 1168)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-20 23:22:41 UTC (rev 1169)
@@ -31,12 +31,19 @@
travel_agent
travel_agent.asl
[
- jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
+ jasdl_useBeliefRevision = "true", // use experimental DL-based belief revision mechanism
+
+ jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
jasdl_ontologies="travel",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
/*jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
- jasdl_travel_mapping_manual="small_beach=beach" // these manual mappings will override any automatic mappings made by strategies
+ jasdl_travel_mapping_manual="small_beach=beach", // these manual mappings will override any automatic mappings made by strategies,
+
+ // static trust ratings, mainly for testing purposes - likely to change
+ jasdl_knownAgents = "tom,ben",
+ jasdl_tom_trustRating="0.9",
+ jasdl_ben_trustRating="0.4"
]
agentArchClass jasdl.architecture.JasdlAgArch
agentClass jasdl.asSemantics.JasdlAgent
@@ -47,12 +54,14 @@
customer.asl
[
/* jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", */ // defaults to this
+ jasdl_useBeliefRevision = "true",
jasdl_ontologies="holidays,places",
/*jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl", */
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
+
jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-20 18:15:42 UTC (rev 1168)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl 2008-03-20 23:22:41 UTC (rev 1169)
@@ -59,3 +59,7 @@
.print(XS, " are mutually distinct individuals, according to ", Source).
++testing
+ <-
+ .print("Semantically-naive inter-agent communication working").
+
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-20 18:15:42 UTC (rev 1168)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-20 23:22:41 UTC (rev 1169)
@@ -33,6 +33,7 @@
.print("Example: Updating Belief Base 1");
+hotel(hilton)[o(travel)]; // hilton is a hotel
+hasRating(hilton, threeStarRating)[o(travel)]; // hilton has three-star rating
+ +town(london)[o(travel)];
+city(london)[o(travel)]; // london is a city
+hasAccommodation(london, hilton)[o(travel)]; // hilton is in london
+country(england)[o(travel)]; // england is a country
@@ -49,8 +50,28 @@
+!example_UBB_2
<-
.print("Example: Updating Belief Base 2");
- /* 1 */ +hasRating(hilton, twoStarRating)[o(travel)];
- /* 2 */ +ruralArea(london)[o(travel)];
+
+ +city(somewhere)[o(travel), source(ben)];
+ +town(somewhere)[o(travel), source(ben)];
+
+ // Despite the classes urbanArea and ruralArea being disjoint, the belief addition below will succeed,
+ // since tom's word is trusted over ben's (see config.mas2j)
+ // as a result, both (incompatible) assertions made above by ben will be contracted
+ // and the one below will be added. Notice ABox consistency is maintained..
+ +ruralArea(somewhere)[o(travel), source(tom)];
+ ?ruralArea(somewhere)[o(travel)];
+
+ .print("DL-based belief revision is enabled"); // without, the above test-goal will fail, since legacy mechanism simply removes incoming inconsistent beliefs
+
+ // since the classes destination and and contact are disjoint (and ruralArea is a subclass of destination),
+ // and since we trust ben less than tom, the belief addition below will fail (and tom's assertion above will persist),
+ // thus failing the whole plan.
+ +contact(somewhere)[o(travel), source(ben)].
+
+-!example_UBB_2
+ <-
+ // Notice this does not hold, since belief revision rejected the less trusted assertion made by ben.
+ ?~contact(somewhere)[o(travel)];
.print("Completed: Updating Belief Base 2").
@@ -83,6 +104,7 @@
+!example_KSAA
<-
.print("Example: Knowledge Sharing Among Agents");
+ .send(customer, tell, testing);
.send(customer, tell, luxuryHotel(hilton)[o(travel)]);
// since all_different assertions are treated as SE-literals, we can now send them between agents
.send(customer, tell, all_different([hilton, fourSeasons])[o(travel)]).
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/antlr-2.7.5.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/antlr-2.7.5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/arq-extra.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/arq-extra.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/arq.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/arq.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/commons-logging-1.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/commons-logging-1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/concurrent.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/concurrent.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/icu4j_3_4.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/icu4j_3_4.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/iri.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/iri.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/jena.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/jena.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/jenatest.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/jenatest.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/json.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/json.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/junit.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/junit.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/log4j-1.2.12.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/log4j-1.2.12.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/lucene-core-2.0.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/lucene-core-2.0.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/stax-api-1.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/stax-api-1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/wstx-asl-3.0.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/wstx-asl-3.0.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/xercesImpl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/xercesImpl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jena/xml-apis.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jena/xml-apis.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/jetty/jetty.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/jetty/jetty.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/junit/junit.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/junit/junit.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/antlr-runtime-3.0.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/antlr-runtime-3.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/commons-lang-2.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/commons-lang-2.2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-api.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-apibinding.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-apibinding.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-change.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-change.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-debugging.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-debugging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-dig1_1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-dig1_1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalrenderer.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-functionalrenderer.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-impl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-krssparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-krssparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxrenderer.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-mansyntaxrenderer.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-metrics.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-metrics.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-oboparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-oboparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlrenderer.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-owlxmlrenderer.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfapi.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfapi.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlparser.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlparser.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlrenderer.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-rdfxmlrenderer.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-util.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/owlapi/owlapi-util.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/lib/pellet/pcj.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/pcj.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/applications/jasdl-owlapi/lib/pellet/pellet.jar
===================================================================
(Binary files differ)
Added: trunk/applications/jasdl-owlapi/lib/pellet/servlet.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/pellet/servlet.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-20 18:15:42 UTC (rev 1168)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-20 23:22:41 UTC (rev 1169)
@@ -5,6 +5,10 @@
import jasdl.asSemantics.parsing.URIEntityChecker;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
+import jasdl.bb.revision.BeliefBaseRevisor;
+import jasdl.bb.revision.JasdlIncisionFunction;
+import jasdl.bb.revision.JasdlReasonerFactory;
+import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
import jasdl.bridge.AllDifferentPlaceholder;
import jasdl.bridge.ToAxiomConverter;
import jasdl.bridge.ToSELiteralConverter;
@@ -16,15 +20,20 @@
import jasdl.bridge.alias.MappingStrategy;
import jasdl.bridge.label.LabelManager;
import jasdl.bridge.label.OntologyURIManager;
+import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralFactory;
import jasdl.util.DuplicateMappingException;
import jasdl.util.InvalidSELiteralException;
import jasdl.util.JasdlException;
+import jasdl.util.NotEnrichedException;
import jasdl.util.UnknownMappingException;
import jason.JasonException;
+import jason.RevisionFailedException;
import jason.architecture.AgArch;
+import jason.asSemantics.Intention;
import jason.asSemantics.TransitionSystem;
import jason.asSyntax.Atom;
+import jason.asSyntax.Literal;
import jason.bb.BeliefBase;
import jason.runtime.Settings;
@@ -32,6 +41,7 @@
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.Vector;
@@ -42,10 +52,15 @@
import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
+import org.semanticweb.owl.model.AddAxiom;
+import org.semanticweb.owl.model.OWLAnnotation;
+import org.semanticweb.owl.model.OWLAxiom;
+import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLDescription;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLEquivalentClassesAxiom;
+import org.semanticweb.owl.model.OWLIndividualAxiom;
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.OWLOntologyChangeException;
import org.semanticweb.owl.model.OWLOntologyCreationException;
@@ -54,7 +69,7 @@
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
-public class JasdlAgent extends JmcaAgent {
+public class JasdlAgent extends JmcaAgent{
public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMapp...
[truncated message content] |
|
From: <tom...@us...> - 2008-03-31 21:56:53
|
Revision: 1185
http://jason.svn.sourceforge.net/jason/?rev=1185&view=rev
Author: tomklapiscak
Date: 2008-03-31 14:56:43 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Belief Base removals are now implemented using the contraction operator and annotation removals handled correctly.
DL Belief Base semi-revision improved.
Implemented proper handling of physically disjoint but logically identical ontologies.
Made fully compatible with the latest release of Jason.
SE-Plan cloning handled correctly.
Improvements to Belief Base contains method.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/build.xml
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/IsolatedOntologyOperation.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseSemiRevisor.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/IndividualAxiomToDescriptionConverter.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java
Property Changed:
----------------
trunk/applications/jasdl-owlapi/examples/
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-03-31 21:56:43 UTC (rev 1185)
@@ -39,12 +39,13 @@
<delete dir="${apidocs.dir}"/>
</target>
+
<target name="test" depends="jar">
<junit printsummary="yes" failureProperty="test.failure">
<classpath refid="test.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
- <fileset dir="${basedir}/src" includes="**/junit/AllTests.java" />
+ <fileset dir="${source.dir}/jasdl/test" includes="*Test.java" />
</batchtest>
</junit>
<fail message="test failed" if="test.failure" />
Property changes on: trunk/applications/jasdl-owlapi/examples
___________________________________________________________________
Name: svn:ignore
+ testing
brf_test
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-31 21:56:43 UTC (rev 1185)
@@ -37,6 +37,7 @@
jasdl_ontologies="travel",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
+
/*jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
jasdl_travel_mapping_manual="small_beach=beach", // these manual mappings will override any automatic mappings made by strategies,
@@ -57,7 +58,6 @@
jasdl_useBeliefRevision = "true",
jasdl_ontologies="holidays,places",
- /*jasdl_holidays_uri="file:///home/tom/Desktop/Project/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl", */
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-31 21:56:43 UTC (rev 1185)
@@ -37,23 +37,31 @@
+city(london)[o(travel)]; // london is a city
+hasAccommodation(london, hilton)[o(travel)]; // hilton is in london
+country(england)[o(travel)]; // england is a country
- +urbanArea(windsor)[o(travel)]; // windsor is an urban area
- +isPartOf(windsor, london)[o(travel)]; // windsor is a part of london
+ +urbanArea(wembley)[o(travel)]; // wembley is an urban area
+ +isPartOf(wembley, london)[o(travel)]; // wembley is a part of london
+isPartOf(london, england)[o(travel)]; // london is a part of england
+hasPricePerNight(hilton, 22.0)[o(travel)]; // hilton costs £22 a night
+museums(scienceMuseum)[o(travel)];
+hasActivity(london, scienceMuseum)[o(travel)];
+hotel(travel_lodge)[o(travel)];
.print("Completed: Updating Belief Base 1").
-
+
@example_ubb_2[atomic]
+!example_UBB_2
- <-
- .print("Example: Updating Belief Base 2");
+ <-
+ .print("Example: Updating Belief Base 2");
+ jasdl.ia.define_class(tiny, "travel:urbanArea and travel:hasActivity max 1 travel:activity");
+ +tiny(newcastle)[o(self), source(tom)];
+ +hasActivity(newcastle, ax)[o(travel), source(tom)];
+ +hasActivity(newcastle, bx)[o(travel), source(ben)];
+ +all_different([ax, bx])[o(self), source(tom)];
+
+
+city(somewhere)[o(travel), source(ben)];
+town(somewhere)[o(travel), source(ben)];
+
// Despite the classes urbanArea and ruralArea being disjoint, the belief addition below will succeed,
// since tom's word is trusted over ben's (see config.mas2j)
// as a result, both (incompatible) assertions made above by ben will be contracted
@@ -66,16 +74,18 @@
// since the classes destination and and contact are disjoint (and ruralArea is a subclass of destination),
// and since we trust ben less than tom, the belief addition below will fail (and tom's assertion above will persist),
// thus failing the whole plan.
- +contact(somewhere)[o(travel), source(ben)].
+ +contact(somewhere)[o(travel), source(ben)];
+ .print("Failed: Updating Belief Base 2").
+
+@example_UBB_2_failure[atomic]
-!example_UBB_2
<-
// Notice this does not hold, since belief revision rejected the less trusted assertion made by ben.
?~contact(somewhere)[o(travel)];
.print("Completed: Updating Belief Base 2").
-
-@example_qbb[atomic]
+@example_qbb[atomic, breakpoint]
+!example_QBB
<-
.print("Example: Querying Belief Base");
@@ -83,13 +93,13 @@
/* 2 */ ?luxuryHotel(LuxuryHotel)[o(travel)];
/* 3 */ ?~budgetAccommodation(hilton)[o(travel)];
/* 4 */ .findall(Thing, thing(Thing)[o(owl)], E);
- /* 5 */ ?countryOf(windsor, Country);
+ /* 5 */ ?countryOf(wembley, Country);
/* 6 */ ?hasPricePerNight(hilton, Price)[o(travel)];
.print("Completed: Querying Belief Base").
-+?countryOf(Destination, Country) :
- isPartOf(Destination, Country)[o(travel)] &
- country(Country)[o(travel)].
++?countryOf(Destination, Country) : isPartOf(Destination, Country)[o(travel)] & country(Country)[o(travel)].
+
+
@example_rpp[atomic]
+!example_RPP
<-
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -5,7 +5,7 @@
import jasdl.asSemantics.parsing.URIEntityChecker;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
-import jasdl.bb.revision.BeliefBaseRevisor;
+import jasdl.bb.revision.BeliefBaseSemiRevisor;
import jasdl.bb.revision.JasdlIncisionFunction;
import jasdl.bb.revision.JasdlReasonerFactory;
import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
@@ -30,6 +30,7 @@
import jason.JasonException;
import jason.RevisionFailedException;
import jason.architecture.AgArch;
+import jason.asSemantics.Event;
import jason.asSemantics.Intention;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
@@ -44,6 +45,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Queue;
import java.util.Set;
import java.util.Vector;
@@ -53,10 +55,7 @@
import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
-import org.semanticweb.owl.model.AddAxiom;
-import org.semanticweb.owl.model.OWLAnnotation;
import org.semanticweb.owl.model.OWLAxiom;
-import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLDescription;
import org.semanticweb.owl.model.OWLEntity;
@@ -183,6 +182,16 @@
+ @Override
+ public Event selectEvent(Queue<Event> events) {
+ getLogger().finest("Events: "+events);
+ return super.selectEvent(events);
+ }
+
+
+
+
+
public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException {
if(!isBeliefRevisionEnabled()){ // if experimental feature is disabled
@@ -192,41 +201,23 @@
List<Literal> addList = new Vector<Literal>();
List<Literal> removeList = new Vector<Literal>();
-
// just accept beliefToDel. Assumption: Deletions never lead to inconsistencies?!
- if(beliefToDel != null){
+ if(beliefToDel != null){
+ getLogger().finest("Revise: -"+beliefToDel);
removeList.add(beliefToDel);
- }
-
- if(beliefToAdd != null){
- try{
-
-
+ }else if(beliefToAdd != null){
+ try{
+ getLogger().fine("Revise: +"+beliefToAdd);
SELiteral sl = getSELiteralFactory().create(beliefToAdd);
- OWLAxiom axiomToAdd = sl.createAxiom();
+ OWLAxiom axiomToAdd = sl.createAxiom();
+ BeliefBaseSemiRevisor bbrev = new BeliefBaseSemiRevisor(axiomToAdd, getOntologyManager(), new JasdlReasonerFactory(), getLogger());
+ List<OWLAxiom> contractList = bbrev.revise(new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(this, sl));
- BeliefBaseRevisor bbrev = new BeliefBaseRevisor(axiomToAdd, getOntologyManager(), new JasdlReasonerFactory(), getLogger());
- List<OWLAxiom>[] result = bbrev.revise(new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(this, sl));
-
- /*
- for(OWLAxiom added : result[0]){
- addList.add( getToSELiteralConverter().convert((OWLIndividualAxiom)added).getLiteral()); // safe type cast - Jasdl's incision function ensures only individual axioms are contracted
+ // will only have reached here if new belief is accepted.
+ addList.add(beliefToAdd);
+ for(OWLAxiom contract : contractList){
+ removeList.add(toSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
}
- */
- // Simplication possible: only at most one addition (toAdd). Additionally, annotations required!
- if(result[0].contains(axiomToAdd)){
- addList.add(beliefToAdd);
-
- // there will only be axioms to remove if we accepted beliefToAdd
- for(OWLAxiom removed : result[1]){
- removeList.add( getToSELiteralConverter().convert((OWLIndividualAxiom)removed).getLiteral()); // safe type cast - Jasdl's incision function ensures only individual axioms are contracted
- }
- }else{
- // throw revision failed exception, since we didn't successfully add this belief
- throw new RevisionFailedException("Revision failed on "+beliefToAdd);
- }
-
-
}catch(RevisionFailedException e){
throw e; // propagate upwards
}catch(NotEnrichedException e){
@@ -236,22 +227,13 @@
getLogger().warning("Error performing belief revision. Reason:");
e.printStackTrace();
}
+ }else{
+ throw new RuntimeException("Unexpected behaviour, both beliefToAdd and beliefToDel are non-null...?");
}
List<Literal>[] toReturn = null;
-
- // affect BB
- for(Literal added : addList){
- if(getBB().add(added)){
- if(toReturn == null){
- toReturn = new List[2];
- toReturn[0] = new Vector<Literal>();
- toReturn[1] = new Vector<Literal>();
- }
- toReturn[0].add(added);
- }
- }
+ // Need to perform removals before additions so our ontology instance never becomes inconsistent
for(Literal removed : removeList){
// we need to ground unground removals
Unifier u = null;
@@ -261,21 +243,35 @@
u = new Unifier();
}
if (believes(removed, u)) {
- removed.apply(u); // TODO: should unground removals not result in removal of all unifications?
+ removed.apply(u);
if(getBB().remove(removed)){
if(toReturn == null){
- if(toReturn == null){
- toReturn = new List[2];
- toReturn[0] = new Vector<Literal>();
- toReturn[1] = new Vector<Literal>();
- }
- toReturn[1].add(removed);
+ toReturn = new List[2];
+ toReturn[0] = new Vector<Literal>();
+ toReturn[1] = new Vector<Literal>();
}
+ toReturn[1].add(removed);
}
- }
+ }
}
+
+
+ // affect BB
+ for(Literal added : addList){
+ if(getBB().add(added)){
+ if(toReturn == null){
+ toReturn = new List[2];
+ toReturn[0] = new Vector<Literal>();
+ toReturn[1] = new Vector<Literal>();
+ }
+ toReturn[0].add(added);
+ }
+ }
+
+
+
return toReturn;
}
@@ -381,19 +377,23 @@
public OWLOntology loadOntology(Atom label, URI uri, List<MappingStrategy> strategies) throws JasdlException{
try{
OWLOntology ontology = ontologyManager.loadOntologyFromPhysicalURI(uri);
+ try{
+ OWLOntology alreadyKnown = logicalURIManager.getLeft(ontology.getURI());
+ return alreadyKnown;
+ }catch(UnknownMappingException e){}
Set<OWLOntology> imports = ontologyManager.getImportsClosure(ontology);
reasoner.loadOntologies(imports);
- reasoner.classify();
+ reasoner.classify();
initOntology(ontology, label, uri, ontology.getURI(), false); // (successfully) loaded ontologies never personal
applyMappingStrategies(ontology, strategies);
- getLogger().fine("Loaded ontology from "+uri+" and assigned label "+label);
+ getLogger().fine("Loaded ontology from "+uri+" and assigned label "+label);
return ontology;
}catch(OWLOntologyCreationException e){
getLogger().warning("Placeholder personal ontology substituted for unreachable "+uri);
// can't load it, just create a blank (for unqualification of ontology annotations for example)
// personal by definition
return createOntology(label, uri, true);
- }
+ }
}
@@ -428,6 +428,7 @@
*/
private void initOntology(OWLOntology ontology, Atom label, URI physicalURI, URI logicalURI, boolean isPersonal) throws JasdlException{
labelManager.put(label, ontology, isPersonal);
+
physicalURIManager.put(ontology, physicalURI);
logicalURIManager.put(ontology, logicalURI);
// create the AllDifferent placeholder entity for this ontology
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -67,8 +67,8 @@
* TODO: We are repeating work here: fetching more general triggers. Optimise by storing result for immedate use?
* Could store as part of plan, but wouldn't work correctly for run-time defined class
*/
- public List<Plan> getAllRelevant(Trigger te){
- List<Plan> relevant = super.getAllRelevant(te);
+ public List<Plan> getCandidatePlans(Trigger te){
+ List<Plan> relevant = super.getCandidatePlans(te);
if(!te.getLiteral().negated()){
try {
List<Plan> moreGeneral = getMoreGeneralPlans(te);
@@ -86,6 +86,28 @@
agent.getLogger().warning("JASDL plan relevancy check failed. Reason: "+e);
}
}
+
+ /*
+ * Alternative fix for issue discovered on 31/03/08
+ * (Subtle difference in JASDL's BB#getRelevant operation meaning context's must be unified first)
+ if(relevant != null){
+ List<Plan> clones = new Vector<Plan>();
+ for(Plan plan : relevant){
+ if(plan.getContext() != null){
+ Plan clone = (Plan)plan.clone();
+ Unifier un = new Unifier();
+ un.unifiesNoUndo(clone.getTrigger(), te);
+ clone.getTrigger().getLiteral().apply(un);
+ clones.add(clone);
+ }else{
+ clones.add(plan);
+ }
+
+ }
+ relevant = clones;
+ }
+ */
+
return relevant;
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -43,6 +43,9 @@
this.agent = agent;
}
+
+
+ @Override
public Unifier isRelevant(Trigger te) {
Unifier un = super.isRelevant(te);
if(un != null){ // plan is specifically relevant to deal with the trigger
@@ -62,4 +65,9 @@
}
return null;
}
+
+ @Override
+ public Object clone(){
+ return new SEPlan(agent, (Plan)super.clone());
+ }
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -1,10 +1,15 @@
package jasdl.bb;
import jasdl.asSemantics.JasdlAgent;
+import jasdl.bb.revision.BeliefBaseContractor;
+import jasdl.bb.revision.JasdlIncisionFunction;
+import jasdl.bb.revision.JasdlReasonerFactory;
+import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
import jasdl.util.JasdlException;
import jasdl.util.NotEnrichedException;
+import jason.asSemantics.Unifier;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;
import jason.bb.DefaultBeliefBase;
@@ -18,6 +23,7 @@
import org.semanticweb.owl.model.AddAxiom;
import org.semanticweb.owl.model.OWLAnnotation;
+import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
import org.semanticweb.owl.model.OWLIndividual;
@@ -84,20 +90,44 @@
*/
@Override
public boolean remove(Literal l) {
- getLogger().fine("Removing "+l);
- try{
- // TODO: use contraction for belief base removal
- //BeliefBaseContractor contractor = new BeliefBaseContractor(agent.getOntologyManager(), new JasdlReasonerFactory(), agent.getLogger());
- //contractor.contract(axiom, kernelsetFilter, incisionFunction)
-
+ getLogger().fine("Contracting "+l);
+ try{
SELiteral sl = agent.getSELiteralFactory().create(l);
OWLOntology ontology = sl.getOntology();
- OWLIndividualAxiom axiom = sl.createAxiom();
- getLogger().fine("... as axiom: "+axiom);
- RemoveAxiom rem = new RemoveAxiom(ontology, axiom);
- agent.getOntologyManager().applyChange(rem);
+ OWLIndividualAxiom axiom = sl.createAxiom();
+
+ boolean result = false; // -> at least *something* must be removed for this to be true!
+
+ BeliefBaseContractor contractor = new BeliefBaseContractor(agent.getOntologyManager(), new JasdlReasonerFactory(), agent.getLogger());
+ List<OWLAxiom> contractList = contractor.contract(axiom, new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(agent, sl));
+
+ // NOTE: this technique only really makes sense with annotation gathering!
+ for(OWLAxiom contract : contractList){ // removals corresponds to l and all l's whose removal will undermine it
+
+ // for each annotation to this axiom, remove it if l has it
+ List<OWLAxiomAnnotationAxiom> annotationsToRemove = new Vector<OWLAxiomAnnotationAxiom>(); // to avoid concurrency issues
+ for(OWLAxiomAnnotationAxiom annotAxiom : contract.getAnnotationAxioms(ontology)){
+ Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
+ if(l.hasAnnot(annot)){
+ annotationsToRemove.add(annotAxiom);
+ result = true;
+ }
+ }
+
+ for(OWLAxiom annotationToRemove : annotationsToRemove){
+ agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, annotationToRemove));
+ }
+
+ // remove source(self) and source(percept). TODO: right thing to do?
+ // remove assertion if no annotation axioms left
+ Set<OWLAxiomAnnotationAxiom> remaining = contract.getAnnotationAxioms(ontology);
+ if(remaining.isEmpty()){
+ agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, contract));
+ result = true;
+ }
+ }
agent.getReasoner().refresh();
- return true;
+ return result;
}catch(NotEnrichedException e){
return super.remove(l); // semantically-naive, use standard Jason mechanisms
}catch(Exception e){
@@ -108,22 +138,19 @@
}
@Override
- public Literal contains(Literal l) {
+ public Literal contains(Literal l) {
+ agent.getLogger().fine("Contains: "+l);
try {
- // TODO: use OWLOntology#contains
- SELiteral sl = agent.getSELiteralFactory().create(l); // <- currently just to establish if semantically-enriched
- //OWLIndividualAxiom axiom = sl.createAxiom();
- //OWLAnnotation annot = agent.getOntologyManager().getOWLDataFactory().getOWLLabelAnnotation(sl.getSemanticallyNaiveAnnotations().toString()); //TODO: more efficient way of serialising list terms?
- //OWLAxiomAnnotationAxiom annotAxiom = agent.getOntologyManager().getOWLDataFactory().getOWLAxiomAnnotationAxiom(axiom, annot);
-
-
- Iterator<Literal> it = getRelevant(l);
- if(it.hasNext()){
- return it.next();
- }else{
- return null;
+ SELiteral sl = agent.getSELiteralFactory().create(l);
+ OWLIndividualAxiom axiom = sl.createAxiom();
+ if(sl.getOntology().containsAxiom(axiom)){
+ Iterator<Literal> it = getCandidateBeliefs(l, null);
+ if(it.hasNext()){
+ return it.next();
+ }
}
- }catch(NotEnrichedException e){
+ return null;
+ }catch(NotEnrichedException e){
return super.contains(l); // semantically-naive, use standard Jason mechanisms
}catch(Exception e){
getLogger().warning("Exception caught while checking if bb contains SELiteral "+l+". Reason: "+e);
@@ -134,8 +161,12 @@
@Override
- public Iterator<Literal> getRelevant(Literal l) {
+ public Iterator<Literal> getCandidateBeliefs(Literal l, Unifier un) {
+ l = (Literal)l.clone();
+ l.apply(un);
+
getLogger().fine("Getting relevancies for "+l);
+
Set<Literal> relevant = new HashSet<Literal>();
try{
SELiteral sl = agent.getSELiteralFactory().create(l);
@@ -160,8 +191,13 @@
}
getLogger().fine("... found: "+relevant);
+ if(relevant.isEmpty()){
+ return null;
+ }
+
+
}catch(NotEnrichedException e){
- return super.getRelevant(l); // semantically-naive, use standard Jason mechanisms
+ return super.getCandidateBeliefs(l, un); // semantically-naive, use standard Jason mechanisms
}catch(Exception e){
getLogger().warning("Exception caught getting relevancies for SELiteral "+l+" to belief base: ");
e.printStackTrace();
Deleted: trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java 2008-03-31 21:10:53 UTC (rev 1184)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -1,92 +0,0 @@
-package jasdl.bb.revision;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-import java.util.logging.Logger;
-
-import org.semanticweb.owl.inference.OWLReasoner;
-import org.semanticweb.owl.inference.OWLReasonerException;
-import org.semanticweb.owl.model.AddAxiom;
-import org.semanticweb.owl.model.OWLAxiom;
-import org.semanticweb.owl.model.OWLDescription;
-import org.semanticweb.owl.model.OWLOntology;
-import org.semanticweb.owl.model.OWLOntologyChange;
-import org.semanticweb.owl.model.OWLOntologyChangeException;
-import org.semanticweb.owl.model.OWLOntologyCreationException;
-import org.semanticweb.owl.model.OWLOntologyManager;
-import org.semanticweb.owl.model.UnknownOWLOntologyException;
-
-import com.clarkparsia.explanation.BlackBoxExplanation;
-import com.clarkparsia.explanation.HSTExplanationGenerator;
-import com.clarkparsia.explanation.ReasonerFactory;
-import com.clarkparsia.explanation.SatisfiabilityConverter;
-
-public class BeliefBaseRevisor extends IsolatedOntologyOperation {
-
- private Logger logger;
- private OWLAxiom toAdd;
-
- public BeliefBaseRevisor(OWLAxiom toAdd, OWLOntologyManager originalManager, ReasonerFactory reasonerFactory, Logger logger) throws UnknownOWLOntologyException, OWLOntologyCreationException, OWLOntologyChangeException, OWLReasonerException{
- super(originalManager, reasonerFactory);
- this.logger = logger;
- // unfortunately, this needs to be done here (not in .revise)
- // since JASDL (specifically) needs to annotate this axiom
- this.toAdd = toAdd;
- isolatedOntologyManager.applyChange(new AddAxiom(isolatedOntology, toAdd));
- }
-
- public List<OWLAxiom>[] revise(KernelsetFilter kernelsetFilter, IncisionFunction incisionFunction){
- List<OWLAxiom> addList = new Vector<OWLAxiom>();
- List<OWLAxiom> delList = new Vector<OWLAxiom>();
- try {
- isolatedReasoner.classify();
-
- if(isolatedReasoner.isConsistent(isolatedOntology)){
- addList.add(toAdd);
- }else{
- Set<Set<OWLAxiom>> kernelset = applyKernelOperator(toAdd, isolatedOntologyManager, isolatedOntology, isolatedReasoner, reasonerFactory);
- kernelset = kernelsetFilter.apply(kernelset);
- log("Explanation of inconsistency: "+kernelset);
- BeliefBaseContractor contractor = new BeliefBaseContractor(isolatedOntologyManager, reasonerFactory, logger);
- List<OWLAxiom> contracted = contractor.contract(incisionFunction.apply(kernelset), kernelsetFilter, incisionFunction);
-
-
- if(!contracted.contains(toAdd)){
- addList.add(toAdd); // remember, toAdd is not in original ontology so need to remove if it has been contracted
- }
- delList.addAll(contracted);
- }
-
-
- } catch (Exception e) {
- logger.warning("Revision failed. Reason: ");
- e.printStackTrace();
- }
-
- return new List[] {addList, delList};
- }
-
-
- private Set<Set<OWLAxiom>> applyKernelOperator(OWLAxiom a, OWLOntologyManager ontologyManager, OWLOntology ontology, OWLReasoner reasoner, ReasonerFactory reasonerFactory){
- SatisfiabilityConverter satcon = new SatisfiabilityConverter(ontologyManager.getOWLDataFactory());
- OWLDescription description = ontologyManager.getOWLDataFactory().getOWLObjectComplementOf(satcon.convert(a));
- BlackBoxExplanation bbgen = new BlackBoxExplanation(ontologyManager);
- HSTExplanationGenerator hstgen = new HSTExplanationGenerator(bbgen);
- hstgen.setOntology(ontology);
- hstgen.setReasoner(reasoner);
- hstgen.setReasonerFactory(reasonerFactory);
- return hstgen.getExplanations(description);
- }
-
-
- private void log(String msg){
- if(logger != null){
- logger.fine(msg);
- }
- }
-
-
-
-}
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseSemiRevisor.java (from rev 1172, trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseRevisor.java)
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseSemiRevisor.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/BeliefBaseSemiRevisor.java 2008-03-31 21:56:43 UTC (rev 1185)
@@ -0,0 +1,92 @@
+package jasdl.bb.revision;
+
+import jason.RevisionFailedException;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+import java.util.logging.Logger;
+
+import org.semanticweb.owl.inference.OWLReasonerException;
+import org.semanticweb.owl.model.AddAxiom;
+import org.semanticweb.owl.model.OWLAxiom;
+import org.semanticweb.owl.model.OWLException;
+import org.semanticweb.owl.model.OWLOntologyChangeException;
+import org.semanticweb.owl.model.OWLOntologyCreationException;
+import org.semanticweb.owl.model.OWLOntologyManager;
+import org.semanticweb.owl.model.UnknownOWLOntologyException;
+
+import com.clarkparsia.explanation.BlackBoxExplanation;
+import com.clarkparsia.explanation.HSTExplanationGenerator;
+import com.clarkparsia.explanation.ReasonerFactory;
+import com.clarkparsia.explanation.io.ConciseExplanationRenderer;
+
+public class BeliefBaseSemiRevisor extends IsolatedOntologyOperation {
+
+ private Logger logger;
+ private OWLAxiom toAdd;
+
+
+ public BeliefBaseSemiRevisor(OWLAxiom toAdd, OWLOntologyManager originalManager, ReasonerFactory reasonerFactory, Logger logger) throws UnknownOWLOntologyException, OWLOntologyCreationException, OWLOntologyChangeException, OWLReasonerException{
+ super(originalManager, reasonerFactory);
+ this.logger = logger;
+ this.toAdd = toAdd;
+ }
+
+ public List<OWLAxiom> revise(KernelsetFilter kernelsetFilter, IncisionFunction incisionFunction) throws RevisionFailedException, OWLReasonerException, OWLOntologyChangeException{
+ isolatedOntologyManager.applyChange(new AddAxiom(isolatedOntology, toAdd));
+ isolatedReasoner....
[truncated message content] |
|
From: <tom...@us...> - 2008-04-01 00:59:37
|
Revision: 1186
http://jason.svn.sourceforge.net/jason/?rev=1186&view=rev
Author: tomklapiscak
Date: 2008-03-31 17:59:33 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Generalised to support any DL-reasoner supported by the OWL-API (can be set using jasdl_reasonerClass="..."). FACT++ support very buggy (and seemingly no faster), will stick to Pellet for the time being.
Minor performance enhancements (SE-Literal caches results of operations and brf doesn't validate removals generated by the BB revisor).
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/lib/FaCTpp-OWLAPI-v1.1.11.jar
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-01 00:59:33 UTC (rev 1186)
@@ -33,6 +33,13 @@
[
jasdl_useBeliefRevision = "true", // use experimental DL-based belief revision mechanism
+ /*
+ * To use FaCT++, set the below. Must have libFaCTPlusPlusJNI.so in /usr/lib (or the equivalent for Mac or Windows)
+ * FaCT++ support is buggy and incomplete. Defaults to Pellet (org.mindswap.pellet.owlapi.Reasoner), which seems to work
+ * must better
+ * jasdl_reasonerClass = "uk.ac.manchester.cs.factplusplus.owlapi.Reasoner",
+ */
+
jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
jasdl_ontologies="travel",
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-04-01 00:59:33 UTC (rev 1186)
@@ -3,12 +3,10 @@
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
- <!ENTITY dc "http://purl.org/dc/elements/1.1/" >
<!ENTITY owl11 "http://www.w3.org/2006/12/owl11#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY owl11xml "http://www.w3.org/2006/12/owl11-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
- <!ENTITY daml "http://www.daml.org/2001/03/daml+oil#" >
<!ENTITY travel "http://www.owl-ontologies.com/travel.owl#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
@@ -16,15 +14,13 @@
<rdf:RDF xmlns="http://www.owl-ontologies.com/travel.owl#"
xml:base="http://www.owl-ontologies.com/travel.owl"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl11="http://www.w3.org/2006/12/owl11#"
xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:daml="http://www.daml.org/2001/03/daml+oil#"
- xmlns:travel="http://www.owl-ontologies.com/travel.owl#"
- xmlns:owl="http://www.w3.org/2002/07/owl#">
+ xmlns:travel="http://www.owl-ontologies.com/travel.owl#">
<owl:Ontology rdf:about="">
<owl:versionInfo rdf:datatype="&xsd;string"
>1.0 by Holger Knublauch (ho...@sm...)</owl:versionInfo>
@@ -58,9 +54,9 @@
<!-- http://www.owl-ontologies.com/travel.owl#hasActivity -->
<owl:ObjectProperty rdf:about="#hasActivity">
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:range rdf:resource="#Activity"/>
<rdfs:domain rdf:resource="#Destination"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<owl:inverseOf rdf:resource="#isOfferedAt"/>
</owl:ObjectProperty>
@@ -69,9 +65,9 @@
<!-- http://www.owl-ontologies.com/travel.owl#hasContact -->
<owl:ObjectProperty rdf:about="#hasContact">
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:domain rdf:resource="#Activity"/>
<rdfs:range rdf:resource="#Contact"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -79,8 +75,8 @@
<!-- http://www.owl-ontologies.com/travel.owl#hasDestination -->
<owl:ObjectProperty rdf:about="#hasDestination">
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:range rdf:resource="#Destination"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -90,8 +86,8 @@
<owl:ObjectProperty rdf:about="#hasPart">
<rdf:type rdf:resource="&owl;TransitiveProperty"/>
<rdfs:domain rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:range rdf:resource="#Destination"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -116,10 +112,10 @@
<!-- http://www.owl-ontologies.com/travel.owl#isLocatedAt -->
<owl:ObjectProperty rdf:about="#isLocatedAt">
- <owl:inverseOf rdf:resource="#hasAccommodation"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:domain rdf:resource="#Accommodation"/>
<rdfs:range rdf:resource="#Destination"/>
+ <owl:inverseOf rdf:resource="#hasAccommodation"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -127,11 +123,11 @@
<!-- http://www.owl-ontologies.com/travel.owl#isOfferedAt -->
<owl:ObjectProperty rdf:about="#isOfferedAt">
- <rdfs:range rdf:resource="#Destination"/>
<rdfs:comment
>Generalised to apply to accommodations as well</rdfs:comment>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<rdfs:domain rdf:resource="#Activity"/>
+ <rdfs:range rdf:resource="#Destination"/>
+ <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -139,10 +135,10 @@
<!-- http://www.owl-ontologies.com/travel.owl#isPartOf -->
<owl:ObjectProperty rdf:about="#isPartOf">
- <owl:inverseOf rdf:resource="#hasPart"/>
+ <rdfs:domain rdf:resource="#Destination"/>
<rdfs:range rdf:resource="#Destination"/>
+ <owl:inverseOf rdf:resource="#hasPart"/>
<rdfs:subPropertyOf rdf:resource="#hasThing"/>
- <rdfs:domain rdf:resource="#Destination"/>
</owl:ObjectProperty>
@@ -161,9 +157,9 @@
<!-- http://www.owl-ontologies.com/travel.owl#hasCity -->
<owl:DatatypeProperty rdf:about="#hasCity">
+ <rdfs:domain rdf:resource="#Contact"/>
<rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
- <rdfs:domain rdf:resource="#Contact"/>
</owl:DatatypeProperty>
@@ -174,22 +170,13 @@
- <!-- http://www.owl-ontologies.com/travel.owl#hasDuration -->
-
- <owl:DatatypeProperty rdf:about="#hasDuration">
- <rdfs:range rdf:resource="&xsd;duration"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
- </owl:DatatypeProperty>
-
-
-
<!-- http://www.owl-ontologies.com/travel.owl#hasEMail -->
<owl:DatatypeProperty rdf:about="#hasEMail">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:domain rdf:resource="#Contact"/>
<rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
- <rdfs:domain rdf:resource="#Contact"/>
</owl:DatatypeProperty>
@@ -198,30 +185,21 @@
<owl:DatatypeProperty rdf:about="#hasPricePerNight">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:comment
>Stated in local currency</rdfs:comment>
<rdfs:domain rdf:resource="#Accommodation"/>
+ <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;double"/>
</owl:DatatypeProperty>
- <!-- http://www.owl-ontologies.com/travel.owl#hasStartDate -->
-
- <owl:DatatypeProperty rdf:about="#hasStartDate">
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
- <rdfs:range rdf:resource="&xsd;dateTime"/>
- </owl:DatatypeProperty>
-
-
-
<!-- http://www.owl-ontologies.com/travel.owl#hasStreet -->
<owl:DatatypeProperty rdf:about="#hasStreet">
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:range rdf:resource="&xsd;string"/>
<rdfs:subPropertyOf rdf:resource="#hasData"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
@@ -231,8 +209,8 @@
<owl:DatatypeProperty rdf:about="#hasZipCode">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:range rdf:resource="&xsd;string"/>
<rdfs:subPropertyOf rdf:resource="#hasData"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
@@ -260,8 +238,10 @@
<!-- http://www.owl-ontologies.com/travel.owl#AccommodationRating -->
<owl:Class rdf:about="#AccommodationRating">
- <owl:disjointWith rdf:resource="#Destination"/>
<owl:disjointWith rdf:resource="#Accommodation"/>
+ <owl:disjointWith rdf:resource="#Activity"/>
+ <owl:disjointWith rdf:resource="#Contact"/>
+ <owl:disjointWith rdf:resource="#Destination"/>
<rdfs:comment rdf:datatype="&xsd;string"
>Consists of exactly three individuals.</rdfs:comment>
</owl:Class>
@@ -272,7 +252,6 @@
<owl:Class rdf:about="#Activity">
<owl:disjointWith rdf:resource="#Accommodation"/>
- <owl:disjointWith rdf:resource="#AccommodationRating"/>
</owl:Class>
@@ -281,7 +260,6 @@
<owl:Class rdf:about="#Adventure">
<rdfs:subClassOf rdf:resource="#Activity"/>
- <owl:disjointWith rdf:resource="#Sports"/>
</owl:Class>
@@ -297,17 +275,17 @@
<owl:someValuesFrom>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
- <rdf:Description rdf:about="#Adventure"/>
<rdf:Description rdf:about="#Sports"/>
+ <rdf:Description rdf:about="#Adventure"/>
</owl:unionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
+ <rdf:Description rdf:about="#Destination"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasAccommodation"/>
<owl:someValuesFrom rdf:resource="#BudgetAccommodation"/>
</owl:Restriction>
- <rdf:Description rdf:about="#Destination"/>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
@@ -329,6 +307,7 @@
<owl:Class rdf:about="#BedAndBreakfast">
<rdfs:subClassOf rdf:resource="#Accommodation"/>
+ <owl:disjointWith rdf:resource="#Hotel"/>
</owl:Class>
@@ -343,11 +322,11 @@
<owl:unionOf rdf:parseType="Collection">
<owl:Restriction>
<owl:onProperty rdf:resource="#hasRating"/>
- <owl:hasValue rdf:resource="#OneStarRating"/>
+ <owl:hasValue rdf:resource="#TwoStarRating"/>
</owl:Restriction>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasRating"/>
- <owl:hasValue rdf:resource="#TwoStarRating"/>
+ <owl:hasValue rdf:resource="#OneStarRating"/>
</owl:Restriction>
</owl:unionOf>
</owl:Class>
@@ -437,10 +416,8 @@
<!-- http://www.owl-ontologies.com/travel.owl#Contact -->
<owl:Class rdf:about="#Contact">
- <owl:disjointWith rdf:resource="#Activity"/>
<owl:disjointWith rdf:resource="#Accommodation"/>
- <owl:disjointWith rdf:resource="#Destination"/>
- <owl:disjointWith rdf:resource="#AccommodationRating"/>
+ <owl:disjointWith rdf:resource="#Activity"/>
</owl:Class>
@@ -457,7 +434,9 @@
<!-- http://www.owl-ontologies.com/travel.owl#Destination -->
- <owl:Class rdf:about="#Destination"/>
+ <owl:Class rdf:about="#Destination">
+ <owl:disjointWith rdf:resource="#Contact"/>
+ </owl:Class>
@@ -467,6 +446,7 @@
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
+ <rdf:Description rdf:about="#Destination"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasAccommodation"/>
<owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
@@ -475,7 +455,6 @@
<owl:onProperty rdf:resource="#hasActivity"/>
<owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:minCardinality>
</owl:Restriction>
- <rdf:Description rdf:about="#Destination"/>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
@@ -505,7 +484,6 @@
<owl:Class rdf:about="#Hotel">
<rdfs:subClassOf rdf:resource="#Accommodation"/>
- <owl:disjointWith rdf:resource="#BedAndBreakfast"/>
</owl:Class>
@@ -516,11 +494,11 @@
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
- <rdf:Description rdf:about="#Hotel"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasRating"/>
<owl:hasValue rdf:resource="#ThreeStarRating"/>
</owl:Restriction>
+ <rdf:Description rdf:about="#Hotel"/>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
@@ -541,6 +519,7 @@
<!-- http://www.owl-ontologies.com/travel.owl#NationalPark -->
<owl:Class rdf:about="#NationalPark">
+ <rdfs:subClassOf rdf:resource="#Destination"/>
<rdfs:subClassOf rdf:resource="#RuralArea"/>
<rdfs:subClassOf>
<owl:Restriction>
@@ -554,7 +533,6 @@
<owl:someValuesFrom rdf:resource="#Hiking"/>
</owl:Restriction>
</rdfs:subClassOf>
- <rdfs:subClassOf rdf:resource="#Destination"/>
</owl:Class>
@@ -582,8 +560,6 @@
<owl:Class rdf:about="#Relaxation">
<rdfs:subClassOf rdf:resource="#Activity"/>
- <owl:disjointWith rdf:resource="#Sports"/>
- <owl:disjointWith rdf:resource="#Sightseeing"/>
<owl:disjointWith rdf:resource="#Adventure"/>
</owl:Class>
@@ -603,7 +579,6 @@
<owl:Class rdf:about="#RuralArea">
<rdfs:subClassOf rdf:resource="#Destination"/>
- <owl:disjointWith rdf:resource="#UrbanArea"/>
</owl:Class>
@@ -620,8 +595,8 @@
<owl:Class rdf:about="#Sightseeing">
<rdfs:subClassOf rdf:resource="#Activity"/>
- <owl:disjointWith rdf:resource="#Sports"/>
<owl:disjointWith rdf:resource="#Adventure"/>
+ <owl:disjointWith rdf:resource="#Relaxation"/>
</owl:Class>
@@ -630,6 +605,9 @@
<owl:Class rdf:about="#Sports">
<rdfs:subClassOf rdf:resource="#Activity"/>
+ <owl:disjointWith rdf:resource="#Adventure"/>
+ <owl:disjointWith rdf:resource="#Relaxation"/>
+ <owl:disjointWith rdf:resource="#Sightseeing"/>
</owl:Class>
@@ -662,6 +640,7 @@
<owl:Class rdf:about="#UrbanArea">
<rdfs:subClassOf rdf:resource="#Destination"/>
+ <owl:disjointWith rdf:resource="#RuralArea"/>
</owl:Class>
@@ -728,8 +707,8 @@
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
+ <rdf:Description rdf:about="#OneStarRating"/>
<rdf:Description rdf:about="#ThreeStarRating"/>
- <rdf:Description rdf:about="#TwoStarRating"/>
</owl:distinctMembers>
</rdf:Description>
<rdf:Description>
@@ -743,7 +722,7 @@
<rdf:type rdf:resource="&owl;AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
<rdf:Description rdf:about="#ThreeStarRating"/>
- <rdf:Description rdf:about="#OneStarRating"/>
+ <rdf:Description rdf:about="#TwoStarRating"/>
</owl:distinctMembers>
</rdf:Description>
</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-01 00:59:33 UTC (rev 1186)
@@ -18,15 +18,29 @@
*
*/
-!example_UBB_1.
-!example_UBB_2.
-!example_QBB.
-!example_RPP.
-!example_all_different.
+!start(total).
+!start(ubb1).!example_UBB_1.!end(ubb1).
+!start(ubb2).!example_UBB_2.!end(ubb2).
+!start(qbb).!example_QBB.!end(qbb).
+!start(rpp).!example_RPP.!end(rpp).
+!start(all_different).!example_all_different.!end(all_different).
//!example_annotation_gathering.
-!example_KSAA.
+!start(ksaa).!example_KSAA.!end(ksaa).
+//!end(total) is within example_KSAA_complete to allow inter-agent communication to finish
+@start[atomic]
++!start(A)
+ <-
+ +counter(A, system.time).
+@end[atomic]
++!end(A)
+ <-
+ ?counter(A, StartTime);
+ -counter(A, _);
+ TotalTime = (system.time - StartTime) / 1000;
+ .print("Execution time for counter ",A,": ",TotalTime,"s").
+
@example_ubb_1[atomic]
+!example_UBB_1
<-
@@ -130,10 +144,7 @@
?H;
?bundle(R).
-@example_KSAA_complete[atomic]
-+example_KSAA_complete
- <-
- .print("Completed: Knowledge Sharing Among Agents").
+
/**
@@ -181,6 +192,13 @@
?familyDestination(butlins)[o(travel), something];
.print("Complete: annotation gathering").
+
+
+@example_KSAA_complete[atomic]
++example_KSAA_complete
+ <-
+ .print("Completed: Knowledge Sharing Among Agents");
+ !end(total).
Added: trunk/applications/jasdl-owlapi/lib/FaCTpp-OWLAPI-v1.1.11.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/FaCTpp-OWLAPI-v1.1.11.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-01 00:59:33 UTC (rev 1186)
@@ -52,9 +52,10 @@
import jmca.asSemantics.JmcaAgent;
import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxDescriptionParser;
-import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
+import org.semanticweb.owl.inference.OWLReasoner;
+import org.semanticweb.owl.inference.OWLReasonerException;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLDescription;
@@ -71,9 +72,10 @@
public class JasdlAgent extends JmcaAgent{
public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMappingStrategy()} );
+ public static String DEFAULT_REASONER_CLASS = "org.mindswap.pellet.owlapi.Reasoner";
private OWLOntologyManager ontologyManager;
- private Reasoner reasoner;
+ private OWLReasoner reasoner;
private AliasManager aliasManager;
private LabelManager labelManager;
private SELiteralFactory seLiteralFactory;
@@ -129,19 +131,15 @@
manchesterNsPrefixDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixEntityChecker(this));
manchesterURIDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new URIEntityChecker(this));
- // instantiate (Pellet) reasoner
- PelletOptions.USE_TRACING = true;
- reasoner = new Reasoner(ontologyManager);
- reasoner.getKB().setDoExplanation( true );
-
// override plan library
setPL( new JasdlPlanLibrary(this) );
}
+ public void setReasoner(OWLReasoner reasoner){
+ this.reasoner = reasoner;
+ }
-
-
@Override
public TransitionSystem initAg(AgArch arch, BeliefBase bb, String src, Settings stts) throws JasonException {
if(!(bb instanceof JasdlBeliefBase)){
@@ -201,6 +199,9 @@
List<Literal> addList = new Vector<Literal>();
List<Literal> removeList = new Vector<Literal>();
+ // For efficiency reasons: no need to check beliefs to be contracted if established by BB revisor (since they are implicitly grounded)
+ boolean revisionApplied = false;
+
// just accept beliefToDel. Assumption: Deletions never lead to inconsistencies?!
if(beliefToDel != null){
getLogger().finest("Revise: -"+beliefToDel);
@@ -218,6 +219,7 @@
for(OWLAxiom contract : contractList){
removeList.add(toSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
}
+ revisionApplied = true;
}catch(RevisionFailedException e){
throw e; // propagate upwards
}catch(NotEnrichedException e){
@@ -235,23 +237,28 @@
// Need to perform removals before additions so our ontology instance never becomes inconsistent
for(Literal removed : removeList){
- // we need to ground unground removals
- Unifier u = null;
- try {
- u = i.peek().getUnif(); // get from current intention
- } catch (Exception e) {
- u = new Unifier();
- }
- if (believes(removed, u)) {
- removed.apply(u);
+ boolean ok = false;
+ if(revisionApplied){
+ ok = true;
+ }else{
+ // we need to ground unground removals
+ Unifier u = null;
+ try {
+ u = i.peek().getUnif(); // get from current intention
+ } catch (Exception e) {
+ u = new Unifier();
+ }
+ ok = believes(removed, u);
+ if(ok) removed.apply(u);
+ }
+ if(ok){
if(getBB().remove(removed)){
if(toReturn == null){
toReturn = new List[2];
toReturn[0] = new Vector<Literal>();
toReturn[1] = new Vector<Literal>();
}
- toReturn[1].add(removed);
-
+ toReturn[1].add(removed);
}
}
}
@@ -382,8 +389,12 @@
return alreadyKnown;
}catch(UnknownMappingException e){}
Set<OWLOntology> imports = ontologyManager.getImportsClosure(ontology);
- reasoner.loadOntologies(imports);
- reasoner.classify();
+ try {
+ reasoner.loadOntologies(imports);
+ reasoner.classify();
+ } catch (OWLReasonerException e) {
+ throw new JasdlException("Unable to load "+uri+". Reason: "+e);
+ }
initOntology(ontology, label, uri, ontology.getURI(), false); // (successfully) loaded ontologies never personal
applyMappingStrategies(ontology, strategies);
getLogger().fine("Loaded ontology from "+uri+" and assigned label "+label);
@@ -409,7 +420,11 @@
public OWLOntology createOntology(Atom label, URI uri, boolean isPersonal) throws JasdlException{
try{
OWLOntology ontology = getOntologyManager().createOntology( uri );
- getReasoner().loadOntology(ontology);
+ try{
+ getReasoner().loadOntologies(Collections.singleton(ontology));
+ } catch (OWLReasonerException e) {
+ throw new JasdlException("Unable to load "+uri+". Reason: "+e);
+ }
initOntology(ontology, label, uri, uri, isPersonal);
return ontology;
} catch (OWLOntologyCreationException e) {
@@ -513,14 +528,30 @@
} catch (OWLOntologyChangeException e) {
throw new JasdlException("Error adding "+uri+" naming of "+desc+" to "+label);
}
- reasoner.refresh();
getLogger().fine("Adding named class "+uri+" for "+desc+" in "+label);
getAliasManager().put(alias, naming); // consequence, we can no longer easily distinguish run-time defined classes from pre-defined - need to maintain a map
getDefinitionManager().put(naming, desc);
+
+ refreshReasoner();
+
getLogger().fine("Defined new class with alias "+alias);
return desc;
}
+ public void refreshReasoner() throws JasdlException{
+ try {
+ if(reasoner instanceof uk.ac.manchester.cs.factplusplus.owlapi.Reasoner){
+ ((uk.ac.manchester.cs.factplusplus.owlapi.Reasoner)reasoner).classify();
+ }else if(reasoner instanceof org.mindswap.pellet.owlapi.Reasoner){
+ ((org.mindswap.pellet.owlapi.Reasoner)reasoner).refresh();
+ }else{
+ reasoner.classify();
+ }
+ } catch (OWLReasonerException e) {
+ throw new JasdlException("Unable to refresh reasoner. Reason: "+e);
+ }
+ }
+
/**
* *Must* be unique within society!
* @return
@@ -581,7 +612,7 @@
- public Reasoner getReasoner() {
+ public OWLReasoner getReasoner() {
return reasoner;
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-01 00:59:33 UTC (rev 1186)
@@ -2,7 +2,6 @@
import static jasdl.util.Common.DELIM;
import static jasdl.util.Common.strip;
-import jasdl.bridge.AllDifferentPlaceholder;
import jasdl.bridge.alias.Alias;
import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.alias.MappingStrategy;
@@ -16,20 +15,24 @@
import java.util.List;
import java.util.Vector;
+import org.semanticweb.owl.inference.OWLReasoner;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLOntology;
+import org.semanticweb.owl.model.OWLOntologyManager;
public class JasdlConfigurator {
private static String MAS2J_PREFIX = "jasdl";
private static String MAS2J_ONTOLOGIES = "_ontologies";
private static String MAS2J_URI = "_uri";
private static String MAS2J_MAPPING_STRATEGIES = "_mapping_strategies";
- private static String MAS2J_MAPPING_MANUAL = "_mapping_manual";
- private static String MAS2J_AGENT_NAME = "_agent_name";
+ private static String MAS2J_MAPPING_MANUAL = "_mapping_manual";
private static String MAS2J_TRUSTRATING = "_trustRating";
private static String MAS2J_KNOWNAGENTS = "_knownAgents";
private static String MAS2J_USEBELIEFREVISION = "_useBeliefRevision";
+ private static String MAS2J_REASONERCLASS = "_reasonerClass";
+
+
/**
* List of reserved ontology labels. Currently:
* <ul>
@@ -41,6 +44,8 @@
public static List<Atom> reservedOntologyLabels = Arrays.asList( new Atom[] {new Atom("default"), new Atom("self")});
+
+
private JasdlAgent agent;
public JasdlConfigurator(JasdlAgent agent){
@@ -49,6 +54,8 @@
public void configure(Settings stts) throws JasdlException{
try{
+ loadReasoner(stts);
+
// load default mapping strategies
agent.setDefaultMappingStrategies(getMappingStrategies(stts, new Atom("default"))); //implication "default" is a reserved ontology label
@@ -67,6 +74,26 @@
}
}
+ private void loadReasoner(Settings stts) throws JasdlException{
+ String reasonerClass = prepareUserParameter( stts, MAS2J_PREFIX + MAS2J_REASONERCLASS);
+ if(reasonerClass.length() == 0){
+ reasonerClass = JasdlAgent.DEFAULT_REASONER_CLASS;
+ }
+ try {
+ Class cls = Class.forName(reasonerClass);
+ Constructor ct = cls.getConstructor(new Class[] {OWLOntologyManager.class});
+ OWLReasoner reasoner = (OWLReasoner)ct.newInstance(new Object[] {agent.getOntologyManager()});
+ if(reasoner == null){
+ throw new JasdlException("Unknown reasoner class: "+reasonerClass);
+ }else{
+ agent.setReasoner(reasoner);
+ }
+ }catch (Throwable e) {
+ throw new JasdlException("Error instantiating reasoner "+reasonerClass+". Reason: "+e);
+ }
+ }
+
+
/**
* Load ontologies as specified in .mas2j settings
* @param stts .mas2j settings
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-03-31 21:56:43 UTC (rev 1185)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-04-01 00:59:33 UTC (rev 1186)
@@ -36,6 +36,7...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-01 23:33:24
|
Revision: 1188
http://jason.svn.sourceforge.net/jason/?rev=1188&view=rev
Author: tomklapiscak
Date: 2008-04-01 16:33:22 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
Started work on new jasdl.test package. Far more comprehensive JasdlBeliefBase implemented (matches behaviour against Jason's default).
Bug fixes.
Agent configuration improvement.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/build.xml
trunk/applications/jasdl-owlapi/lib/junit.jar
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/test/
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/test/blank.asl
trunk/applications/jasdl-owlapi/src/jasdl/util/JasdlConfigurationException.java
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-04-01 16:15:10 UTC (rev 1187)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-04-01 23:33:22 UTC (rev 1188)
@@ -1,16 +1,16 @@
<project basedir="." default="jar" name="jasdl">
- <property name="source.dir" value="${basedir}/src" />
+ <property name="source.dir" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/bin" />
- <property name="apidocs.dir" value="${basedir}/doc/api" />
+ <property name="apidocs.dir" value="${basedir}/doc/api" />
<property name="jar.file" value="${basedir}/lib/jasdl.jar" />
-
- <path id="project.classpath">
+
+ <path id="project.classpath">
<pathelement location="../../lib/jason.jar"/>
<pathelement location="../../applications/jmca/lib/jmca.jar"/>
<fileset dir="./lib">
<include name="**/*.jar"/>
- </fileset>
+ </fileset>
</path>
<path id="test.classpath">
@@ -21,18 +21,18 @@
<target name="init">
<tstamp/>
<mkdir dir="${build.dir}"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5">
- <classpath refid="project.classpath" />
- </javac>
- </target>
-
- <target name="jar" depends="compile">
- <jar destfile="${jar.file}" basedir="./bin" includes="**/*.class"/>
</target>
+ <target name="compile" depends="init">
+ <javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5">
+ <classpath refid="project.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <jar destfile="${jar.file}" basedir="./bin" includes="**/*.class"/>
+ </target>
+
<target name="clean">
<delete dir="${build.dir}"/>
<delete file="${jar.file}"/>
@@ -45,7 +45,7 @@
<classpath refid="test.classpath" />
<formatter type="plain" usefile="false" />
<batchtest>
- <fileset dir="${source.dir}/jasdl/test" includes="*Test.java" />
+ <fileset dir="${source.dir}" includes="jasdl/test/*Test.java" />
</batchtest>
</junit>
<fail message="test failed" if="test.failure" />
@@ -66,5 +66,5 @@
</javadoc>
</target>
-
+
</project>
Modified: trunk/applications/jasdl-owlapi/lib/junit.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-01 16:15:10 UTC (rev 1187)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-01 23:33:22 UTC (rev 1188)
@@ -15,7 +15,6 @@
import jasdl.bridge.alias.Alias;
import jasdl.bridge.alias.AliasFactory;
import jasdl.bridge.alias.AliasManager;
-import jasdl.bridge.alias.DecapitaliseMappingStrategy;
import jasdl.bridge.alias.DefinitionManager;
import jasdl.bridge.alias.MappingStrategy;
import jasdl.bridge.label.LabelManager;
@@ -41,7 +40,6 @@
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -51,6 +49,7 @@
import jmca.asSemantics.JmcaAgent;
+import org.apache.commons.logging.impl.Log4JLogger;
import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxDescriptionParser;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.apibinding.OWLManager;
@@ -71,9 +70,8 @@
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
public class JasdlAgent extends JmcaAgent{
- public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMappingStrategy()} );
- public static String DEFAULT_REASONER_CLASS = "org.mindswap.pellet.owlapi.Reasoner";
+
private OWLOntologyManager ontologyManager;
private OWLReasoner reasoner;
private AliasManager aliasManager;
@@ -86,24 +84,23 @@
private ManchesterOWLSyntaxOWLObjectRendererImpl manchesterObjectRenderer;
private ManchesterOWLSyntaxDescriptionParser manchesterNsPrefixDescriptionParser;
- private ManchesterOWLSyntaxDescriptionParser manchesterURIDescriptionParser;
+ private ManchesterOWLSyntaxDescriptionParser manchesterURIDescriptionParser;
- private List<MappingStrategy> defaultMappingStrategies;
public static String ANON_LABEL_PREFIX = "anon_label_";
public static String ANON_ALIAS_PREFIX = "anon_alias_";
private DefinitionManager definitionManager;
+ private List<String> knownAgentNames;
private HashMap<Atom, Float> trustMap;
- private boolean beliefRevisionEnabled = true;
-
+ private boolean beliefRevisionEnabled;
+ private List<MappingStrategy> defaultMappingStrategies = JasdlConfigurator.DEFAULT_MAPPING_STRATEGIES;
public JasdlAgent(){
super();
- defaultMappingStrategies = DEFAULT_MAPPING_STRATEGIES;
// instantiate managers
aliasManager = new AliasManager();
@@ -117,6 +114,7 @@
toAxiomConverter = new ToAxiomConverter(this);
toSELiteralConverter = new ToSELiteralConverter(this);
+ knownAgentNames = new Vector<String>();
trustMap = new HashMap<Atom, Float>();
manchesterObjectRenderer = new ManchesterOWLSyntaxOWLObjectRendererImpl();
@@ -133,13 +131,38 @@
// override plan library
setPL( new JasdlPlanLibrary(this) );
+
}
public void setReasoner(OWLReasoner reasoner){
this.reasoner = reasoner;
}
+ public void addKnownAgentName(String name){
+ knownAgentNames.add(name);
+ }
+ public List<String> getKnownAgentNames(){
+ return knownAgentNames;
+ }
+
+
+ public void setReasonerLogLevel(org.apache.log4j.Level level){
+ if(reasoner instanceof org.mindswap.pellet.owlapi.Reasoner){
+ org.mindswap.pellet.owlapi.Reasoner pellet = (org.mindswap.pellet.owlapi.Reasoner)reasoner;
+ Log4JLogger abox_logger = (Log4JLogger)pellet.getKB().getABox().log;
+ abox_logger.getLogger().setLevel(level);
+
+ Log4JLogger taxonomy_logger = (Log4JLogger)pellet.getKB().getTaxonomy().log;
+ taxonomy_logger.getLogger().setLevel(level);
+
+ Log4JLogger kb_logger = (Log4JLogger)pellet.getKB().log;
+ kb_logger.getLogger().setLevel(level);
+ }
+ }
+
+
+
@Override
public TransitionSystem initAg(AgArch arch, BeliefBase bb, String src, Settings stts) throws JasonException {
if(!(bb instanceof JasdlBeliefBase)){
@@ -582,7 +605,7 @@
}
public URI getPersonalOntologyURI(Atom label) {
- return URI.create("http://www.dur.ac.uk/t.g.klapiscak/"+label+".owl");
+ return URI.create("http://www.dur.ac.uk/t.g.klapiscak/self"+label+".owl");
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-01 16:15:10 UTC (rev 1187)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-01 23:33:22 UTC (rev 1188)
@@ -4,7 +4,9 @@
import static jasdl.util.Common.strip;
import jasdl.bridge.alias.Alias;
import jasdl.bridge.alias.AliasFactory;
+import jasdl.bridge.alias.DecapitaliseMappingStrategy;
import jasdl.bridge.alias.MappingStrategy;
+import jasdl.util.JasdlConfigurationException;
import jasdl.util.JasdlException;
import jason.asSyntax.Atom;
import jason.runtime.Settings;
@@ -15,24 +17,29 @@
import java.util.List;
import java.util.Vector;
+import org.apache.log4j.Level;
import org.semanticweb.owl.inference.OWLReasoner;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.OWLOntologyManager;
public class JasdlConfigurator {
- private static String MAS2J_PREFIX = "jasdl";
- private static String MAS2J_ONTOLOGIES = "_ontologies";
- private static String MAS2J_URI = "_uri";
- private static String MAS2J_MAPPING_STRATEGIES = "_mapping_strategies";
- private static String MAS2J_MAPPING_MANUAL = "_mapping_manual";
- private static String MAS2J_TRUSTRATING = "_trustRating";
- private static String MAS2J_KNOWNAGENTS = "_knownAgents";
- private static String MAS2J_USEBELIEFREVISION = "_useBeliefRevision";
- private static String MAS2J_REASONERCLASS = "_reasonerClass";
+ public static String MAS2J_PREFIX = "jasdl";
+ public static String MAS2J_ONTOLOGIES = "_ontologies";
+ public static String MAS2J_URI = "_uri";
+ public static String MAS2J_MAPPING_STRATEGIES = "_mapping_strategies";
+ public static String MAS2J_MAPPING_MANUAL = "_mapping_manual";
+ public static String MAS2J_TRUSTRATING = "_trustRating";
+ public static String MAS2J_KNOWNAGENTS = "_knownAgents";
+ public static String MAS2J_USEBELIEFREVISION = "_useBeliefRevision";
+ public static String MAS2J_REASONERCLASS = "_reasonerClass";
+ public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMappingStrategy()} );
+ public static String DEFAULT_REASONER_CLASS = "org.mindswap.pellet.owlapi.Reasoner";
+ public static boolean DEFAULT_USEBELIEFREVISION = false;
+
/**
* List of reserved ontology labels. Currently:
* <ul>
@@ -55,30 +62,25 @@
public void configure(Settings stts) throws JasdlException{
try{
loadReasoner(stts);
-
- // load default mapping strategies
- agent.setDefaultMappingStrategies(getMappingStrategies(stts, new Atom("default"))); //implication "default" is a reserved ontology label
-
- // set whether to use belief revision or not
- String useBeliefRevision = prepareUserParameter(stts, MAS2J_PREFIX + MAS2J_USEBELIEFREVISION);
- agent.setBeliefRevisionEnabled(Boolean.parseBoolean(useBeliefRevision));
-
+ loadDefaultMappingStrategies(stts);
+ setUseBeliefRevision(stts);
loadOntologies(stts);
- applyManualMappings(stts);
- loadTrustRatings(stts);
-
-
-
+ applyManualMappings(stts);
+ loadKnownAgents(stts);
+ loadTrustRatings(stts);
}catch(JasdlException e){
throw new JasdlException("JASDL agent encountered error during configuration. Reason: "+e);
}
}
+ @SuppressWarnings("unchecked")
private void loadReasoner(Settings stts) throws JasdlException{
- String reasonerClass = prepareUserParameter( stts, MAS2J_PREFIX + MAS2J_REASONERCLASS);
- if(reasonerClass.length() == 0){
- reasonerClass = JasdlAgent.DEFAULT_REASONER_CLASS;
- }
+ String reasonerClass;
+ try{
+ reasonerClass = prepareUserParameter( stts, MAS2J_PREFIX + MAS2J_REASONERCLASS);
+ }catch(JasdlConfigurationException e){
+ reasonerClass = DEFAULT_REASONER_CLASS;
+ }
try {
Class cls = Class.forName(reasonerClass);
Constructor ct = cls.getConstructor(new Class[] {OWLOntologyManager.class});
@@ -87,13 +89,28 @@
throw new JasdlException("Unknown reasoner class: "+reasonerClass);
}else{
agent.setReasoner(reasoner);
+ agent.setReasonerLogLevel(Level.WARN);
}
}catch (Throwable e) {
throw new JasdlException("Error instantiating reasoner "+reasonerClass+". Reason: "+e);
}
}
+ private void loadDefaultMappingStrategies(Settings stts) throws JasdlException{
+ agent.setDefaultMappingStrategies(getMappingStrategies(stts, new Atom("default"))); //implication "default" is a reserved ontology label
+ }
+ private void setUseBeliefRevision(Settings stts) throws JasdlException{
+ try{
+ // set whether to use belief revision or not
+ String useBeliefRevision = prepareUserParameter(stts, MAS2J_PREFIX + MAS2J_USEBELIEFREVISION);
+ agent.setBeliefRevisionEnabled(Boolean.parseBoolean(useBeliefRevision));
+ }catch(JasdlConfigurationException e){
+ agent.setBeliefRevisionEnabled(DEFAULT_USEBELIEFREVISION);
+ }
+ }
+
+
/**
* Load ontologies as specified in .mas2j settings
* @param stts .mas2j settings
@@ -105,12 +122,13 @@
if(reservedOntologyLabels.contains(label)){
throw new JasdlException(label+" is a reserved ontology label");
}
- URI physicalURI;
+ String _uri = prepareUserParameter( stts, MAS2J_PREFIX + "_" + label + MAS2J_URI );
+ URI uri = null;
try {
- physicalURI = new URI(prepareUserParameter( stts, MAS2J_PREFIX + "_" + label + MAS2J_URI ));
- agent.loadOntology(new Atom(label), physicalURI, getMappingStrategies(stts, new Atom(label)));
+ uri = new URI(_uri);
+ agent.loadOntology(new Atom(label), uri, getMappingStrategies(stts, new Atom(label)));
} catch (Exception e) {
- throw new JasdlException("Unable to instantiate ontology \""+label+"\". Reason: "+e);
+ throw new JasdlException("Unable to instantiate ontology "+_uri+" (\""+label+"\"). Reason: "+e);
}
}
}
@@ -122,42 +140,55 @@
*/
private void applyManualMappings(Settings stts) throws JasdlException{
for(Atom label : agent.getLabelManager().getLefts()){
- String[] mappings = splitUserParameter(stts, MAS2J_PREFIX + "_" + label + MAS2J_MAPPING_MANUAL);
- for(String mapping : mappings){
- OWLOntology ontology = agent.getLabelManager().getRight(label);
- String[] split = mapping.split("=");
- if(split.length == 2){
- Alias alias = AliasFactory.INSTANCE.create(new Atom(split[0].trim()), label);
- URI uri = URI.create(ontology.getURI() + "#" + split[1].trim());
- OWLEntity entity = agent.toEntity(uri);
-
- if(agent.getAliasManager().isKnownRight(entity)){ // manual mappings override automatic ones
- agent.getAliasManager().removeByRight(entity);
+ try{
+ String[] mappings = splitUserParameter(stts, MAS2J_PREFIX + "_" + label + MAS2J_MAPPING_MANUAL);
+ for(String mapping : mappings){
+ OWLOntology ontology = agent.getLabelManager().getRight(label);
+ String[] split = mapping.split("=");
+ if(split.length == 2){
+ Alias alias = AliasFactory.INSTANCE.create(new Atom(split[0].trim()), label);
+ URI uri = URI.create(ontology.getURI() + "#" + split[1].trim());
+ OWLEntity entity = agent.toEntity(uri);
+
+ if(agent.getAliasManager().isKnownRight(entity)){ // manual mappings override automatic ones
+ agent.getAliasManager().removeByRight(entity);
+ }
+
+ agent.getAliasManager().put(alias, entity);
}
-
- agent.getAliasManager().put(alias, entity);
}
+ }catch(JasdlConfigurationException e){
+ // manual mappings are optional
}
}
}
+ private void loadKnownAgents(Settings stts) throws JasdlException{
+ try{
+ String[] names = (splitUserParameter(stts, MAS2J_PREFIX + MAS2J_KNOWNAGENTS));
+ for(String name : names){
+ agent.addKnownAgentName(name);
+ }
+ }catch(JasdlConfigurationException e){
+ // optional parameter, default to empty
+ }
+ }
+
+
+ // TODO: set trust ratings for assertions predefined in ontology schema (maybe annotated with self)
private void loadTrustRatings(Settings stts) throws JasdlException{
// agent trusts itself completely!
- agent.setTrustRating(new Atom("self"), 1f);
-
- // load trust ratings
- String[] knownAgents = splitUserParameter(stts, MAS2J_PREFIX + MAS2J_KNOWNAGENTS);
- for(String knownAgent : knownAgents){
- if(knownAgent.length() > 0){
- String _trustRating = prepareUserParameter(stts, MAS2J_PREFIX + "_" + knownAgent + MAS2J_TRUSTRATING);
- Float trustRating;
- try{
- trustRating = Float.parseFloat(_trustRating);
- }catch(NumberFormatException e){
- throw new JasdlException("Invalid trust rating for "+knownAgent+". Reason: "+e);
- }
- agent.setTrustRating(new Atom(knownAgent), trustRating);
+ agent.setTrustRating(new Atom("self"), 1f);
+ for(String knownAgent : agent.getKnownAgentNames()){
+ // load trust ratings (mandatory for known agents)
+ String _trustRating = prepareUserParameter(stts, MAS2J_PREFIX + "_" + knownAgent + MAS2J_TRUSTRATING);
+ Float trustRating;
+ try{
+ trustRating = Float.parseFloat(_trustRating);
+ }catch(NumberFormatException e){
+ throw new JasdlException("Invalid trust rating for "+knownAgent+". Reason: "+e);
}
+ agent.setTrustRating(new Atom(knownAgent), trustRating);
}
}
@@ -169,11 +200,12 @@
* Applies mappings to all resources in an ontology according to composition of supplied strategies.
* @param stts .mas2j settings
*/
+ @SuppressWarnings("unchecked")
private List<MappingStrategy> getMappingStrategies(Settings stts, Atom label) throws JasdlException{
List<MappingStrategy> strategies = new Vector<MappingStrategy>();
- String[] strategyNames = splitUserParameter(stts, MAS2J_PREFIX + "_" + label + MAS2J_MAPPING_STRATEGIES);
- for(String strategyName : strategyNames){
- if(strategyName.length() > 0){
+ try{
+ String[] strategyNames = splitUserParameter(stts, MAS2J_PREFIX + "_" + label + MAS2J_MAPPING_STRATEGIES);
+ for(String strategyName : strategyNames){
try {
Class cls = Class.forName(strategyName);
Constructor ct = cls.getConstructor(new Class[] {});
@@ -187,10 +219,9 @@
throw new JasdlException("Error instantiating mapping strategy "+strategyName+". Reason: "+e);
}
}
+ }catch(JasdlConfigurationException e){
+ strategies = agent.getDefaultMappingStrategies(); // mapping strategies optional, use defaults if not set
}
- if(strategies.size() == 0){
- strategies = agent.getDefaultMappingStrategies();
- }
return strategies;
}
@@ -206,10 +237,10 @@
* @param name name of the setting to prepare
* @return
*/
- private String prepareUserParameter(Settings stts, String name){
+ private String prepareUserParameter(Settings stts, String name) throws JasdlConfigurationException{
String p = stts.getUserParameter(name);
if(p == null){
- return "";
+ throw new JasdlConfigurationException(name+" is not set!");
}else{
return strip(p, "\"").trim();
}
@@ -221,7 +252,7 @@
* @param name name of the setting to split
* @return
*/
- private String[] splitUserParameter(Settings stts, String name, String delim){
+ private String[] splitUserParameter(Settings stts, String name, String delim) throws JasdlConfigurationException{
String[] elems = prepareUserParameter(stts, name).split(delim);
for(int i=0; i<elems.length; i++){
elems[i] = strip(elems[i], "\"").trim();
@@ -235,7 +266,7 @@
* @param name name of the setting to split
* @return
*/
- private String[] splitUserParameter(Settings stts, String name){
+ private String[] splitUserParameter(Settings stts, String name) throws JasdlConfigurationException{
return splitUserParameter(stts, name, DELIM);
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-01 16:15:10 UTC (rev 1187)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-01 23:33:22 UTC (rev 1188)
@@ -14,6 +14,8 @@
import jason.asSyntax.Term;
import jason.bb.DefaultBeliefBase;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -77,8 +79,7 @@
getLogger().fine("... semantically-naive");
return super.add(l); // semantically-naive, use standard Jason mechanisms
}catch(Exception e){
- getLogger().warning("Exception caught adding SELiteral "+l+" to belief base: ");
- e.printStackTrace();
+ getLogger().fine("Exception caught adding SELiteral "+l+" to belief base: "+e);
return false;
}
}
@@ -207,6 +208,8 @@
/**
* TODO: Currently only returns asserted ABox axioms. Include option to also show inferences?
+ * Doesn't return beliefs in same order as Jason (could sort stricly alphabetically - but this would be costly
+ * isn't even exactly identical to Jason's behaviour - does it really matter anyway?)
*/
@Override
public Iterator<Literal> iterator() {
@@ -223,8 +226,10 @@
bels.addAll(agent.getABoxState());
}catch(JasdlException e){
getLogger().warning("Exception caught while retrieving ABox state: "+e);
- }
+ }
+ //Collections.sort(bels);
+
return bels.iterator();
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-04-01 16:15:10 UTC (rev 1187)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-04-01 23:33:22 UTC (rev 1188)
@@ -124,7 +124,10 @@
return agent.getAliasManager().getRight(this.toAlias());
}catch(UnknownMappingException e){
Alias alias = toAlias();
- if(alias.getFunctor().toString().startsWith("~")){
+ if(alias.getFunctor().toString().startsWith("~")){
+ if(literal.getArity() == 2){
+ throw new InvalidSELiteralException("JASDL does not currently support negated property assertions");
+ }
Atom negatedFunctor = new Atom(alias.getFunctor().toString().substring(1));
Alias negatedAlias = AliasFactory.INSTANCE.create( negatedFunctor, alias.getLabel());
if(negatedAlias.equals(AliasFactory.OWL_THING) || negatedAlias.equals(AliasFactory.OWL_NOTHING)){
Added: trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java 2008-04-01 23:33:22 UTC (rev 1188)
@@ -0,0 +1,349 @@
+package jasdl.test;
+
+import static jasdl.asSemantics.JasdlConfigurator.MAS2J_ONTOLOGIES;
+import static jasdl.asSemantics.JasdlConfigurator.MAS2J_PREFIX;
+import static jasdl.asSemantics.JasdlConfigurator.MAS2J_URI;
+import static jasdl.asSemantics.JasdlConfigurator.MAS2J_USEBELIEFREVISION;
+import jasdl.architecture.JasdlAgArch;
+import jasdl.asSemantics.JasdlAgent;
+import jasdl.bb.JasdlBeliefBase;
+import jasdl.bridge.alias.Alias;
+import jasdl.bridge.seliteral.SELiteral;
+import jasdl.bridge.xsd.XSDDataType;
+import jasdl.bridge.xsd.XSDDataTypeUtils;
+import jason.architecture.AgArch;
+import jason.architecture.AgArchInfraTier;
+import jason.asSyntax.Atom;
+import jason.asSyntax.DefaultTerm;
+import jason.asSyntax.Literal;
+import jason.asSyntax.Structure;
+import jason.asSyntax.Term;
+import jason.bb.DefaultBeliefBase;
+import jason.infra.centralised.CentralisedAgArch;
+import jason.mas2j.ClassParameters;
+import jason.runtime.Settings;
+
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.semanticweb.owl.model.OWLClass;
+import org.semanticweb.owl.model.OWLDataProperty;
+import org.semanticweb.owl.model.OWLDataType;
+import org.semanticweb.owl.model.OWLObjectProperty;
+import org.semanticweb.owl.model.OWLOntology;
+
+
+/**
+ * Tests that behaviour of JASDL's BB is identical to that of Jason's default BB.
+ *
+ * Note that the ordering of JASDL's iterator function doesn't emulate Jason's exactly (Jason's is not strictly alphabetical and has a few odd quirks).
+ * As a result, we compare the results of the iterator functions using Sets.
+ *
+ * No thought it given to consistency of additions. This is dealt with by the brf before these methods are called.
+ * A seperate test suite must be developed for belief bases employing the legacy rollback consistency assurance mechanism.
+ *
+ * @author Tom Klapiscak
+ *
+ */
+public class JasdlBeliefBaseTest extends TestCase{
+
+ public static String JASDL_AG_ARCH_CLASS = "jasdl.architecture.JasdlAgArch";
+ public static String JASDL_AGENT_CLASS = "jasdl.asSemantics.JasdlAgent";
+ public static String JASDL_BELIEF_BASE_CLASS = "jasdl.bb.JasdlBeliefBase";
+
+ public static String TEST_ONTOLOGY_LABEL = "test";
+ public static String TEST_ONTOLOGY_URI = "http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl";
+
+ protected JasdlAgArch arch;
+ protected JasdlAgent agent;
+ protected JasdlBeliefBase bb;
+ protected DefaultBeliefBase testbb;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() throws Exception {
+ // Use default manual mappings, mapping strategies and reasoner class. No known agents + trust ratings
+ Settings stts = new Settings();
+ stts.addOption(MAS2J_PREFIX + MAS2J_ONTOLOGIES, TEST_ONTOLOGY_LABEL);
+ stts.addOption(MAS2J_PREFIX + "_" + TEST_ONTOLOGY_LABEL + MAS2J_URI, TEST_ONTOLOGY_URI);
+ stts.addOption(MAS2J_PREFIX + MAS2J_USEBELIEFREVISION, "true"); // Must be enabled (we don't want legacy consistency assurance!) - remember brf is skipped by this
+ String aslFile = getClass().getResource("blank.asl").toExternalForm();
+
+ // load arch
+ Class cls = Class.forName(JASDL_AG_ARCH_CLASS);
+ Constructor ct = cls.getConstructor(new Class[] {});
+ AgArch arch = (AgArch)ct.newInstance(new Object[] {});
+ AgArchInfraTier archInfraTier = new CentralisedAgArch();
+ arch.setArchInfraTier(archInfraTier);
+ arch.initAg(JASDL_AGENT_CLASS, new ClassParameters(JASDL_BELIEF_BASE_CLASS), aslFile, stts);
+
+ agent = (JasdlAgent)arch.getTS().getAg();
+ bb = (JasdlBeliefBase)agent.getBB();
+
+ testbb = new DefaultBeliefBase();
+
+ /*
+ // ensure initial state of testbb contained predefinitions from bb's ABox
+ // Add in reverse order, so iterator ordering is identical
+ List<Literal> state = new Vector<Literal>();
+ Iterator<Literal> bbit = bb.iterator();
+ while(bbit.hasNext()){
+ state.add(bbit.next());
+ }
+ Collections.reverse(state);
+ for(Literal l : state){
+ testbb.add(l);
+ }
+ */
+
+
+ // we are not worrying about ordering of iterator anymore
+ Iterator<Literal> bbit = bb.iterator();
+ while(bbit.hasNext()){
+ testbb.add(bbit.next());
+ }
+
+
+
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testAddLiteral() throws Exception{
+
+ boolean[] signs = new boolean[] {true, false};
+
+ for(OWLOntology ontology : agent.getOntologyManager().getOntologies()){
+ for(int run=0; run<=1; run++){ // run twice to ensure duplicate additions are rejected
+ for(boolean sign : signs){
+ for(OWLClass cls : ontology.getReferencedClasses()){
+ Alias alias = agent.getAliasManager().getLeft(cls);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ assertAddClass(sign, functor, "a", label);
+ assertAddClass(sign, functor, "b", label);
+ }
+ for(OWLObjectProperty oprop : ontology.getReferencedObjectProperties()){
+ Alias alias = agent.getAliasManager().getLeft(oprop);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ assertAddObjectProperty(sign, functor, "a", "b", label);
+ assertAddObjectProperty(sign, functor, "b", "a", label);
+ assertAddObjectProperty(sign, functor, "a", "a", label); // irreflexive properties shouldn't be rejected at this stage
+ }
+
+ for(OWLDataProperty dprop : ontology.getReferencedDataProperties()){
+ Alias alias = agent.getAliasManager().getLeft(dprop);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ XSDDataType typ = XSDDataTypeUtils.get(((OWLDataType)dprop.getRanges(ontology).toArray()[0]).toString());
+ if(typ == XSDDataType.XSD_BOOLEAN){
+ assertAddDataProperty(sign, functor, "a", "false", label);
+ assertAddDataProperty(sign, functor, "a", "true", label);
+ }else if(typ == XSDDataType.XSD_DATE){
+ assertAddDataProperty(sign, functor, "a", "\"2007-12-20\"", label);
+ }else if(typ == XSDDataType.XSD_DATETIME){
+ assertAddDataProperty(sign, functor, "a", "\"2007-12-20T20:16:55\"", label);
+ }else if(typ == XSDDataType.XSD_DOUBLE){
+ assertAddDataProperty(sign, functor, "a", "22.0", label);
+ }else if(typ == XSDDataType.XSD_FLOAT){
+ assertAddDataProperty(sign, functor, "a", "0.5", label);
+ }else if(typ == XSDDataType.XSD_INT){
+ assertAddDataProperty(sign, functor, "a", "22", label);
+ }else if(typ == XSDDataType.XSD_STRING){
+ assertAddDataProperty(sign, functor, "a", "\"Winchester\"", label);
+ }else if(typ == XSDDataType.XSD_TIME){
+ assertAddDataProperty(sign, functor, "a", "\"20:16:57\"", label);
+ }
+ }
+
+ }
+ }
+ }
+
+
+
+
+ Set<Literal> expected = new HashSe...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-02 02:21:30
|
Revision: 1190
http://jason.svn.sourceforge.net/jason/?rev=1190&view=rev
Author: tomklapiscak
Date: 2008-04-01 19:21:21 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
Improved JasdlBeliefBase test and added (incomplete) remove test. Fixed bugs in the annotation handling of the remove operation.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl 2008-04-02 02:21:21 UTC (rev 1190)
@@ -46,7 +46,6 @@
<owl:ObjectProperty rdf:about="#hasAccommodation">
<rdfs:range rdf:resource="#Accommodation"/>
<rdfs:domain rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -56,7 +55,6 @@
<owl:ObjectProperty rdf:about="#hasActivity">
<rdfs:range rdf:resource="#Activity"/>
<rdfs:domain rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
<owl:inverseOf rdf:resource="#isOfferedAt"/>
</owl:ObjectProperty>
@@ -67,7 +65,6 @@
<owl:ObjectProperty rdf:about="#hasContact">
<rdfs:domain rdf:resource="#Activity"/>
<rdfs:range rdf:resource="#Contact"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -76,7 +73,6 @@
<owl:ObjectProperty rdf:about="#hasDestination">
<rdfs:range rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -87,7 +83,6 @@
<rdf:type rdf:resource="&owl;TransitiveProperty"/>
<rdfs:domain rdf:resource="#Destination"/>
<rdfs:range rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -98,24 +93,17 @@
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:domain rdf:resource="#Accommodation"/>
<rdfs:range rdf:resource="#AccommodationRating"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
- <!-- http://www.owl-ontologies.com/travel.owl#hasThing -->
-
- <owl:ObjectProperty rdf:about="#hasThing"/>
-
-
-
<!-- http://www.owl-ontologies.com/travel.owl#isLocatedAt -->
<owl:ObjectProperty rdf:about="#isLocatedAt">
+ <rdf:type rdf:resource="&owl11;IrreflexiveProperty"/>
<rdfs:domain rdf:resource="#Accommodation"/>
<rdfs:range rdf:resource="#Destination"/>
<owl:inverseOf rdf:resource="#hasAccommodation"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -127,7 +115,6 @@
>Generalised to apply to accommodations as well</rdfs:comment>
<rdfs:domain rdf:resource="#Activity"/>
<rdfs:range rdf:resource="#Destination"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -138,7 +125,6 @@
<rdfs:domain rdf:resource="#Destination"/>
<rdfs:range rdf:resource="#Destination"/>
<owl:inverseOf rdf:resource="#hasPart"/>
- <rdfs:subPropertyOf rdf:resource="#hasThing"/>
</owl:ObjectProperty>
@@ -158,24 +144,32 @@
<owl:DatatypeProperty rdf:about="#hasCity">
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
- <!-- http://www.owl-ontologies.com/travel.owl#hasData -->
+ <!-- http://www.owl-ontologies.com/travel.owl#hasDate -->
- <owl:DatatypeProperty rdf:about="#hasData"/>
+ <owl:DatatypeProperty rdf:about="#hasDate">
+ <rdfs:range rdf:resource="&xsd;date"/>
+ </owl:DatatypeProperty>
+ <!-- http://www.owl-ontologies.com/travel.owl#hasDateTime -->
+
+ <owl:DatatypeProperty rdf:about="#hasDateTime">
+ <rdfs:range rdf:resource="&xsd;dateTime"/>
+ </owl:DatatypeProperty>
+
+
+
<!-- http://www.owl-ontologies.com/travel.owl#hasEMail -->
<owl:DatatypeProperty rdf:about="#hasEMail">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
@@ -188,7 +182,6 @@
<rdfs:comment
>Stated in local currency</rdfs:comment>
<rdfs:domain rdf:resource="#Accommodation"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;double"/>
</owl:DatatypeProperty>
@@ -198,18 +191,24 @@
<owl:DatatypeProperty rdf:about="#hasStreet">
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
+ <!-- http://www.owl-ontologies.com/travel.owl#hasTime -->
+
+ <owl:DatatypeProperty rdf:about="#hasTime">
+ <rdfs:range rdf:resource="&xsd;time"/>
+ </owl:DatatypeProperty>
+
+
+
<!-- http://www.owl-ontologies.com/travel.owl#hasZipCode -->
<owl:DatatypeProperty rdf:about="#hasZipCode">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:domain rdf:resource="#Contact"/>
- <rdfs:subPropertyOf rdf:resource="#hasData"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-02 02:21:21 UTC (rev 1190)
@@ -83,6 +83,9 @@
+ruralArea(somewhere)[o(travel), source(tom)];
?ruralArea(somewhere)[o(travel)];
+
+ +isLocatedAt(x, x)[o(travel)]; // rejected since isLocated at is irreflexive
+
.print("DL-based belief revision is enabled"); // without, the above test-goal will fail, since legacy mechanism simply removes incoming inconsistent beliefs
// since the classes destination and and contact are disjoint (and ruralArea is a subclass of destination),
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 02:21:21 UTC (rev 1190)
@@ -214,6 +214,10 @@
public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException {
+ // TODO: what annotations should revision contractions contain? all! (or none? - same effect)
+ // No! the same. -a[x] only undermines assertions leading to a[x]!
+ // if we are performing belief-revision all annotations will be gathered (shortcut - use none?) ensuring axiom will be obliterated
+ // annotations never solely lead to conflicts.
if(!isBeliefRevisionEnabled()){ // if experimental feature is disabled
return super.brf(beliefToAdd, beliefToDel, i);
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 02:21:21 UTC (rev 1190)
@@ -14,8 +14,7 @@
import jason.asSyntax.Term;
import jason.bb.DefaultBeliefBase;
-import java.util.Collections;
-import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -90,41 +89,68 @@
*/
@Override
public boolean remove(Literal l) {
+
getLogger().fine("Contracting "+l);
try{
SELiteral sl = agent.getSELiteralFactory().create(l);
OWLOntology ontology = sl.getOntology();
- OWLIndividualAxiom axiom = sl.createAxiom();
+ OWLIndividualAxiom axiom = sl.createAxiom();
+
boolean result = false; // -> at least *something* must be removed for this to be true!
BeliefBaseContractor contractor = new BeliefBaseContractor(agent.getOntologyManager(), new JasdlReasonerFactory(), agent.getLogger());
List<OWLAxiom> contractList = contractor.contract(axiom, new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(agent, sl));
// NOTE: this technique only really makes sense with annotation gathering!
- for(OWLAxiom contract : contractList){ // removals corresponds to l and all l's whose removal will undermine it
+ for(OWLAxiom contract : contractList){ // removals correspond to l and all assertions whose removal will undermine l
+ //agent.refreshReasoner();
- // for each annotation to this axiom, remove it if l has it
- List<OWLAxiomAnnotationAxiom> annotationsToRemove = new Vector<OWLAxiomAnnotationAxiom>(); // to avoid concurrency issues
+ // fail if axiom not contained in ontology
+ if(!ontology.containsAxiom(contract)){
+ continue;
+ }
+
+ // construct annot axiom->term map (avoids unecessary parsing of terms)
+ HashMap<OWLAxiomAnnotationAxiom, Term> annotAxiomToTermMap = new HashMap<OWLAxiomAnnotationAxiom, Term>();
for(OWLAxiomAnnotationAxiom annotAxiom : contract.getAnnotationAxioms(ontology)){
- Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
- if(l.hasAnnot(annot)){
- annotationsToRemove.add(annotAxiom);
- result = true;
- }
+ Term annotTerm = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
+ annotAxiomToTermMap.put(annotAxiom, annotTerm);
}
- for(OWLAxiom annotationToRemove : annotationsToRemove){
- agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, annotationToRemove));
+ // if l only has "o" annotations. Remember, "o" isn't stored in ontology
+ // note: literals without "o" are semantically-naive and so will be caught below
+ if(sl.getSemanticallyNaiveAnnotations().isEmpty()){
+ // remove axiom and all annotations
+ for(OWLAxiomAnnotationAxiom annotAxiom : annotAxiomToTermMap.keySet()){
+ agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, annotAxiom));
+ }
+ agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, contract));
+ result = true;
+ continue;
}
- // remove source(self) and source(percept). TODO: right thing to do?
- // remove assertion if no annotation axioms left
+
+ // first check axiom has all annotations of l except for "o" (otherwise fail)
+ if(!annotAxiomToTermMap.values().containsAll(sl.getSemanticallyNaiveAnnotations())){
+ continue;
+ }
+
+ result = true;
+
+ // remove all axiom annotations (implicitly possessed also by l)
+ for(OWLAxiomAnnotationAxiom annotAxiom : annotAxiomToTermMap.keySet()){
+ agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, annotAxiom));
+ }
+
+ // remove source(self) and source(percept). TODO: right thing to do?
+
+ // if no annotation axioms left, remove assertion
Set<OWLAxiomAnnotationAxiom> remaining = contract.getAnnotationAxioms(ontology);
if(remaining.isEmpty()){
agent.getOntologyManager().applyChange(new RemoveAxiom(ontology, contract));
- result = true;
- }
+ }
+
}
agent.refreshReasoner();
return result;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java 2008-04-02 02:21:21 UTC (rev 1190)
@@ -18,6 +18,7 @@
import jason.asSyntax.Literal;
import jason.asSyntax.Structure;
import jason.asSyntax.Term;
+import jason.bb.BeliefBase;
import jason.bb.DefaultBeliefBase;
import jason.infra.centralised.CentralisedAgArch;
import jason.mas2j.ClassParameters;
@@ -30,7 +31,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import java.util.Vector;
import junit.framework.TestCase;
@@ -55,6 +55,8 @@
* No thought it given to consistency of additions. This is dealt with by the brf before these methods are called.
* A seperate test suite must be developed for belief bases employing the legacy rollback consistency assurance mechanism.
*
+ * TODO: contruct special testing ontology to better cover all test cases
+ *
* @author Tom Klapiscak
*
*/
@@ -102,94 +104,184 @@
bb = (JasdlBeliefBase)agent.getBB();
testbb = new DefaultBeliefBase();
-
- /*
- // ensure initial state of testbb contained predefinitions from bb's ABox
- // Add in reverse order, so iterator ordering is identical
- List<Literal> state = new Vector<Literal>();
- Iterator<Literal> bbit = bb.iterator();
- while(bbit.hasNext()){
- state.add(bbit.next());
- }
- Collections.reverse(state);
- for(Literal l : state){
- testbb.add(l);
- }
- */
-
-
+
// we are not worrying about ordering of iterator anymore
Iterator<Literal> bbit = bb.iterator();
while(bbit.hasNext()){
testbb.add(bbit.next());
- }
+ }
-
-
-
}
@After
public void tearDown() throws Exception {
}
+
+
+ private Literal constructSELiteral(boolean sign, String functor, Term[] terms, Term[] annots, String label){
+ Literal l = new Literal(sign, functor);
+ addO(l, label);
+ l.addTerms(Arrays.asList(terms));
+ if(annots!=null){
+ l.addAnnots(Arrays.asList(annots));
+ }
+ return l;
+ }
+
+ private Literal constructSELiteral(boolean sign, String functor, Term[] terms, String[] _annots, String label){
+ Term[] annots = null;
+ if(_annots != null){
+ annots = new Term[_annots.length];
+ for(int i=0; i<_annots.length; i++){
+ annots[i] = DefaultTerm.parse(_annots[i]);
+ }
+ }
+ return constructSELiteral(sign, functor, terms, annots, label);
+ }
+
+ private Literal constructClass(boolean sign, String functor, String i, String[] annots, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(i)}, annots, label);
+ }
+
+ private Literal constructObjectProperty(boolean sign, String functor, String s, String o, String[] annots, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(s), new Atom(o)}, annots, label);
+ }
+
+ private Literal constructDataProperty(boolean sign, String functor, String s, String o, String[] annots, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(s), DefaultTerm.parse(o)}, annots, label);
+ }
+
+
+
+
+ private Literal constructSELiteral(boolean sign, String functor, Term[] terms, String label){
+ return constructSELiteral(sign, functor, terms, (Term[])null, label);
+ }
+
+ private Literal constructClass(boolean sign, String functor, String i, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(i)}, label);
+ }
+
+ private Literal constructObjectProperty(boolean sign, String functor, String s, String o, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(s), new Atom(o)}, label);
+ }
+
+ private Literal constructDataProperty(boolean sign, String functor, String s, String o, String label){
+ return constructSELiteral(sign, functor, new Term[] {new Atom(s), DefaultTerm.parse(o)}, label);
+ }
+
+ /**
+ * Adds the ontology annotation with the specified label to the supplied literal
+ * @param l
+ */
+ private void addO(Literal l, String label){
+ Structure o = new Structure(SELiteral.ONTOLOGY_ANNOTATION_FUNCTOR);
+ o.addTerm(new Atom(label));
+ l.addAnnot(o);
+ }
+
+ private static boolean[] signs = new boolean[] {true, false};
+
+
@Test
- public void testAddLiteral() throws Exception{
+ public void testRemoveLiteral() throws Exception{
+ // contractor is tested more thoroughly elsewhere
- boolean[] signs = new boolean[] {true, false};
+ /** Testing annotation handling */
+ //for(boolean sign : signs){
+ boolean sign = true;
+ Literal l = constructClass(sign, "hotel", "a", TEST_ONTOLOGY_LABEL);
+ Literal l_x = constructClass(sign, "hotel", "a", new String[] {"x"}, TEST_ONTOLOGY_LABEL);
+ Literal l_xy = constructClass(sign, "hotel", "a", new String[] {"x", "y"}, TEST_ONTOLOGY_LABEL);
+
+ testRemoveIndividualAssertion(l);
+ testRemoveIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l_xy);
+
+ testAddIndividualAssertion(l);
+ testRemoveIndividualAssertion(l);
+
+
+ testAddIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l);
+ testRemoveIndividualAssertion(l_x);
+
+ testAddIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l);
+
+
+ testAddIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l_xy);
+ testRemoveIndividualAssertion(l);
+
+ testAddIndividualAssertion(l_x);
+ testRemoveIndividualAssertion(l);
+ testRemoveIndividualAssertion(l_xy);
+
+
+
+ //}
+
+ //l = constructClass();
+
+ }
+
+
+ //@Test
+ public void notestAddLiteral() throws Exception{
+ String[][] annotSets = new String[][] {new String[]{}, new String[] {"x"}, new String[] {"x", "y"} };
for(OWLOntology ontology : agent.getOntologyManager().getOntologies()){
for(int run=0; run<=1; run++){ // run twice to ensure duplicate additions are rejected
for(boolean sign : signs){
- for(OWLClass cls : ontology.getReferencedClasses()){
- Alias alias = agent.getAliasManager().getLeft(cls);
- String label = alias.getLabel().getFunctor();
- String functor = alias.getFunctor().getFunctor();
- assertAddClass(sign, functor, "a", label);
- assertAddClass(sign, functor, "b", label);
- }
- for(OWLObjectProperty oprop : ontology.getReferencedObjectProperties()){
- Alias alias = agent.getAliasManager().getLeft(oprop);
- String label = alias.getLabel().getFunctor();
- String functor = alias.getFunctor().getFunctor();
- assertAddObjectProperty(sign, functor, "a", "b", label);
- assertAddObjectProperty(sign, functor, "b", "a", label);
- assertAddObjectProperty(sign, functor, "a", "a", label); // irreflexive properties shouldn't be rejected at this stage
- }
-
- for(OWLDataProperty dprop : ontology.getReferencedDataProperties()){
- Alias alias = agent.getAliasManager().getLeft(dprop);
- String label = alias.getLabel().getFunctor();
- String functor = alias.getFunctor().getFunctor();
- XSDDataType typ = XSDDataTypeUtils.get(((OWLDataType)dprop.getRanges(ontology).toArray()[0]).toString());
- if(typ == XSDDataType.XSD_BOOLEAN){
- assertAddDataProperty(sign, functor, "a", "false", label);
- assertAddDataProperty(sign, functor, "a", "true", label);
- }else if(typ == XSDDataType.XSD_DATE){
- assertAddDataProperty(sign, functor, "a", "\"2007-12-20\"", label);
- }else if(typ == XSDDataType.XSD_DATETIME){
- assertAddDataProperty(sign, functor, "a", "\"2007-12-20T20:16:55\"", label);
- }else if(typ == XSDDataType.XSD_DOUBLE){
- assertAddDataProperty(sign, functor, "a", "22.0", label);
- }else if(typ == XSDDataType.XSD_FLOAT){
- assertAddDataProperty(sign, functor, "a", "0.5", label);
- }else if(typ == XSDDataType.XSD_INT){
- assertAddDataProperty(sign, functor, "a", "22", label);
- }else if(typ == XSDDataType.XSD_STRING){
- assertAddDataProperty(sign, functor, "a", "\"Winchester\"", label);
- }else if(typ == XSDDataType.XSD_TIME){
- assertAddDataProperty(sign, functor, "a", "\"20:16:57\"", label);
+ for(String[] annots : annotSets){
+ for(OWLClass cls : ontology.getReferencedClasses()){
+ Alias alias = agent.getAliasManager().getLeft(cls);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ testAddIndividualAssertion(constructClass(sign, functor, "a", annots, label));
+ testAddIndividualAssertion(constructClass(sign, functor, "b", annots, label));
}
+ for(OWLObjectProperty oprop : ontology.getReferencedObjectProperties()){
+ Alias alias = agent.getAliasManager().getLeft(oprop);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ testAddIndividualAssertion(constructObjectProperty(sign, functor, "a", "b", annots, label));
+ testAddIndividualAssertion(constructObjectProperty(sign, functor, "b", "a", annots, label));
+ testAddIndividualAssertion(constructObjectProperty(sign, functor, "a", "a", annots, label)); // irreflexive properties shouldn't be rejected at this stage
+ }
+
+ for(OWLDataProperty dprop : ontology.getReferencedDataProperties()){
+ Alias alias = agent.getAliasManager().getLeft(dprop);
+ String label = alias.getLabel().getFunctor();
+ String functor = alias.getFunctor().getFunctor();
+ XSDDataType typ = XSDDataTypeUtils.get(((OWLDataType)dprop.getRanges(ontology).toArray()[0]).toString());
+ if(typ == XSDDataType.XSD_BOOLEAN){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "false", annots, label));
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "true", annots, label));
+ }else if(typ == XSDDataType.XSD_DATE){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "\"2007-12-20\"", annots, label));
+ }else if(typ == XSDDataType.XSD_DATETIME){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "\"2007-12-20T20:16:55\"", annots, label));
+ }else if(typ == XSDDataType.XSD_FLOAT){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "0.5", annots, label));
+ }else if(typ == XSDDataType.XSD_INT){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "22", annots, label));
+ }else if(typ == XSDDataType.XSD_STRING){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "\"Winchester\"", annots, label));
+ }else if(typ == XSDDataType.XSD_TIME){
+ testAddIndividualAssertion(constructDataProperty(sign, functor, "a", "\"20:16:57\"", annots, label));
+ }
+ }
}
}
}
}
-
-
-
Set<Literal> expected = new HashSet<Literal>();
Iterator<Literal> testbbit = testbb.iterator();
@@ -201,111 +293,49 @@
Iterator<Literal> bbit = bb.iterator();
while(bbit.hasNext()){
actual.add(bbit.next());
- }
-
+ }
assertEquals(expected, actual);
}
-
- /**
- * Constructs functor and annotations (including ontology annotation) of a SE-Literal.
- * @param sign
- * @param functor
- * @param annots
- * @return
- */
- private Literal constructSELiteral(boolean sign, String functor, String label){
- Literal l = new Literal(sign, functor);
- addO(l, label);
- return l;
+
+
+ private void testAddIndividualAssertion(Literal l){
+ // special case: reject ~thing and ~nothing
+ if(l.negated() && (l.getFunctor().equals("thing") || l.getFunctor().equals("nothing"))){
+ assertFalse(bb.add(l));return;
+ }
+ //special case: reject negated property assertions
+ if(l.negated() && l.getArity() == 2){
+ assertFalse(bb.add(l));return;
+ }
+ System.out.print("Adding: "+l);
+ //cloning necessary since Jason's default bb.add affects l passed to it
+ boolean expected = testbb.add((Literal)l.clone());
+ boolean actual = bb.add((Literal)l.clone());
+ assertEquals(expected, actual);
+ System.out.println(" ... Result: "+actual);
}
- /**
- * Adds the ontology annotation with the specified label to the supplied literal
- * @param l
- */
- private void addO(Literal l, String label){
- Structure o = new Structure(SELiteral.ONTOLOGY_ANNOTATION_FUNCTOR);
- o.addTerm(new Atom(label));
- l.addAnnot(o);
- }
-
- /**
- * Constructs SE-Literal, adds terms
- * recognises special cases (i.e. negated properties)
- * otherwise, ensures behaviour is identical to Jason's BB.
- * Additionally, tries with "x", then "y" annots added.
- * @param sign
- * @param functor
- * @param annots
- * @param is
- * @param expected
- */
- private void assertAdd(boolean sign, String functor, List<Term> is, String label){
- Term[][] annotSets = new Term[][] {new Term[]{}, new Term[] {new Atom("x")}, new Term[] {new Atom("x"), new Atom("y")} };
- for(Term[] annots : annotSets){
- Literal l = constructSELiteral(sign, functor, label);
- l.addTerms(is);
- l.addAnnots(Arrays.asList(annots));
- // special case: reject ~thing and ~nothing
- if(!sign && (functor.equals("thing") || functor.equals("nothing"))){
- assertFalse(bb.add(l));return;
- }
- //special case: reject negated property assertions
- if(!sign && l.getArity() == 2){
- assertFalse(bb.add(l));return;
- }
- //System.out.println("Adding: "+l);
- assertEquals(testbb.add((Literal)l.clone()), bb.add((Literal)l.clone())); // cloning necessary since Jason's default bb.add affects l passed to it
+
+ private void testRemoveIndividualAssertion(Literal l){
+ // special case: reject ~thing and ~nothing
+ if(l.negated() && (l.getFunctor().equals("thing") || l.getFunctor().equals("nothing"))){
+ assertFalse(bb.remove(l));return;
}
- }
-
-
- /**
- * Convenience method for testing class assertion additions (unary literals)
- *
- * @param sign
- * @param functor
- * @param annots
- * @param i
- * @param expected
- */
- private void assertAddClass(boolean sign, String functor, String i, String label){
- assertAdd(sign, functor, Collections.singletonList((Term)new Atom(i)), label);
- }
-
- /**
- * Convenience method for testing class assertion additions (unary literals)
- *
- * @param sign
- * @param functor
- * @param annots
- * @param i
- * @param expected
- */
- private void assertAddDataProperty(boolean sign, String functor, String s, String o, String label){
- assertAdd(sign, functor, Arrays.asList(new Term[] {new Atom(s), DefaultTerm.parse(o)}), label);
+ //special case: reject negated property assertions
+ if(l.negated() && l.getArity() == 2){
+ assertFalse(bb.remove(l));return;
+ }
+ System.out.print("Removing: "+l);
+ boolean expected = testbb.remove((Literal)l.clone());
+ boolean actual = bb.remove((Literal)l.clone());
+ assertEquals(expected, actual);
+ System.out.println(" ... Result: "+actual);
}
- /**
- * Convenience method for testing class assertion additions (unary literals)
- *
- * @param sign
- * @param functor
- * @param annots
- * @param i
- * @param expected
- */
- private void assertAddObjectProperty(boolean sign, String functor, String s, String o, String label){
- assertAdd(sign, functor, Arrays.asList(new Term[] {new Atom(s), new Atom(o)}), label);
- }
@Test
- public void testRemoveLiteral() {
- }
-
- @Test
public void testContainsLiteral() {
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-04-02 17:05:27
|
Revision: 1192
http://jason.svn.sourceforge.net/jason/?rev=1192&view=rev
Author: tomklapiscak
Date: 2008-04-02 10:05:13 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Structural improvements.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/build.xml
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/AllDifferentPlaceholder.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToSELiteralConverter.java
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-04-02 17:00:03 UTC (rev 1191)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-04-02 17:05:13 UTC (rev 1192)
@@ -1,13 +1,18 @@
<project basedir="." default="jar" name="jasdl">
- <property name="source.dir" value="${basedir}/src" />
- <property name="build.dir" value="${basedir}/bin" />
- <property name="apidocs.dir" value="${basedir}/doc/api" />
- <property name="jar.file" value="${basedir}/lib/jasdl.jar" />
+ <property name="jason.dir" value="../.."/>
+ <property name="apps.dir" value="${jason.dir}/applications"/>
+ <property name="jmca.dir" value="${apps.dir}/jmca"/>
+ <property name="asunit.dir" value="${apps.dir}/as-unit-test"/>
+ <property name="source.dir" value="${basedir}/src" />
+ <property name="build.dir" value="${basedir}/bin" />
+ <property name="apidocs.dir" value="${basedir}/doc/api" />
+ <property name="jar.file" value="${basedir}/lib/jasdl.jar" />
<path id="project.classpath">
- <pathelement location="../../lib/jason.jar"/>
- <pathelement location="../../applications/jmca/lib/jmca.jar"/>
+ <pathelement location="${jason.dir}/lib/jason.jar"/>
+ <pathelement location="${jmca.dir}/lib/jmca.jar"/>
+ <pathelement location="${asunit.dir}/lib/asunit.jar"/>
<fileset dir="./lib">
<include name="**/*.jar"/>
</fileset>
Deleted: trunk/applications/jasdl-owlapi/src/jasdl/bridge/AllDifferentPlaceholder.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/AllDifferentPlaceholder.java 2008-04-02 17:00:03 UTC (rev 1191)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/AllDifferentPlaceholder.java 2008-04-02 17:05:13 UTC (rev 1192)
@@ -1,118 +0,0 @@
-package jasdl.bridge;
-
-import jason.asSyntax.Atom;
-
-import java.net.URI;
-import java.util.Set;
-
-import org.semanticweb.owl.model.OWLAnnotation;
-import org.semanticweb.owl.model.OWLAnnotationAxiom;
-import org.semanticweb.owl.model.OWLClass;
-import org.semanticweb.owl.model.OWLDataProperty;
-import org.semanticweb.owl.model.OWLDataType;
-import org.semanticweb.owl.model.OWLEntity;
-import org.semanticweb.owl.model.OWLEntityVisitor;
-import org.semanticweb.owl.model.OWLException;
-import org.semanticweb.owl.model.OWLIndividual;
-import org.semanticweb.owl.model.OWLNamedObjectVisitor;
-import org.semanticweb.owl.model.OWLObject;
-import org.semanticweb.owl.model.OWLObjectProperty;
-import org.semanticweb.owl.model.OWLObjectVisitor;
-import org.semanticweb.owl.model.OWLOntology;
-
-/**
- * Since the all_different has no concrete entity associated with it, we create a "placeholder" so that it remains consistent with
- * JASDL's mapping mechanisms. Entities of this type will be intercepted and dealt with differently.
- * Associated with an ontology label which determines hash-code - required since each ontology must have its own placeholder to reference
- * @author tom
- *
- */
-public class AllDifferentPlaceholder implements OWLEntity {
- private Atom label;
-
- public AllDifferentPlaceholder(Atom label){
- this.label = label;
- }
-
- public void accept(OWLEntityVisitor visitor) {
- }
-
- public Set<OWLAnnotationAxiom> getAnnotationAxioms(OWLOntology ontology) {
- return null;
- }
-
- public Set<OWLAnnotation> getAnnotations(OWLOntology ontology) {
- return null;
- }
-
- public Set<OWLAnnotation> getAnnotations(OWLOntology ontology, URI annotationURI) {
- return null;
- }
-
- public void accept(OWLObjectVisitor visitor) {
-
- }
-
- public void accept(OWLNamedObjectVisitor visitor) {
- }
-
- public URI getURI() {
- return null;
- }
-
- public boolean equals(Object other){
- if(!(other instanceof AllDifferentPlaceholder)){
- return false;
- }
- return label.equals(((AllDifferentPlaceholder)other).label);
- }
-
- public int hashCode(){
- return label.hashCode();
- }
-
- public OWLClass asOWLClass() {
- return null;
- }
-
- public OWLDataProperty asOWLDataProperty() {
- return null;
- }
-
- public OWLDataType asOWLDataType() {
- return null;
- }
-
- public OWLIndividual asOWLIndividual() {
- return null;
- }
-
- public OWLObjectProperty asOWLObjectProperty() {
- return null;
- }
-
- public boolean isOWLClass() {
- return false;
- }
-
- public boolean isOWLDataProperty() {
- return false;
- }
-
- public boolean isOWLDataType() {
- return false;
- }
-
- public boolean isOWLIndividual() {
- return false;
- }
-
- public boolean isOWLObjectProperty() {
- return false;
- }
-
- public int compareTo(OWLObject arg0) {
- return 0;
- }
-
-}
Deleted: trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java 2008-04-02 17:00:03 UTC (rev 1191)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/MappingManager.java 2008-04-02 17:05:13 UTC (rev 1192)
@@ -1,105 +0,0 @@
-package jasdl.bridge;
-
-import jasdl.util.DuplicateMappingException;
-import jasdl.util.UnknownMappingException;
-
-import java.util.HashMap;
-import java.util.Set;
-import java.util.logging.Logger;
-
-/**
- * A bi-directional hash map that enforces 1 to 1 mappings.
- *
- * @author Tom Klapiscak
- *
- * @param <X>
- * @param <Y>
- */
-public class MappingManager<X extends Object, Y extends Object> {
- private Logger logger = Logger.getLogger(this.getClass().toString());
-
- private HashMap<X, Y> xToYMap;
-
- private HashMap<Y, X> yToXMap;
-
- public MappingManager(){
- xToYMap = new HashMap<X, Y>();
- yToXMap = new HashMap<Y, X>();
- }
-
- /**
- * Maps an x to a y and visa-versa.
- * 1 <-> 1 relationships enforced to prevent ambiguous mapping.
- * @param alias
- * @param entity
- * @throws DuplicateMappingException if either alias or entity is already mapped (thus breaking 1 <-> 1 constraint)
- */
- public void put(X x, Y y) throws DuplicateMappingException{
- logger.fine("mapping "+x+" <-> "+y);
-
- if(isKnownLeft(x)){
- throw new DuplicateMappingException("Duplicate mapping on "+x);
- }
- if(isKnownRight(y)){
- throw new DuplicateMappingException("Duplicate mapping on "+y);
- }
-
- xToYMap.put(x, y);
- yToXMap.put(y, x);
- }
-
- /**
- * Gets the alias associated with an entity
- * @param entity
- * @return
- * @throws UnknownMappingException if entity is unknown (not mapped)
- */
- public X getLeft(Y y) throws UnknownMappingException{
- X x = yToXMap.get(y);
- if(x == null){
- throw new UnknownMappingException("Unknown mapping "+y);
- }
- return x;
- }
-
- /**
- * Gets the entity associated with an alias
- * @param alias
- * @return
- * @throws UnknownMappingException if alias is unknown (not mapped)
- */
- public Y getRight(X x) throws UnknownMappingException{
- Y y = xToYMap.get(x);
- if(y == null){
- throw new UnknownMappingException("Unknown mapping "+x);
- }
- return y;
- }
-
-
- public boolean isKnownLeft(X x){
- return xToYMap.containsKey(x);
- }
-
- public boolean isKnownRight(Y y){
- return yToXMap.containsKey(y);
- }
-
- public Set<X> getLefts(){
- return xToYMap.keySet();
- }
-
- public Set<Y> getRights(){
- return yToXMap.keySet();
- }
-
- public void removeByLeft(X x){
- Y y = xToYMap.remove(x);
- yToXMap.remove(y);
- }
-
- public void removeByRight(Y y){
- X x = yToXMap.remove(y);
- xToYMap.remove(x);
- }
-}
Deleted: trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java 2008-04-02 17:00:03 UTC (rev 1191)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToAxiomConverter.java 2008-04-02 17:05:13 UTC (rev 1192)
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
- *
- * This file is part of JASDL.
- *
- * JASDL is free software: you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * JASDL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Lesser GNU General Public License for more details.
- *
- * You should have received a copy of the Lesser GNU General Public License
- * along with JASDL. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package jasdl.bridge;
-
-import static jasdl.util.Common.RANGE;
-import jasdl.asSemantics.JasdlAgent;
-import jasdl.bb.revision.IndividualAxiomToDescriptionConverter;
-import jasdl.bridge.seliteral.SELiteral;
-import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
-import jasdl.bridge.seliteral.SELiteralClassAssertion;
-import jasdl.bridge.seliteral.SELiteralDataPropertyAssertion;
-import jasdl.bridge.seliteral.SELiteralObjectPropertyAssertion;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.semanticweb.owl.inference.OWLReasonerException;
-import org.semanticweb.owl.model.OWLConstant;
-import org.semanticweb.owl.model.OWLDataProperty;
-import org.semanticweb.owl.model.OWLDescription;
-import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
-import org.semanticweb.owl.model.OWLIndividual;
-import org.semanticweb.owl.model.OWLIndividualAxiom;
-import org.semanticweb.owl.model.OWLObjectProperty;
-import org.semanticweb.owl.model.OWLTypedConstant;
-
-
-/**
- * Accepts an arbitrary SEliteral and, depending on its type, creates an OWLIndividualAxiom encoding of it.
- * This factory can be used in one of two ways: for <i>creation</i> or for <i>retrieval</i>.<p>
- *
- * Creation will always return a encoding regardless of whether the axiom is entailed by the ontology.
- * In this case, the SELiteral must be ground and only a <b>single</b> SELiteral can be returned.<p>
- *
- * Retrieval, on the other hand, will result in an empty list if the axiom is not entailed by the ontology, otherwise
- * a list containing SELiteral encodings of <b>all</b> entailments is returned. The retrieval operation can deal
- * with unground SELiterals, in which case unground terms will be treated as "wildcards" that match any (suitable) resource.<p>
- *
- * Creation example:
- * <ul>
- * <li>hotel(hilton)[o(travel)] -> ClassAssertion(Hotel hilton)</li>
- * <li>hasRating(hilton,threeStarRating)[o(travel)] -> ObjectPropertyAssertion(hasRating hilton ThreeStarRating)</li>
- * <li>all_different([hilton,fourSeasons])[o(travel)] -> DifferentIndividuals( fourSeasons hilton )</li>
- * </ul><p>
- *
- * Retrieval example:
- * <ul>
- * <li>hotel(hilton)[o(travel)] -> [ClassAssertion(Hotel hilton)]</li>
- * <li>hasRating(hilton,X)[o(travel)] -> [ObjectPropertyAssertion(hasRating hilton OneStarRating), ObjectPropertyAssertion(hasRating hilton TwoStarRating), ObjectPropertyAssertion(hasRating hilton ThreeStarRating)]</li>
- * <li>hotel(threeStarRating)[o(travel)] -> []</li>
- * <li>~hotel(threeStarRating)[o(travel)] -> [ObjectComplementOf(ClassAssertion(Hotel threeStarRating))]</li>
- * </ul>
- * @author Tom Klapiscak
- *
- */
-public class ToAxiomConverter {
-
- private JasdlAgent agent;
-
- public ToAxiomConverter(JasdlAgent agent){
- this.agent = agent;
- }
-
-
- public Set<OWLIndividualAxiom> retrieve(SELiteral sl) throws JasdlException{
- return convert(sl, true);
- }
-
- /**
- * <b>Create</b> an axiomatic encoding of sl. Specific type of axiom dependent on specific type of sl.
- * sl must be <b>ground</b>
- * @param sl the SE-Literal to encode
- * @return a single encoding of sl - regardless of whether it is entailed or not
- * @throws JasdlException
- */
- public OWLIndividualAxiom create(SELiteral sl) throws JasdlException{
- if(!sl.getLiteral().isGround()){
- throw new JasdlException("Cannot create an axiom from unground SELiteral "+sl);
- }
- Set<OWLIndividualAxiom> axioms = convert(sl, false);
- if(axioms.isEmpty()){
- throw new JasdlException("Error creating axiom from "+sl);
- }
- return (OWLIndividualAxiom)axioms.toArray()[0];
- }
-
- /**
- * Polymorphically apply a factory method dependent on the specific type of sl
- * @param sl the SE-Literal to encode
- * @param checkForExistence if true, results will only be returned in they are entailed - if false, a successful encoding will guarantee a result
- * @return a set of entailments matching sl
- * @throws JasdlException
- */
- private Set<OWLIndividualAxiom> convert(SELiteral sl, boolean checkForExistence) throws JasdlException{
- if(sl instanceof SELiteralClassAssertion){
- return convert((SELiteralClassAssertion)sl, checkForExistence);
- }else if(sl instanceof SELiteralObjectPropertyAssertion){
- return create((SELiteralObjectPropertyAssertion)sl, checkForExistence);
- }else if(sl instanceof SELiteralDataPropertyAssertion){
- return create((SELiteralDataPropertyAssertion)sl, checkForExistence);
- }else if(sl instanceof SELiteralAllDifferentAssertion){
- return create((SELiteralAllDifferentAssertion)sl, checkForExistence);
- }else{
- throw new InvalidSELiteralException("JASDL does not know how to handle SELiterals like "+sl);
- }
- }
-
- /**
- * Convert a unary SELiteral (asserting a class membership of an individual) to its axiomatic encoding
- * @param sl the SELiteral to convert
- * @param checkForExistence if true, results will only be returned in they are entailed - if false, a successful encoding will guarantee a result
- * @return an axiomatic encoding of sl
- * @throws JasdlException
- */
- private Set<OWLIndividualAxiom> convert(SELiteralClassAssertion sl, boolean checkForExistence) throws JasdlException{
- try {
- Set<OWLIndividual> is = new HashSet<OWLIndividual>();
- OWLDescription desc = sl.getOWLDescription();
-
- if(sl.getLiteral().isGround()){
- OWLIndividual i = sl.getOWLIndividual();
- if(!checkForExistence || agent.getReasoner().hasType(i, desc, false)){
- is.add(i);
- }
- }else{
- is.addAll(agent.getReasoner().getIndividuals(desc, false));
- }
- Set<OWLIndividualAxiom> axioms = new HashSet<OWLIndividualAxiom>();
- for(OWLIndividual i : is){
- axioms.add(agent.getOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(i, desc));
- }
- return axioms;
- } catch (OWLReasonerException e) {
- throw new JasdlException("Unable to convert "+sl+" to axiom. Reason: "+e);
- }
- }
-
- /**
- * Convert a unary all_different SELiteral (asserting distinctness of a set of individuals) to its axiomatic encoding
- * @param sl the SELiteral to convert
- * @param checkForExistence if true, results will only be returned in they are entailed - if false, a successful encoding will guarantee a result
- * @return an axiomatic encoding of sl
- * @throws JasdlException
- */
- public Set<OWLIndividualAxiom> create(SELiteralAllDifferentAssertion sl, boolean checkForExistence) throws JasdlException{
- try {
- Set<OWLIndividual> _is = sl.getOWLIndividuals();
- Object[] is = _is.toArray();
- if(is.length == 0){
- throw new JasdlException("All different assertion must contain some individuals! "+sl);
- }
- // check they are mutually distinct (if we are checking for existence)
- boolean distinct = true;
- if(checkForExistence){
- for(int i=0; i<is.length; i++){
- for(int j=i+1; j<is.length; j++){
- // create a description that is satisfiable iff the two individuals are different. TODO: request in-built OWL-API support for this
- OWLDifferentIndividualsAxiom axiom = agent.getOntologyManager().getOWLDataFactory().getOWLDifferentIndividualsAxiom(_is);
- IndividualAxiomToDescriptionConverter conv = new IndividualAxiomToDescriptionConverter(agent.getOntologyManager().getOWLDataFactory());
- axiom.accept(conv);
- if(!agent.getReasoner().isSatisfiable(conv.getDescription())){//.isDifferentFrom((OWLIndividual)is[i], (OWLIndividual)is[j])){
- distinct = false;
- break;
- }
- }
- if(!distinct) break;
- }
- }
- Set<OWLIndividualAxiom> axioms = new HashSet<OWLIndividualAxiom>();
- Set<OWLIndividual> different = new HashSet<OWLIndividual>();
- if(!checkForExistence || distinct){
- for(int i=0; i<is.length; i++){
- different.add((OWLIndividual)is[i]);
- }
- OWLDifferentIndividualsAxiom axiom = agent.getOntologyManager().getOWLDataFactory().getOWLDifferentIndividualsAxiom(different);
- axioms.add(axiom);
- }
- return axioms;
- } catch (OWLReasonerException e) {
- throw new JasdlException("Unable to convert "+sl+" to axiom. Reason: "+e);
- }
- }
-
- /**
- * Convert a binary SELiteral (asserting that two individuals are related by an object property) to its axiomatic encoding
- * @param sl the SELiteral to convert
- * @param checkForExistence if true, results will only be returned in they are entailed - if false, a successful encoding will guarantee a result
- * @return an axiomatic encoding of sl
- * @throws JasdlException
- */
- public Set<OWLIndividualAxiom> create(SELiteralObjectPropertyAssertion sl, boolean checkForExistence) throws JasdlException{
- try {
- Set<OWLIndividual> os = new HashSet<OWLIndividual>();
- OWLIndividual s = sl.getSubject();
- OWLObjectProperty p = sl.getPredicate();
- if(sl.getLiteral().getTerm(RANGE).isGround()){
- OWLIndividual o = sl.getObject();
- if(!checkForExistence || agent.getReasoner().hasObjectPropertyRelationship(s, p, o)){
- os.add(o);
- }
- }else{
- os.addAll(agent.getReasoner().getRelatedIndividuals(s, p));
- }
- Set<OWLIndividualAxiom> axioms = new HashSet<OWLIndividualAxiom>();
- for(OWLIndividual o : os){
- axioms.add(agent.getOntologyManager().getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(s, p, o));
- }
- return axioms;
- } catch (OWLReasonerException e) {
- throw new JasdlException("Unable to convert "+sl+" to axiom. Reason: "+e);
- }
- }
-
- /**
- * Convert a binary SELiteral (asserting that an individual is related to a datatype literal) to its axiomatic encoding
- * @param sl the SELiteral to convert
- * @param checkForExistence if true, results will only be returned in they are entailed - if false, a successful encoding will guarantee a result
- * @return an axiomatic encoding of sl
- * @throws JasdlException
- */
- public Set<OWLIndividualAxiom> create(SELiteralDataPropertyAssertion sl, boolean checkForExistence) throws JasdlException{
- try {
- Set<OWLConstant> os = new HashSet<OWLConstant>();
- OWLIndividual s = sl.getSubject();
- OWLDataProperty p = sl.getPredicate();
- if(sl.getLiteral().getTerm(RANGE).isGround()){
- OWLTypedConstant o = sl.getObject();
- if(!checkForExistence || agent.getReasoner().hasDataPropertyRelationship(s, p, o)){
- os.add(o);
- }
- }else{
- os.addAll(agent.getReasoner().getRelatedValues(s, p));
- }
- Set<OWLIndividualAxiom> axioms = new HashSet<OWLIndividualAxiom>();
- for(OWLConstant o : os){
- axioms.add(agent.getOntologyManager().getOWLDataFactory().getOWLDataPropertyAssertionAxiom(s, p, o));
- }
- return axioms;
- } catch (OWLReasonerException e) {
- throw new JasdlException("Unable to convert "+sl+" to axiom. Reason: "+e);
- }
- }
-
-
-
-
-
-
-}
\ No newline at end of file
Deleted: trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToSELiteralConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToSELiteralConverter.java 2008-04-02 17:00:03 UTC (rev 1191)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/ToSELiteralConverter.java 2008-04-02 17:05:13 UTC (rev 1192)
@@ -1,224 +0,0 @@
-package jasdl.bridge;
-
-import jasdl.asSemantics.JasdlAgent;
-import jasdl.bridge.alias.Alias;
-import jasdl.bridge.seliteral.SELiteral;
-import jasdl.bridge.xsd.XSDDataType;
-import jasdl.bridge.xsd.XSDDataTypeUtils;
-import jasdl.util.JasdlException;
-import jason.asSyntax.Atom;
-import jason.asSyntax.DefaultTerm;
-import jason.asSyntax.ListTerm;
-import jason.asSyntax.ListTermImpl;
-import jason.asSyntax.Literal;
-import jason.asSyntax.Structure;
-import jason.asSyntax.Term;
-
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.semanticweb.owl.model.OWLAxiom;
-import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
-import org.semanticweb.owl.model.OWLClassAssertionAxiom;
-import org.semanticweb.owl.model.OWLConstant;
-import org.semanticweb.owl.model.OWLDataPropertyAssertionAxiom;
-import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
-import org.semanticweb.owl.model.OWLIndividual;
-import org.semanticweb.owl.model.OWLIndividualAxiom;
-import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom;
-import org.semanticweb.owl.model.OWLOntology;
-import org.semanticweb.owl.model.OWLTypedConstant;
-
-
-/**
- * Accepts an arbitrary OWLIndividualAxiom and, depending on its type, creates a SE-Literal encoding of it.
- * Will always result in a ground SELiteral (since OWLIndividualAxioms must always be ground)<p>
- * For example:
- * <ul>
- * <li>ClassAssertion(Hotel hilton) -> hotel(hilton)[o(travel)]</li>
- * <li>ObjectPropertyAssertion(hasRating hilton ThreeStarRating) -> hasRating(hilton,threeStarRating)[o(travel)]</li>
- * <li>DifferentIndividuals( fourSeasons hilton ) -> all_different([hilton,fourSeasons])[o(travel)]</li>
- * </ul>
- * @author Tom Klapiscak
- *
- */
-public class ToSELiteralConverter {
-
- /**
- * The agent this converter is working on behalf of. Required for access to managers.
- */
- private JasdlAgent agent;
-
- public ToSELiteralConverter(JasdlAgent agent){
- this.agent = agent;
- }
-
- /**
- * Fetches and deseralises and returns all ASSERTED annotations of the supplied axiom.
- * TODO: Shift to a factory?
- * @param sl
- */
- public static List<Term> getAssertedAnnotations(OWLAxiom axiom, OWLOntology ontology){
- List<Term> result = new Vector<Term>();
- // get annotations
- Set<OWLAxiomAnnotationAxiom> annotAxioms = axiom.getAnnotationAxioms(ontology);
- for(OWLAxiomAnnotationAxiom annotAxiom : annotAxioms){ // remember, possibly semantically-naive payload!
- Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
- result.add(annot);
- }
- return result;
- }
-
-
- /**
- * Polymorphically applies appropriate factory method depending on specialisation of axiom
- * @param axiom
- * @return
- * @throws JasdlException if specialisation of axiom is not of an appropriate type for conversion to a SELiteral
- */
- public SELiteral convert(OWLIndividualAxiom axiom) throws JasdlException{
- if(axiom instanceof OWLClassAssertionAxiom){
- return convert((OWLClassAssertionAxiom)axiom);
- }else if(axiom instanceof OWLObjectPropertyAssertionAxiom){
- return convert((OWLObjectPropertyAssertionAxiom)axiom);
- }else if(axiom instanceof OWLDataPropertyAssertionAxiom){
- return convert((OWLDataPropertyAssertionAxiom)axiom);
- }else if(axiom instanceof OWLDifferentIndividualsAxiom){
- return convert((OWLDifferentIndividualsAxiom) axiom);
- }else{
- throw new JasdlException(axiom+" is not of an appropriate type for conversion to a SELiteral");
- }
- }
-
- /**
- * Convert an axiom asserting class membership to a unary SELiteral
- * @param axiom the axiom to convert
- * @return a unary SELiteral encoding of axiom
- * @throws JasdlException
- */
- public SELiteral convert(OWLClassAssertionAxiom axiom) throws JasdlException{
- Alias alias = agent.getAliasManager().getLeft(axiom.getDescription());
- Literal l = construct(alias);
- Atom i = agent.getAliasManager().getLeft(axiom.getIndividual()).getFunctor(); // TODO: what if individual is previously undefined? possible?
- l.addTerm(i);
-
- SELiteral sl = agent.getSELiteralFactory().create(l);
- sl.getLiteral().addAnnots(getAssertedAnnotations(axiom, sl.getOntology()));
- return sl;
- }
-
- /**
- * Convert an axiom asserting that two individuals are related by an object property to a binary SELiteral
- * @param axiom the axiom to convert
- * @return an binary SELiteral encoding of axiom
- * @throws JasdlException
- */
- public SELiteral convert(OWLObjectPropertyAssertionAxiom axiom) throws JasdlException{
- Alias alias = agent.getAliasManager().getLeft(axiom.getProperty().asOWLObjectProperty());
- Literal l = construct(alias);
- Atom s = agent.getAliasManager().getLeft(axiom.getSubject()).getFunctor();
- l.addTerm(s);
- Atom o = agent.getAliasManager().getLeft(axiom.getObject()).getFunctor();
- l.addTerm(o);
-
- SELiteral sl = agent.getSELiteralFactory().create(l);
- sl.getLiteral().addAnnots(getAssertedAnnotations(axiom, sl.getOntology()));
- return sl;
- }
-
- /**
- * Convert an axiom asserting that two individuals are related by a data property to a binary SELiteral
- * @param axiom the axiom to convert
- * @return a binary SELiteral encoding of axiom
- * @throws JasdlException
- */
- public SELiteral convert(OWLDataPropertyAssertionAxiom axiom) throws JasdlException{
- Alias alias = agent.getAliasManager().getLeft(axiom.getProperty().asOWLDataProperty());
- Literal l = construct(alias);
- Atom s = agent.getAliasManager().getLeft(axiom.getSubject()).getFunctor();
- l.addTerm(s);
-
- Term o;
- OWLConstant constant = axiom.getObject();
- if(constant.isTyped()){
- OWLTypedConstant ot = constant.asOWLTypedConstant();
- XSDDataType xsd = XSDDataTypeUtils.get(ot.getDataType().toString());
- // surround with quotes if necessary for representation in AgentSpeak syntax
- if(XSDDataTypeUtils.isStringType(xsd)){
- o = DefaultTerm.parse("\""+constant.getLiteral().toString()+"\"");
- }else if(XSDDataTypeUtils.isBooleanType(xsd)){
- if(Boolean.parseBoolean(ot.getLiteral().toString())){
- o = Literal.LTrue;
- }else{
- o = Literal.LFalse;
- }
- }else{
- o = DefaultTerm.parse(constant.getLiteral().toString());
- }
- }else{
- throw new JasdlException("JASDL does not support untyped data ranges such as: "+axiom);
- }
-
- l.addTerm(o);
-
- SELiteral sl = agent.getSELiteralFactory().create(l);
- sl.getLiteral().addAnnots(getAssertedAnnotations(axiom, sl.getOntology()));
- return sl;
- }
-
- /**
- * Convert an axiom asserting that a set of individuals are distinct to a unary SELiteral (whose term is a list and functor is "all_different")
- * @param axiom the axiom to convert
- * @return a unary SELiteral (whose term is a list and functor is "all_different") encoding of axiom
- * @throws JasdlException
- */
- public SELiteral convert(OWLDifferentIndividualsAxiom axiom) throws JasdlException{
- ListTerm list = new ListTermImpl(); // TODO: override this object's unify method to perform set, not list, unification?
- Set<OWLIndividual> is = axiom.getIndividuals();
- if(is.size() == 0){
- throw new JasdlException("All different assertion must contain some individuals! "+axiom);
- }
- Alias iAlias = null;
- for(OWLIndividual i : is){
- iAlias = agent.getAliasManager().getLeft(i);
- list.add(iAlias.getFunctor());
- }
- // hack, get a reference back to ontology by examining one of the individuals
- Alias alias = agent.getAliasManager().getLeft(new AllDifferentPlaceholder(iAlias.getLabel()));
- Literal l = construct(alias);
-
- l.addTerm(list);
-
- SELiteral sl = agent.getSELiteralFactory().create(l);
- sl.getLiteral().addAnnots(getAssertedAnnotations(axiom, sl.getOntology()));
- return sl;
- }
-
-
- /**
- * Common SELiteral construction code: sets functor, negation (based on presence of "~" prefix) and ontology annotation.
- * Results in a SELiteral with no arguments.
- * @param alias the alias from which to construct this SELiteral
- * @return an SELiteral corresponding to alias with no arguments
- */
- public Literal construct(Alias alias){
- // construct a new literal (with no terms) based on alias
- boolean sign = true;
- String functor = alias.getFunctor().toString();
- //~ might be present
- if(functor.startsWith("~")){
- functor = functor.substring(1);
- sign = false;
- }
- Literal l = new Literal(sign, functor);
-
- // add ontology annotation
- Structure o = new Structure(SELiteral.ONTOLOGY_ANNOTATION_FUNCTOR);
- o.addTerm(alias.getLabel());
- l.addAnnot(o);
-
- return l;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-04-02 17:09:56
|
Revision: 1193
http://jason.svn.sourceforge.net/jason/?rev=1193&view=rev
Author: tomklapiscak
Date: 2008-04-02 10:09:55 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Structural Improvements.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/XSDDataType.java
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/XSDDataTypeUtils.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/
trunk/applications/jasdl-owlapi/src/jasdl/bridge/label/
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/xsd/
trunk/applications/jasdl-owlapi/src/jasdl/test/blank.asl
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/XSDDataType.java
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/XSDDataTypeUtils.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 17:09:55 UTC (rev 1193)
@@ -40,12 +40,12 @@
* jasdl_reasonerClass = "uk.ac.manchester.cs.factplusplus.owlapi.Reasoner",
*/
- jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
+ jasdl_default_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
jasdl_ontologies="travel",
jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- /*jasdl_travel_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
+ /*jasdl_travel_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
jasdl_travel_mapping_manual="small_beach=beach", // these manual mappings will override any automatic mappings made by strategies,
// static trust ratings, mainly for testing purposes - likely to change
@@ -61,17 +61,17 @@
customer
customer.asl
[
- /* jasdl_default_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy", */ // defaults to this
+ /* jasdl_default_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy", */ // defaults to this
jasdl_useBeliefRevision = "true",
jasdl_ontologies="holidays,places",
jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- jasdl_holidays_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy",
+ jasdl_holidays_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
- jasdl_places_mapping_strategies="jasdl.bridge.alias.DecapitaliseMappingStrategy"
+ jasdl_places_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy"
]
agentArchClass jasdl.architecture.JasdlAgArch
agentClass jasdl.asSemantics.JasdlAgent
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -23,8 +23,8 @@
import static jasdl.architecture.JasdlAgArch.NAMED_ANNOTATION_FUNCTOR;
import static jasdl.util.Common.strip;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.bridge.alias.Alias;
-import jasdl.bridge.alias.AliasFactory;
+import jasdl.bridge.factory.AliasFactory;
+import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.util.DuplicateMappingException;
import jasdl.util.JasdlException;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -59,7 +59,7 @@
Literal result = l;
try{
- SELiteral sl = agent.getSELiteralFactory().create(l);
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
// qualify o
sl.qualifyOntologyAnnotation();
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -9,18 +9,18 @@
import jasdl.bb.revision.JasdlIncisionFunction;
import jasdl.bb.revision.JasdlReasonerFactory;
import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
-import jasdl.bridge.AllDifferentPlaceholder;
-import jasdl.bridge.ToAxiomConverter;
-import jasdl.bridge.ToSELiteralConverter;
-import jasdl.bridge.alias.Alias;
-import jasdl.bridge.alias.AliasFactory;
-import jasdl.bridge.alias.AliasManager;
-import jasdl.bridge.alias.DefinitionManager;
-import jasdl.bridge.alias.MappingStrategy;
-import jasdl.bridge.label.LabelManager;
-import jasdl.bridge.label.OntologyURIManager;
+import jasdl.bridge.factory.AliasFactory;
+import jasdl.bridge.factory.AxiomToSELiteralConverter;
+import jasdl.bridge.factory.SELiteralFactory;
+import jasdl.bridge.factory.SELiteralToAxiomConverter;
+import jasdl.bridge.mapping.aliasing.Alias;
+import jasdl.bridge.mapping.aliasing.AliasManager;
+import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
+import jasdl.bridge.mapping.aliasing.DefinitionManager;
+import jasdl.bridge.mapping.aliasing.MappingStrategy;
+import jasdl.bridge.mapping.label.LabelManager;
+import jasdl.bridge.mapping.label.OntologyURIManager;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.bridge.seliteral.SELiteralFactory;
import jasdl.util.DuplicateMappingException;
import jasdl.util.InvalidSELiteralException;
import jasdl.util.JasdlException;
@@ -57,6 +57,7 @@
import org.semanticweb.owl.inference.OWLReasonerException;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLClass;
+import org.semanticweb.owl.model.OWLDataFactory;
import org.semanticweb.owl.model.OWLDescription;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLEquivalentClassesAxiom;
@@ -77,8 +78,8 @@
private AliasManager aliasManager;
private LabelManager labelManager;
private SELiteralFactory seLiteralFactory;
- private ToSELiteralConverter toSELiteralConverter;
- private ToAxiomConverter toAxiomConverter;
+ private AxiomToSELiteralConverter axiomToSELiteralConverter;
+ private SELiteralToAxiomConverter SELiteralToAxiomConverter;
private OntologyURIManager logicalURIManager;
private OntologyURIManager physicalURIManager;
private ManchesterOWLSyntaxOWLObjectRendererImpl manchesterObjectRenderer;
@@ -111,8 +112,8 @@
definitionManager = new DefinitionManager();
seLiteralFactory = new SELiteralFactory(this);
- toAxiomConverter = new ToAxiomConverter(this);
- toSELiteralConverter = new ToSELiteralConverter(this);
+ SELiteralToAxiomConverter = new SELiteralToAxiomConverter(this);
+ axiomToSELiteralConverter = new AxiomToSELiteralConverter(this);
knownAgentNames = new Vector<String>();
trustMap = new HashMap<Atom, Float>();
@@ -134,35 +135,8 @@
}
- public void setReasoner(OWLReasoner reasoner){
- this.reasoner = reasoner;
- }
- public void addKnownAgentName(String name){
- knownAgentNames.add(name);
- }
- public List<String> getKnownAgentNames(){
- return knownAgentNames;
- }
-
-
- public void setReasonerLogLevel(org.apache.log4j.Level level){
- if(reasoner instanceof org.mindswap.pellet.owlapi.Reasoner){
- org.mindswap.pellet.owlapi.Reasoner pellet = (org.mindswap.pellet.owlapi.Reasoner)reasoner;
- Log4JLogger abox_logger = (Log4JLogger)pellet.getKB().getABox().log;
- abox_logger.getLogger().setLevel(level);
-
- Log4JLogger taxonomy_logger = (Log4JLogger)pellet.getKB().getTaxonomy().log;
- taxonomy_logger.getLogger().setLevel(level);
-
- Log4JLogger kb_logger = (Log4JLogger)pellet.getKB().log;
- kb_logger.getLogger().setLevel(level);
- }
- }
-
-
-
@Override
public TransitionSystem initAg(AgArch arch, BeliefBase bb, String src, Settings stts) throws JasonException {
if(!(bb instanceof JasdlBeliefBase)){
@@ -192,7 +166,7 @@
List<Literal> bels = new Vector<Literal>();
for(OWLOntology ontology : ontologyManager.getOntologies()){
for(OWLIndividualAxiom axiom : ontology.getIndividualAxioms()){
- Literal l = toSELiteralConverter.convert(axiom).getLiteral();
+ Literal l = axiomToSELiteralConverter.convert(axiom).getLiteral();
bels.add(l);
}
}
@@ -236,7 +210,7 @@
}else if(beliefToAdd != null){
try{
getLogger().fine("Revise: +"+beliefToAdd);
- SELiteral sl = getSELiteralFactory().create(beliefToAdd);
+ SELiteral sl = getSELiteralFactory().construct(beliefToAdd);
OWLAxiom axiomToAdd = sl.createAxiom();
BeliefBaseSemiRevisor bbrev = new BeliefBaseSemiRevisor(axiomToAdd, getOntologyManager(), new JasdlReasonerFactory(), getLogger());
List<OWLAxiom> contractList = bbrev.revise(new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(this, sl));
@@ -244,7 +218,7 @@
// will only have reached here if new belief is accepted.
addList.add(beliefToAdd);
for(OWLAxiom contract : contractList){
- removeList.add(toSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
+ removeList.add(axiomToSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
}
revisionApplied = true;
}catch(RevisionFailedException e){
@@ -579,6 +553,21 @@
}
}
+
+ public void setReasonerLogLevel(org.apache.log4j.Level level){
+ if(reasoner instanceof org.mindswap.pellet.owlapi.Reasoner){
+ org.mindswap.pellet.owlapi.Reasoner pellet = (org.mindswap.pellet.owlapi.Reasoner)reasoner;
+ Log4JLogger abox_logger = (Log4JLogger)pellet.getKB().getABox().log;
+ abox_logger.getLogger().setLevel(level);
+
+ Log4JLogger taxonomy_logger = (Log4JLogger)pellet.getKB().getTaxonomy().log;
+ taxonomy_logger.getLogger().setLevel(level);
+
+ Log4JLogger kb_logger = (Log4JLogger)pellet.getKB().log;
+ kb_logger.getLogger().setLevel(level);
+ }
+ }
+
/**
* *Must* be unique within society!
* @return
@@ -586,20 +575,15 @@
public String getAgentName(){
return getTS().getUserAgArch().getAgName();
}
-
public List<MappingStrategy> getDefaultMappingStrategies() {
return defaultMappingStrategies;
}
-
-
public void setDefaultMappingStrategies(List<MappingStrategy> defaultMappingStrategies) {
this.defaultMappingStrategies = defaultMappingStrategies;
}
-
-
public Atom getPersonalOntologyLabel(){
return new Atom("self");
}
@@ -612,7 +596,6 @@
return URI.create("http://www.dur.ac.uk/t.g.klapiscak/self"+label+".owl");
}
-
public AliasManager getAliasManager() {
return aliasManager;
}
@@ -637,8 +620,6 @@
return definitionManager;
}
-
-
public OWLReasoner getReasoner() {
return reasoner;
}
@@ -647,12 +628,12 @@
return seLiteralFactory;
}
- public ToAxiomConverter getToAxiomConverter() {
- return toAxiomConverter;
+ public SELiteralToAxiomConverter getSELiteralToAxiomConverter() {
+ return SELiteralToAxiomConverter;
}
- public ToSELiteralConverter getToSELiteralConverter() {
- return toSELiteralConverter;
+ public AxiomToSELiteralConverter getAxiomToSELiteralConverter() {
+ return axiomToSELiteralConverter;
}
public ManchesterOWLSyntaxOWLObjectRendererImpl getManchesterObjectRenderer() {
@@ -666,7 +647,31 @@
public ManchesterOWLSyntaxDescriptionParser getManchesterURIDescriptionParser() {
return manchesterURIDescriptionParser;
}
+
+ public boolean isBeliefRevisionEnabled() {
+ return beliefRevisionEnabled;
+ }
+ public void setBeliefRevisionEnabled(boolean beliefRevisionEnabled) {
+ this.beliefRevisionEnabled = beliefRevisionEnabled;
+ }
+
+ public OWLDataFactory getOWLDataFactory(){
+ return getOntologyManager().getOWLDataFactory();
+ }
+
+ public void setReasoner(OWLReasoner reasoner){
+ this.reasoner = reasoner;
+ }
+
+ public void addKnownAgentName(String name){
+ knownAgentNames.add(name);
+ }
+
+ public List<String> getKnownAgentNames(){
+ return knownAgentNames;
+ }
+
public void setTrustRating(Atom name, float trust){
trustMap.remove(name);
trustMap.put(name, trust);
@@ -676,19 +681,7 @@
return trustMap.get(name);
}
-
-
-
-
- public boolean isBeliefRevisionEnabled() {
- return beliefRevisionEnabled;
- }
-
- public void setBeliefRevisionEnabled(boolean beliefRevisionEnabled) {
- this.beliefRevisionEnabled = beliefRevisionEnabled;
- }
-
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -2,10 +2,10 @@
import static jasdl.util.Common.DELIM;
import static jasdl.util.Common.strip;
-import jasdl.bridge.alias.Alias;
-import jasdl.bridge.alias.AliasFactory;
-import jasdl.bridge.alias.DecapitaliseMappingStrategy;
-import jasdl.bridge.alias.MappingStrategy;
+import jasdl.bridge.factory.AliasFactory;
+import jasdl.bridge.mapping.aliasing.Alias;
+import jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy;
+import jasdl.bridge.mapping.aliasing.MappingStrategy;
import jasdl.util.JasdlConfigurationException;
import jasdl.util.JasdlException;
import jason.asSyntax.Atom;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/NSPrefixEntityChecker.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -1,7 +1,7 @@
package jasdl.asSemantics.parsing;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.bridge.alias.Alias;
-import jasdl.bridge.alias.AliasFactory;
+import jasdl.bridge.factory.AliasFactory;
+import jasdl.bridge.mapping.aliasing.Alias;
import jason.asSyntax.Atom;
import org.semanticweb.owl.expression.OWLEntityChecker;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -53,7 +53,7 @@
@Override
public void add(Plan p) throws JasonException {
try{
- agent.getSELiteralFactory().create(p.getTrigger().getLiteral());
+ agent.getSELiteralFactory().construct(p.getTrigger().getLiteral());
super.add(new SEPlan(agent, p));
}catch(NotEnrichedException e){
super.add(p);
@@ -142,7 +142,7 @@
*/
public static List<Trigger> getMoreGeneralTriggers(JasdlAgent agent, Trigger te) throws JasdlException{
Literal l = te.getLiteral();
- SELiteral sl = agent.getSELiteralFactory().create(l);
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
if(l.negated()){
throw new JasdlException("JASDL cannot generalise strongly negated triggers");
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -41,7 +41,7 @@
getLogger().fine("Adding "+l);
try{
- SELiteral sl = agent.getSELiteralFactory().create(l);
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
OWLIndividualAxiom axiom = sl.createAxiom();
OWLOntology ontology = sl.getOntology();
@@ -92,7 +92,7 @@
getLogger().fine("Contracting "+l);
try{
- SELiteral sl = agent.getSELiteralFactory().create(l);
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
OWLOntology ontology = sl.getOntology();
OWLIndividualAxiom axiom = sl.createAxiom();
@@ -157,8 +157,8 @@
}catch(NotEnrichedException e){
return super.remove(l); // semantically-naive, use standard Jason mechanisms
}catch(Exception e){
- getLogger().warning("Exception caught removing SELiteral "+l+" from belief base: ");
- e.printStackTrace();
+ getLogger().fine("Exception caught removing SELiteral "+l+" from belief base: ");
+ //e.printStackTrace();
return false;
}
}
@@ -167,7 +167,7 @@
public Literal contains(Literal l) {
agent.getLogger().fine("Contains: "+l);
try {
- SELiteral sl = agent.getSELiteralFactory().create(l);
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
OWLIndividualAxiom axiom = sl.createAxiom();
if(sl.getOntology().containsAxiom(axiom)){
Iterator<Literal> it = getCandidateBeliefs(l, null);
@@ -184,6 +184,7 @@
}
}
+
@Override
@@ -195,10 +196,10 @@
Set<Literal> relevant = new HashSet<Literal>();
try{
- SELiteral sl = agent.getSELiteralFactory().create(l);
- Set<OWLIndividualAxiom> axioms = sl.getAxioms();
+ SELiteral sl = agent.getSELiteralFactory().construct(l);
+ Set<OWLIndividualAxiom> axioms = sl.getAxioms(); // <- really just a wrapper for this method
for(OWLIndividualAxiom axiom : axioms){
- SELiteral found = agent.getToSELiteralConverter().convert(axiom);
+ SELiteral found = agent.getAxiomToSELiteralConverter().convert(axiom);
// hack, gets around non-consistent ordering of OWLDifferentIndividualAxiom individuals
// -- just check list membership is equivalent (i.e. treat as sets)
@@ -211,10 +212,8 @@
}
}
- relevant.add(found.getLiteral());
+ relevant.add(found.getLiteral());
-
-
}
getLogger().fine("... found: "+relevant);
if(relevant.isEmpty()){
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java 2008-04-02 17:05:13 UTC (rev 1192)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -73,7 +73,7 @@
if(axiom.equals(toAddLiteral.createAxiom())){ // hack to get the annotations of the NOT YET ADDED toAdd axiom
sources = toAddLiteral.getLiteral().getSources();
}else{
- SELiteral sl = agent.getToSELiteralConverter().convert((OWLIndividualAxiom)axiom); // kernel filter ensures axiom is an OWLIndividualAxiom
+ SELiteral sl = agent.getAxiomToSELiteralConverter().convert((OWLIndividualAxiom)axiom); // kernel filter ensures axiom is an OWLIndividualAxiom
sources = sl.getLiteral().getSources();
}
agent.getLogger().finest("Sources of "+axiom+"="+sources);
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java (from rev 1190, trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/AliasFactory.java)
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -0,0 +1,64 @@
+package jasdl.bridge.factory;
+
+import jasdl.bridge.mapping.aliasing.Alias;
+import jasdl.bridge.seliteral.SELiteral;
+import jasdl.util.JasdlException;
+import jason.asSyntax.Atom;
+
+/**
+ * A convenient singleton factory providing methods to create JASDL alias objects.
+ *
+ * @author Tom Klapiscak
+ *
+ */
+public class AliasFactory {
+ public static Atom OWL_NAMESPACE_LABEL = new Atom("owl");
+
+ /**
+ * A singleton alias mapped to the universal owl:thing concept
+ */
+ public static Alias OWL_THING = new Alias(new Atom("thing"), OWL_NAMESPACE_LABEL);
+
+ /**
+ * A singleton alias mapped to the universal owl:nothing concept
+ */
+ public static Alias OWL_NOTHING = new Alias(new Atom("nothing"), OWL_NAMESPACE_LABEL);
+
+
+ public static Atom OWL_NOTHING_FUNCTOR = new Atom("nothing");
+ public static Atom OWL_ALL_DIFFERENT_FUNCTOR = new Atom("all_different");
+
+
+ /**
+ * Singleton instance we should use.
+ */
+ public static AliasFactory INSTANCE = new AliasFactory();
+
+ private AliasFactory(){
+ }
+
+ /**
+ * Create an alias to represent an SELiteral. Literal functor becomes alias functor.
+ * Literal ontology label becomes alias label;
+ * If l is negated (and a unary class assertion) then functor is prefixed with "~".
+ * @param sl the SELiteral the alias will represent
+ * @return an alias representing the supplied SELiteral
+ */
+ public Alias create(SELiteral sl) throws JasdlException{
+ return new Alias( (sl.getLiteral().negated()?"~":"") + sl.getLiteral().getFunctor(), sl.getOntologyLabel());
+ }
+
+ /**
+ * Create an alias from an atomic functor and label
+ * @param functor
+ * @param label
+ * @return
+ */
+ public Alias create(Atom functor, Atom label){
+ return new Alias(functor, label);
+ }
+
+ public Alias all_different(Atom label){
+ return new Alias(OWL_ALL_DIFFERENT_FUNCTOR, label);
+ }
+}
Added: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-04-02 17:09:55 UTC (rev 1193)
@@ -0,0 +1,193 @@
+package jasdl.bridge.factory;
+
+import jasdl.asSemantics.JasdlAgent;
+import jasdl.bridge.mapping.aliasing.Alias;
+import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
+import jasdl.bridge.seliteral.SELiteral;
+import jasdl.util.InvalidSELiteralException;
+import jasdl.util.JasdlException;
+import jasdl.util.UnknownMappingException;
+import jasdl.util.xsd.XSDDataType;
+import jasdl.util.xsd.XSDDataTypeUtils;
+import jason.asSyntax.Atom;
+import jason.asSyntax.DefaultTerm;
+import jason.asSyntax.Literal;
+import jason.asSyntax.Term;
+
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import org.semanticweb.owl.model.OWLAxiom;
+import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
+import org.semanticweb.owl.model.OWLClassAssertionAxiom;
+import org.semanticweb.owl.model.OWLConstant;
+import org.semanticweb.owl.model.OWLDataPropertyAssertionAxiom;
+import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
+import org.semanticweb.owl.model.OWLIndividual;
+import org.semanticweb.owl.model.OWLIndividualAxiom;
+import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom;
+import org.semanticweb.owl.model.OWLOntology;
+import org.semanticweb.owl.model.OWLTypedConstant;
+
+
+/**
+ * Accepts an arbitrary OWLIndividualAxiom and, depending on its type, creates a SE-Literal encoding of it.
+ * Will always result in a ground SELiteral (since OWLIndividualAxioms must always be ground)<p>
+ * For example:
+ * <ul>
+ * <li>ClassAssertion(Hotel hilton) -> hotel(hilton)[o(travel)]</li>
+ * <li>ObjectPropertyAssertion(hasRating hilton ThreeStarRating) -> hasRating(hilton,threeStarRating)[o(travel)]</li>
+ * <li>DifferentIndividuals( fourSeasons hilton ) -> all_different([hilton,fourSeasons])[o(travel)]</li>
+ * </ul>
+ * @author Tom Klapiscak
+ *
+ */
+public class AxiomToSELiteralConverter {
+
+ /**
+ * The agent this converter is working on behalf of. Required for access to managers.
+ */
+ private JasdlAgent agent;
+
+ public AxiomToSELiteralConverter(JasdlAgent agent){
+ this.agent = agent;
+ }
+
+ /**
+ * Fetches and deseralises and returns all ASSERTED annotations of the supplied axiom.
+ * TODO: Shift to a factory?
+ * @param sl
+ */
+ public static List<Term> getAssertedAnnotations(OWLAxiom axiom, OWLOntology ontology){
+ List<Term> result = new Vector<Term>();
+ // get annotations
+ Set<OWLAxiomAnnotationAxiom> annotAxioms = axiom.getAnnotationAxioms(ontology);
+ for(OWLAxiomAnnotationAxiom annotAxiom : annotAxioms){ // remember, possibly semantically-naive payload!
+ Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
+ result.add(annot);
+ }
+ return result;
+ }
+
+
+ /**
+ * Polymorphically applies appropriate factory method depending on specialisation of axiom
+ * @param axiom
+ * @return
+ * @throws JasdlException if specialisation of axiom is not of an appropriate type for conversion to a SELiteral
+ */
+ public SELiteral convert(OWLIndividualAxiom axiom) throws JasdlException{
+ if(axiom instanceof OWLClassAssertionAxiom){
+ return convert((OWLClassAssertionAxiom)axiom);
+ }else if(axiom instanceof OWLObjectPropertyAssertionAxiom){
+ return convert((OWLObjectPropertyAssertionAxiom)axiom);
+ }else if(axiom instanceof OWLDataPropertyAssertionAxiom){
+ return convert((OWLDataPropertyAssertionAxiom)axiom);
+ }else if(axiom instanceof OWLDifferentIndividualsAxiom){
+ return convert((OWLDifferentIndividualsAxiom) axiom);
+ }else{
+ throw new JasdlException(axiom+" is not of an appropriate type for conversion to a SELiteral");
+ }
+ }
+
+
+ /**
+ * Convert an axiom asserting class membership to a unary SELiteral
+ * @param axiom the axiom to convert
+ * @return a unary SELiteral encoding of axiom
+ * @throws JasdlException
+ */
+ public SELiteral convert(OWLClassAssertionAxiom axiom) throws JasdlException{
+ Alias alias = agent.getAliasManager().getLeft(axiom.getDescription());
+ Atom individual = agent.getAliasManager().getLeft(axiom.getIndividual()).getFunctor(); // TODO: what if individual is previously undefined? possible?
+ return agent.getSELiteralFactory().construct(alias, individual, getAnnots(alias, axiom));
+ }
+
+ /**
+ * Convert an axiom asserting that two individuals are related by an object property to a binary SELiteral
+ * @param axiom the axiom to convert
+ * @return an binary SELiteral encoding of axiom
+ * @throws JasdlException
+ */
+ public SELiteral convert(OWLObjectPropertyAssertionAxiom axiom) throws JasdlException{
+ Alias alias = agent.getAliasManager().getLeft(axiom.getProperty().asOWLObjectProperty());
+ Atom subject = agent.getAliasManager().getLeft(axiom.getSubject()).getFunctor();
+ Atom object = agent.getAliasManager().getLeft(axiom.getObject()).getFunctor();
+ return agent.getSELiteralFactory().construct(alias, subject, object, getAnnots(alias, axiom));
+ }
+
+ /**
+ * Convert an axiom asserting that two individuals are related by a data property to a binary SELiteral
+ * @param axiom the axiom to convert
+ * @return a binary SELiteral encoding of axiom
+ * @throws JasdlException
+ */
+ public SELiteral convert(OWLDataPropertyAssertionAxiom axiom) throws JasdlException{
+ Alias alias = agent.getAliasManager().getLeft(axiom.getProperty().asOWLDataProperty());
+ Atom subject = agent.getAliasManager().getLeft(axiom.getSubject()).getFunctor();
+ Term object;
+ OWLConstant constant = axiom.getObject();
+ if(constant.isTyped()){
+ OWLTypedConstant ot = constant.asOWLTypedConstant();
+ XSDDataType xsd = XSDDataTypeUtils.get(ot.getDataType().toString());
+ // surround wi...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-02 17:26:48
|
Revision: 1194
http://jason.svn.sourceforge.net/jason/?rev=1194&view=rev
Author: tomklapiscak
Date: 2008-04-02 10:26:44 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Structural improvements (problems with last 3 revisions)
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/Alias.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DecapitaliseMappingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DefinitionManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/MappingStrategy.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 17:09:55 UTC (rev 1193)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 17:26:44 UTC (rev 1194)
@@ -43,7 +43,8 @@
jasdl_default_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy", // applied to incoming ontologies and those given no automapping
jasdl_ontologies="travel",
- jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
+ //jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
+ jasdl_travel_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
/*jasdl_travel_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
jasdl_travel_mapping_manual="small_beach=beach", // these manual mappings will override any automatic mappings made by strategies,
@@ -65,12 +66,12 @@
jasdl_useBeliefRevision = "true",
jasdl_ontologies="holidays,places",
- jasdl_holidays_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
+ jasdl_holidays_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
- jasdl_places_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/places.owl",
+ jasdl_places_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl",
jasdl_places_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy"
]
agentArchClass jasdl.architecture.JasdlAgArch
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 17:09:55 UTC (rev 1193)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -89,7 +89,7 @@
throw new JasdlException("Unknown reasoner class: "+reasonerClass);
}else{
agent.setReasoner(reasoner);
- agent.setReasonerLogLevel(Level.WARN);
+ agent.setReasonerLogLevel(Level.FATAL);
}
}catch (Throwable e) {
throw new JasdlException("Error instantiating reasoner "+reasonerClass+". Reason: "+e);
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing (from rev 1189, trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias)
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/Alias.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/Alias.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/Alias.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -1,4 +1,4 @@
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
import jason.asSyntax.Atom;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/AliasFactory.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -1,4 +1,4 @@
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.util.JasdlException;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/AliasManager.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasManager.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -1,6 +1,6 @@
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
-import jasdl.bridge.MappingManager;
+import jasdl.bridge.mapping.MappingManager;
import org.semanticweb.owl.model.OWLObject;
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java (from rev 1189, trunk/applications/jasdl-owlapi/src/jasdl/bridge/AllDifferentPlaceholder.java)
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -0,0 +1,118 @@
+package jasdl.bridge.mapping.aliasing;
+
+import jason.asSyntax.Atom;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.semanticweb.owl.model.OWLAnnotation;
+import org.semanticweb.owl.model.OWLAnnotationAxiom;
+import org.semanticweb.owl.model.OWLClass;
+import org.semanticweb.owl.model.OWLDataProperty;
+import org.semanticweb.owl.model.OWLDataType;
+import org.semanticweb.owl.model.OWLEntity;
+import org.semanticweb.owl.model.OWLEntityVisitor;
+import org.semanticweb.owl.model.OWLException;
+import org.semanticweb.owl.model.OWLIndividual;
+import org.semanticweb.owl.model.OWLNamedObjectVisitor;
+import org.semanticweb.owl.model.OWLObject;
+import org.semanticweb.owl.model.OWLObjectProperty;
+import org.semanticweb.owl.model.OWLObjectVisitor;
+import org.semanticweb.owl.model.OWLOntology;
+
+/**
+ * Since the all_different has no concrete entity associated with it, we create a "placeholder" so that it remains consistent with
+ * JASDL's mapping mechanisms. Entities of this type will be intercepted and dealt with differently.
+ * Associated with an ontology label which determines hash-code - required since each ontology must have its own placeholder to reference
+ * @author tom
+ *
+ */
+public class AllDifferentPlaceholder implements OWLEntity {
+ private Atom label;
+
+ public AllDifferentPlaceholder(Atom label){
+ this.label = label;
+ }
+
+ public void accept(OWLEntityVisitor visitor) {
+ }
+
+ public Set<OWLAnnotationAxiom> getAnnotationAxioms(OWLOntology ontology) {
+ return null;
+ }
+
+ public Set<OWLAnnotation> getAnnotations(OWLOntology ontology) {
+ return null;
+ }
+
+ public Set<OWLAnnotation> getAnnotations(OWLOntology ontology, URI annotationURI) {
+ return null;
+ }
+
+ public void accept(OWLObjectVisitor visitor) {
+
+ }
+
+ public void accept(OWLNamedObjectVisitor visitor) {
+ }
+
+ public URI getURI() {
+ return null;
+ }
+
+ public boolean equals(Object other){
+ if(!(other instanceof AllDifferentPlaceholder)){
+ return false;
+ }
+ return label.equals(((AllDifferentPlaceholder)other).label);
+ }
+
+ public int hashCode(){
+ return label.hashCode();
+ }
+
+ public OWLClass asOWLClass() {
+ return null;
+ }
+
+ public OWLDataProperty asOWLDataProperty() {
+ return null;
+ }
+
+ public OWLDataType asOWLDataType() {
+ return null;
+ }
+
+ public OWLIndividual asOWLIndividual() {
+ return null;
+ }
+
+ public OWLObjectProperty asOWLObjectProperty() {
+ return null;
+ }
+
+ public boolean isOWLClass() {
+ return false;
+ }
+
+ public boolean isOWLDataProperty() {
+ return false;
+ }
+
+ public boolean isOWLDataType() {
+ return false;
+ }
+
+ public boolean isOWLIndividual() {
+ return false;
+ }
+
+ public boolean isOWLObjectProperty() {
+ return false;
+ }
+
+ public int compareTo(OWLObject arg0) {
+ return 0;
+ }
+
+}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DecapitaliseMappingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DecapitaliseMappingStrategy.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DecapitaliseMappingStrategy.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -17,7 +17,7 @@
* along with JASDL. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
public class DecapitaliseMappingStrategy implements MappingStrategy {
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DefinitionManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/DefinitionManager.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DefinitionManager.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -1,6 +1,6 @@
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
-import jasdl.bridge.MappingManager;
+import jasdl.bridge.mapping.MappingManager;
import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLDescription;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/MappingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/alias/MappingStrategy.java 2008-04-01 23:35:02 UTC (rev 1189)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/MappingStrategy.java 2008-04-02 17:26:44 UTC (rev 1194)
@@ -17,7 +17,7 @@
* along with JASDL. If not, see <http://www.gnu.org/licenses/>.
*
*/
-package jasdl.bridge.alias;
+package jasdl.bridge.mapping.aliasing;
public interface MappingStrategy {
public String apply(String input);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-04-02 18:55:31
|
Revision: 1195
http://jason.svn.sourceforge.net/jason/?rev=1195&view=rev
Author: tomklapiscak
Date: 2008-04-02 11:55:20 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Locally resident ontologies can now be specified using relative
filenames. Further structural refactoring.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/LabelManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/util/Common.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/XSDDataType.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/XSDDataTypeUtils.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/DuplicateMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/InvalidSELiteralException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JasdlConfigurationException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JasdlException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/NotEnrichedException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/UnknownMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NSPrefixOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/URIOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/URIOWLObjectRenderer.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/parsing/
trunk/applications/jasdl-owlapi/src/jasdl/util/DuplicateMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/InvalidSELiteralException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JasdlConfigurationException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JasdlException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/NotEnrichedException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/UnknownMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NSPrefixEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/URIEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/xsd/
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 18:55:20 UTC (rev 1195)
@@ -44,7 +44,7 @@
jasdl_ontologies="travel",
//jasdl_travel_uri="http://www.dur.ac.uk/t.g.klapiscak/onts/travel.owl",
- jasdl_travel_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
+ jasdl_travel_uri="/ontologies/travel.owl",
/*jasdl_travel_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",*/ // defaults can be overriden per-ontology here
jasdl_travel_mapping_manual="small_beach=beach", // these manual mappings will override any automatic mappings made by strategies,
@@ -66,12 +66,12 @@
jasdl_useBeliefRevision = "true",
jasdl_ontologies="holidays,places",
- jasdl_holidays_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl",
+ jasdl_holidays_uri="/ontologies/travel.owl",
jasdl_holidays_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",
jasdl_holidays_mapping_manual="small_beach=beach, luxuriousHotel=LuxuryHotel", // for demonstration of arbitrary primitive mappings being handled correctly
- jasdl_places_uri="file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl",
+ jasdl_places_uri="/ontologies/places.owl",
jasdl_places_mapping_strategies="jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy"
]
agentArchClass jasdl.architecture.JasdlAgArch
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -26,9 +26,9 @@
import jasdl.bridge.factory.AliasFactory;
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.DuplicateMappingException;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
+import jasdl.util.exception.DuplicateMappingException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
import jason.asSyntax.Atom;
import jason.asSyntax.ListTerm;
import jason.asSyntax.Literal;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -20,7 +20,7 @@
package jasdl.architecture;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.architecture.AgArch;
import jason.asSemantics.Message;
import jason.asSyntax.ListTerm;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -24,9 +24,9 @@
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
-import jasdl.util.UnknownMappingException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
+import jasdl.util.exception.UnknownMappingException;
import jason.asSyntax.ListTerm;
import jason.asSyntax.ListTermImpl;
import jason.asSyntax.Literal;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -20,7 +20,7 @@
package jasdl.architecture;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Literal;
public interface PropContProcessingStrategy {
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,8 +1,6 @@
package jasdl.asSemantics;
import static jasdl.util.Common.strip;
-import jasdl.asSemantics.parsing.NSPrefixEntityChecker;
-import jasdl.asSemantics.parsing.URIEntityChecker;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
import jasdl.bb.revision.BeliefBaseSemiRevisor;
@@ -21,11 +19,14 @@
import jasdl.bridge.mapping.label.LabelManager;
import jasdl.bridge.mapping.label.OntologyURIManager;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.DuplicateMappingException;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
-import jasdl.util.UnknownMappingException;
+import jasdl.util.exception.DuplicateMappingException;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
+import jasdl.util.exception.UnknownMappingException;
+import jasdl.util.owlapi.parsing.NSPrefixOWLEntityChecker;
+import jasdl.util.owlapi.parsing.URIOWLEntityChecker;
+import jasdl.util.owlapi.rendering.URIOWLObjectRenderer;
import jason.JasonException;
import jason.RevisionFailedException;
import jason.architecture.AgArch;
@@ -66,7 +67,6 @@
import org.semanticweb.owl.model.OWLOntologyChangeException;
import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLOntologyManager;
-import org.semanticweb.owl.util.ShortFormProvider;
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
@@ -119,16 +119,10 @@
trustMap = new HashMap<Atom, Float>();
manchesterObjectRenderer = new ManchesterOWLSyntaxOWLObjectRendererImpl();
- manchesterObjectRenderer.setShortFormProvider(new ShortFormProvider(){
- public void dispose() {
- }
- public String getShortForm(OWLEntity entity) {
- return entity.getURI().toString();
- }
- }); // we want fully qualified entity references
+ manchesterObjectRenderer.setShortFormProvider(new URIOWLObjectRenderer());
- manchesterNsPrefixDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixEntityChecker(this));
- manchesterURIDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new URIEntityChecker(this));
+ manchesterNsPrefixDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new NSPrefixOWLEntityChecker(this));
+ manchesterURIDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(ontologyManager.getOWLDataFactory(), new URIOWLEntityChecker(this));
// override plan library
setPL( new JasdlPlanLibrary(this) );
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,23 +1,25 @@
package jasdl.asSemantics;
import static jasdl.util.Common.DELIM;
+import static jasdl.util.Common.getCurrentDir;
import static jasdl.util.Common.strip;
import jasdl.bridge.factory.AliasFactory;
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy;
import jasdl.bridge.mapping.aliasing.MappingStrategy;
-import jasdl.util.JasdlConfigurationException;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlConfigurationException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Atom;
import jason.runtime.Settings;
import java.lang.reflect.Constructor;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
+import java.util.logging.Level;
-import org.apache.log4j.Level;
import org.semanticweb.owl.inference.OWLReasoner;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLOntology;
@@ -60,17 +62,13 @@
}
public void configure(Settings stts) throws JasdlException{
- try{
- loadReasoner(stts);
- loadDefaultMappingStrategies(stts);
- setUseBeliefRevision(stts);
- loadOntologies(stts);
- applyManualMappings(stts);
- loadKnownAgents(stts);
- loadTrustRatings(stts);
- }catch(JasdlException e){
- throw new JasdlException("JASDL agent encountered error during configuration. Reason: "+e);
- }
+ loadReasoner(stts);
+ loadDefaultMappingStrategies(stts);
+ setUseBeliefRevision(stts);
+ loadOntologies(stts);
+ applyManualMappings(stts);
+ loadKnownAgents(stts);
+ loadTrustRatings(stts);
}
@SuppressWarnings("unchecked")
@@ -89,7 +87,7 @@
throw new JasdlException("Unknown reasoner class: "+reasonerClass);
}else{
agent.setReasoner(reasoner);
- agent.setReasonerLogLevel(Level.FATAL);
+ agent.setReasonerLogLevel(org.apache.log4j.Level.FATAL);
}
}catch (Throwable e) {
throw new JasdlException("Error instantiating reasoner "+reasonerClass+". Reason: "+e);
@@ -116,19 +114,30 @@
* @param stts .mas2j settings
* @throws JasdlException if instantiation of an ontology fails
*/
- private void loadOntologies(Settings stts) throws JasdlException{
+ private void loadOntologies(Settings stts) throws JasdlConfigurationException{
String[] labels = splitUserParameter( stts, MAS2J_PREFIX + MAS2J_ONTOLOGIES );
for(String label : labels){
if(reservedOntologyLabels.contains(label)){
- throw new JasdlException(label+" is a reserved ontology label");
+ throw new JasdlConfigurationException(label+" is a reserved ontology label");
}
String _uri = prepareUserParameter( stts, MAS2J_PREFIX + "_" + label + MAS2J_URI );
URI uri = null;
try {
- uri = new URI(_uri);
+ try{
+ uri = new URI(_uri);
+ if(!uri.isAbsolute()){
+ throw new URISyntaxException("", "");
+ }
+ }catch(URISyntaxException urie){
+ _uri = "file://"+getCurrentDir()+_uri;
+ uri = new URI(_uri); // try relative path
+ agent.getLogger().fine("Loaded ontology "+_uri+" from relative uri");
+ }
agent.loadOntology(new Atom(label), uri, getMappingStrategies(stts, new Atom(label)));
} catch (Exception e) {
- throw new JasdlException("Unable to instantiate ontology "+_uri+" (\""+label+"\"). Reason: "+e);
+ String msg = "Unable to instantiate ontology \""+_uri+"\" ("+label+")";
+ agent.getLogger().log(Level.SEVERE, msg, e);
+ throw new JasdlConfigurationException(msg+" - "+e);
}
}
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -22,9 +22,9 @@
import static jasdl.util.Common.getTEOp;
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
-import jasdl.util.UnknownMappingException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
+import jasdl.util.exception.UnknownMappingException;
import jason.JasonException;
import jason.asSyntax.Literal;
import jason.asSyntax.Plan;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -20,7 +20,7 @@
package jasdl.asSyntax;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSemantics.Unifier;
import jason.asSyntax.Plan;
import jason.asSyntax.Trigger;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -7,8 +7,8 @@
import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
import jason.asSemantics.Unifier;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/revision/JasdlIncisionFunction.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -2,7 +2,7 @@
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Atom;
import jason.asSyntax.ListTerm;
import jason.asSyntax.Term;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -2,7 +2,7 @@
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Atom;
/**
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -4,11 +4,11 @@
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
-import jasdl.util.UnknownMappingException;
-import jasdl.util.xsd.XSDDataType;
-import jasdl.util.xsd.XSDDataTypeUtils;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.UnknownMappingException;
+import jasdl.util.owlapi.xsd.XSDDataType;
+import jasdl.util.owlapi.xsd.XSDDataTypeUtils;
import jason.asSyntax.Atom;
import jason.asSyntax.DefaultTerm;
import jason.asSyntax.Literal;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -8,8 +8,8 @@
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Atom;
import jason.asSyntax.DefaultTerm;
import jason.asSyntax.ListTerm;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -27,8 +27,8 @@
import jasdl.bridge.seliteral.SELiteralClassAssertion;
import jasdl.bridge.seliteral.SELiteralDataPropertyAssertion;
import jasdl.bridge.seliteral.SELiteralObjectPropertyAssertion;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
import java.util.HashSet;
import java.util.Set;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/MappingManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/MappingManager.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/MappingManager.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,7 +1,7 @@
package jasdl.bridge.mapping;
-import jasdl.util.DuplicateMappingException;
-import jasdl.util.UnknownMappingException;
+import jasdl.util.exception.DuplicateMappingException;
+import jasdl.util.exception.UnknownMappingException;
import java.util.HashMap;
import java.util.Set;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,7 +1,7 @@
package jasdl.bridge.mapping.aliasing;
import jasdl.bridge.seliteral.SELiteral;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Atom;
/**
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/LabelManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/LabelManager.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/LabelManager.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,7 +1,7 @@
package jasdl.bridge.mapping.label;
import jasdl.bridge.mapping.MappingManager;
-import jasdl.util.DuplicateMappingException;
+import jasdl.util.exception.DuplicateMappingException;
import jason.asSyntax.Atom;
import java.util.HashSet;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -3,10 +3,10 @@
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.factory.AliasFactory;
import jasdl.bridge.mapping.aliasing.Alias;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
-import jasdl.util.NotEnrichedException;
-import jasdl.util.UnknownMappingException;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.exception.NotEnrichedException;
+import jasdl.util.exception.UnknownMappingException;
import jason.asSyntax.Atom;
import jason.asSyntax.ListTerm;
import jason.asSyntax.Literal;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -1,8 +1,8 @@
package jasdl.bridge.seliteral;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.ListTerm;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -2,7 +2,7 @@
import static jasdl.util.Common.DOMAIN;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Literal;
import org.semanticweb.owl.model.OWLDescription;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -4,10 +4,10 @@
import static jasdl.util.Common.strip;
import static jasdl.util.Common.surroundedBy;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.InvalidSELiteralException;
-import jasdl.util.JasdlException;
-import jasdl.util.xsd.XSDDataType;
-import jasdl.util.xsd.XSDDataTypeUtils;
+import jasdl.util.exception.InvalidSELiteralException;
+import jasdl.util.exception.JasdlException;
+import jasdl.util.owlapi.xsd.XSDDataType;
+import jasdl.util.owlapi.xsd.XSDDataTypeUtils;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -3,7 +3,7 @@
import static jasdl.util.Common.DOMAIN;
import static jasdl.util.Common.RANGE;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Literal;
import org.semanticweb.owl.model.OWLIndividual;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java 2008-04-02 17:26:44 UTC (rev 1194)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java 2008-04-02 18:55:20 UTC (rev 1195)
@@ -6,7 +6,7 @@
import jasdl.asSemantics.JasdlAgent;
import jasdl.bridge.factory.AliasFactory;
-import jasdl.util.JasdlException;
+import jasdl.util.exception.JasdlException;
import jason.asSyntax.Literal;
public abstract class SELiteralPropertyAssertion extends SELiteral{
Modified: trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
===================================================================
--- trunk/applications/jas...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-02 21:11:27
|
Revision: 1199
http://jason.svn.sourceforge.net/jason/?rev=1199&view=rev
Author: tomklapiscak
Date: 2008-04-02 14:11:25 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Bebops (Belief Base Operations Library) now standalone. Used by JASDL as .jar
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/TBoxAxiomKernelsetFilter.java
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-02 19:40:02 UTC (rev 1198)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-02 21:11:25 UTC (rev 1199)
@@ -84,10 +84,11 @@
?ruralArea(somewhere)[o(travel)];
- +isLocatedAt(x, x)[o(travel)]; // rejected since isLocated at is irreflexive
+
.print("DL-based belief revision is enabled"); // without, the above test-goal will fail, since legacy mechanism simply removes incoming inconsistent beliefs
+
// since the classes destination and and contact are disjoint (and ruralArea is a subclass of destination),
// and since we trust ben less than tom, the belief addition below will fail (and tom's assertion above will persist),
// thus failing the whole plan.
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 19:40:02 UTC (rev 1198)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -3,10 +3,9 @@
import static jasdl.util.Common.strip;
import jasdl.asSyntax.JasdlPlanLibrary;
import jasdl.bb.JasdlBeliefBase;
-import jasdl.bb.revision.BeliefBaseSemiRevisor;
-import jasdl.bb.revision.JasdlIncisionFunction;
-import jasdl.bb.revision.JasdlReasonerFactory;
-import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
+import jasdl.bb.JasdlIncisionFunction;
+import jasdl.bb.JasdlReasonerFactory;
+import jasdl.bb.TBoxAxiomKernelsetFilter;
import jasdl.bridge.factory.AliasFactory;
import jasdl.bridge.factory.AxiomToSELiteralConverter;
import jasdl.bridge.factory.SELiteralFactory;
@@ -69,6 +68,8 @@
import org.semanticweb.owl.model.OWLOntologyManager;
import uk.ac.manchester.cs.owl.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;
+import bebops.semirevision.BeliefBaseSemiRevisor;
+import bebops.util.exception.BebopsRevisionFailedException;
public class JasdlAgent extends JmcaAgent{
@@ -215,8 +216,8 @@
removeList.add(axiomToSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
}
revisionApplied = true;
- }catch(RevisionFailedException e){
- throw e; // propagate upwards
+ }catch(BebopsRevisionFailedException e){
+ throw new RevisionFailedException(); // propagate upwards
}catch(NotEnrichedException e){
// can't perform DL-based belief revision on SN-Literals
addList.add(beliefToAdd);
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 19:40:02 UTC (rev 1198)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -1,10 +1,6 @@
package jasdl.bb;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.bb.revision.BeliefBaseContractor;
-import jasdl.bb.revision.JasdlIncisionFunction;
-import jasdl.bb.revision.JasdlReasonerFactory;
-import jasdl.bb.revision.TBoxAxiomKernelsetFilter;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
import jasdl.util.exception.JasdlException;
@@ -32,6 +28,8 @@
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.RemoveAxiom;
+import bebops.contraction.BeliefBaseContractor;
+
public class JasdlBeliefBase extends DefaultBeliefBase{
private JasdlAgent agent;
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java (from rev 1196, trunk/applications/jasdl-owlapi/src/jasdl/bb/bbops/revision/JasdlIncisionFunction.java)
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -0,0 +1,97 @@
+package jasdl.bb;
+
+import jasdl.asSemantics.JasdlAgent;
+import jasdl.bridge.seliteral.SELiteral;
+import jasdl.util.exception.JasdlException;
+import jason.asSyntax.Atom;
+import jason.asSyntax.ListTerm;
+import jason.asSyntax.Term;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.semanticweb.owl.model.OWLAxiom;
+import org.semanticweb.owl.model.OWLIndividualAxiom;
+
+import bebops.common.IncisionFunction;
+
+public class JasdlIncisionFunction implements IncisionFunction{
+
+
+ private JasdlAgent agent;
+ private SELiteral toAddLiteral;
+
+ /**
+ * The SELiteral to be added is required for a particularly inelegant hack that allows us
+ * to retrieve the annotations of the NOT YET ADDED axiom.
+ *
+ * @param agent required for getting trust ratings
+ * @param toAdd
+ * @param toAddAnnotations
+ */
+ public JasdlIncisionFunction(JasdlAgent agent, SELiteral toAddLiteral){
+ this.agent = agent;
+ this.toAddLiteral = toAddLiteral;
+ }
+
+ /**
+ * Chooses from each akernel axiom with lowest trust associated with it.
+ * Currently calculated using ASSERTED source annotations only.
+ * No source annotation is taken as trust = 0;
+ */
+ public Set<OWLAxiom> apply(Set<Set<OWLAxiom>> kernelset) {
+ try{
+ Set<OWLAxiom> chosen = new HashSet<OWLAxiom>();
+ for(Set<OWLAxiom> akernel : kernelset){
+ if(!akernel.isEmpty()){
+ OWLAxiom leastTrusted = null; // guaranteed to take a value
+ float minTrustRating = 1f;
+ for(OWLAxiom axiom : akernel){
+ float trustRating = getTrustRating(axiom);
+ agent.getLogger().finest("Trust rating of "+axiom+"="+trustRating);
+ if(trustRating <= minTrustRating){
+ minTrustRating = trustRating;
+ leastTrusted = axiom;
+ }
+ }
+ chosen.add(leastTrusted);
+ }
+ }
+ return chosen;
+ }catch(Exception e){
+ e.printStackTrace(); // TODO: introduce a seperate exception hierarchy once this package has been seperated from JASDL
+ return null;
+ }
+ }
+
+ /**
+ * Currently returns the trust rating of the most trusted source. Future work will look at better ways of calculating this.
+ * @param axiom
+ * @return
+ * @throws JasdlException
+ */
+ private float getTrustRating(OWLAxiom axiom) throws JasdlException{
+ ListTerm sources;
+ if(axiom.equals(toAddLiteral.createAxiom())){ // hack to get the annotations of the NOT YET ADDED toAdd axiom
+ sources = toAddLiteral.getLiteral().getSources();
+ }else{
+ SELiteral sl = agent.getAxiomToSELiteralConverter().convert((OWLIndividualAxiom)axiom); // kernel filter ensures axiom is an OWLIndividualAxiom
+ sources = sl.getLiteral().getSources();
+ }
+ agent.getLogger().finest("Sources of "+axiom+"="+sources);
+ float maxTrustRating = 0f; // if no sources available, trust is 0
+ for(Term source : sources){
+ if(!source.isAtom()){
+ throw new JasdlException("Invalid source annotation "+source);
+ }
+ Atom name = (Atom)source;
+ float trustRating = agent.getTrustRating(name);
+ if(trustRating > maxTrustRating){
+ maxTrustRating = trustRating;
+ }
+ }
+ return maxTrustRating;
+ }
+
+
+}
Copied: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlReasonerFactory.java (from rev 1196, trunk/applications/jasdl-owlapi/src/jasdl/bb/bbops/revision/JasdlReasonerFactory.java)
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlReasonerFactory.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlReasonerFactory.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -0,0 +1,30 @@
+package jasdl.bb;
+
+import org.mindswap.pellet.PelletOptions;
+import org.mindswap.pellet.owlapi.Reasoner;
+import org.semanticweb.owl.inference.OWLReasoner;
+import org.semanticweb.owl.model.OWLOntologyManager;
+
+import com.clarkparsia.explanation.ReasonerFactory;
+
+public class JasdlReasonerFactory implements ReasonerFactory{
+
+ public JasdlReasonerFactory() {
+ super();
+ }
+
+ public boolean requiresExplicitClassification() {
+ return false;
+ }
+
+ public OWLReasoner createReasoner(OWLOntologyManager manager) {
+ Reasoner pellet = new Reasoner(manager);
+ return pellet;
+ }
+
+ public String getReasonerName() {
+ return "reasoner";
+ }
+
+
+}
Added: trunk/applications/jasdl-owlapi/src/jasdl/bb/TBoxAxiomKernelsetFilter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/TBoxAxiomKernelsetFilter.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/TBoxAxiomKernelsetFilter.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -0,0 +1,14 @@
+package jasdl.bb;
+
+import org.semanticweb.owl.model.OWLAxiom;
+import org.semanticweb.owl.model.OWLIndividualAxiom;
+
+import bebops.common.KernelsetFilter;
+
+public class TBoxAxiomKernelsetFilter extends KernelsetFilter {
+
+ public boolean retain(OWLAxiom axiom) {
+ return (axiom instanceof OWLIndividualAxiom);
+ }
+
+}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java 2008-04-02 19:40:02 UTC (rev 1198)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java 2008-04-02 21:11:25 UTC (rev 1199)
@@ -21,7 +21,6 @@
import static jasdl.util.Common.RANGE;
import jasdl.asSemantics.JasdlAgent;
-import jasdl.bb.revision.IndividualAxiomToDescriptionConverter;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
import jasdl.bridge.seliteral.SELiteralClassAssertion;
@@ -43,7 +42,9 @@
import org.semanticweb.owl.model.OWLObjectProperty;
import org.semanticweb.owl.model.OWLTypedConstant;
+import bebops.common.IndividualAxiomToDescriptionConverter;
+
/**
* Accepts an arbitrary SEliteral and, depending on its type, creates an OWLIndividualAxiom encoding of it.
* This factory can be used in one of two ways: for <i>creation</i> or for <i>retrieval</i>.<p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-04-03 01:24:28
|
Revision: 1202
http://jason.svn.sourceforge.net/jason/?rev=1202&view=rev
Author: tomklapiscak
Date: 2008-04-02 18:24:25 -0700 (Wed, 02 Apr 2008)
Log Message:
-----------
Implemented experimental annotation gathering functionality (using Bebops library). Disabled by default, can be enabled in .mas2j (jasdl_useAnnotationGathering="true").
Implemented jasdl.ia.is_annotation_gathering_enabled and jasdl_ia.is_belief_revision_enabled internal actions to test status of experiemental features.
Implemented jasdl.ia.set_annotation_gathering_enabled and jasdl.ia.set_belief_revision_enabled internal actions to complement .mas2j settings.
Implemented workaround for strange behaviour when using Pellets isConsistent(OWLOntology) method (with agent.isBBConsistent() method).
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/build.xml
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/lib/bebops.jar
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JasdlException.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_belief_revision_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_belief_revision_enabled.java
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-04-03 01:24:25 UTC (rev 1202)
@@ -2,12 +2,16 @@
<property name="jason.dir" value="../.."/>
<property name="apps.dir" value="${jason.dir}/applications"/>
<property name="jmca.dir" value="${apps.dir}/jmca"/>
+ <property name="bebops.dir" value="${apps.dir}/bebops"/>
+ <property name="bebops.jar" value="${bebops.dir}/lib/bebops.jar"/>
<property name="asunit.dir" value="${apps.dir}/as-unit-test"/>
<property name="source.dir" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/bin" />
<property name="apidocs.dir" value="${basedir}/doc/api" />
- <property name="jar.file" value="${basedir}/lib/jasdl.jar" />
+ <property name="lib.dir" value="${basedir}/lib" />
+ <property name="jasdl.jar" value="${lib.dir}/jasdl.jar" />
+
<path id="project.classpath">
<pathelement location="${jason.dir}/lib/jason.jar"/>
@@ -26,21 +30,27 @@
<target name="init">
<tstamp/>
<mkdir dir="${build.dir}"/>
+ <available file="${bebops.dir}" type="dir" property="bebops.available"/>
</target>
- <target name="compile" depends="init">
+ <target name="bebops" depends="init" if="bebops.available">
+ <ant dir="${bebops.dir}" inheritAll="false"/>
+ <copy file="${bebops.jar}" todir="${lib.dir}"/>
+ </target>
+
+ <target name="compile" depends="init, bebops">
<javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5">
<classpath refid="project.classpath" />
</javac>
</target>
<target name="jar" depends="compile">
- <jar destfile="${jar.file}" basedir="./bin" includes="**/*.class"/>
+ <jar destfile="${jasdl.jar}" basedir="./bin" includes="**/*.class"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
- <delete file="${jar.file}"/>
+ <delete file="${jasdl.jar}"/>
<delete dir="${apidocs.dir}"/>
</target>
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j 2008-04-03 01:24:25 UTC (rev 1202)
@@ -32,6 +32,7 @@
travel_agent.asl
[
jasdl_useBeliefRevision = "true", // use experimental DL-based belief revision mechanism
+ jasdl_useAnnotationGathering = "true", // use experimental annotation gathering mechanism
/*
* To use FaCT++, set the below. Must have libFaCTPlusPlusJNI.so in /usr/lib (or the equivalent for Mac or Windows)
Modified: trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl 2008-04-03 01:24:25 UTC (rev 1202)
@@ -19,12 +19,12 @@
*/
!start(total).
-!start(ubb1).!example_UBB_1.!end(ubb1).
-!start(ubb2).!example_UBB_2.!end(ubb2).
+!start(ubb1).!example_UBB.!end(ubb1).
+!start(ubb2).!example_brf.!end(ubb2).
!start(qbb).!example_QBB.!end(qbb).
!start(rpp).!example_RPP.!end(rpp).
!start(all_different).!example_all_different.!end(all_different).
-//!example_annotation_gathering.
+!start(annnotation_gathering).!example_annotation_gathering.!end(annnotation_gathering).
!start(ksaa).!example_KSAA.!end(ksaa).
//!end(total) is within example_KSAA_complete to allow inter-agent communication to finish
@@ -42,9 +42,9 @@
.print("Execution time for counter ",A,": ",TotalTime,"s").
@example_ubb_1[atomic]
-+!example_UBB_1
++!example_UBB
<-
- .print("Example: Updating Belief Base 1");
+ .print("Example: Updating Belief Base");
+hotel(hilton)[o(travel)]; // hilton is a hotel
+hasRating(hilton, threeStarRating)[o(travel)]; // hilton has three-star rating
+town(london)[o(travel)];
@@ -58,12 +58,23 @@
+museums(scienceMuseum)[o(travel)];
+hasActivity(london, scienceMuseum)[o(travel)];
+hotel(travel_lodge)[o(travel)];
- .print("Completed: Updating Belief Base 1").
+ .print("Completed: Updating Belief Base").
+
+@example_brf[atomic]
++!example_brf
+ <-
+ jasdl.ia.is_belief_revision_enabled(true);
+ !example_brf_continue.
-@example_ubb_2[atomic]
-+!example_UBB_2
+@example_brf_fail[atomic]
+-!example_brf
+ <-
+ .print("Belief revision feature disabled, skipping").
+
+@example_brf_continue[atomic]
++!example_brf_continue
<-
- .print("Example: Updating Belief Base 2");
+ .print("Example: Belief Revision");
jasdl.ia.define_class(tiny, "travel:urbanArea and travel:hasActivity max 1 travel:activity");
+tiny(newcastle)[o(self), source(tom)];
@@ -83,25 +94,19 @@
+ruralArea(somewhere)[o(travel), source(tom)];
?ruralArea(somewhere)[o(travel)];
-
-
-
- .print("DL-based belief revision is enabled"); // without, the above test-goal will fail, since legacy mechanism simply removes incoming inconsistent beliefs
-
-
// since the classes destination and and contact are disjoint (and ruralArea is a subclass of destination),
// and since we trust ben less than tom, the belief addition below will fail (and tom's assertion above will persist),
// thus failing the whole plan.
+contact(somewhere)[o(travel), source(ben)];
- .print("Failed: Updating Belief Base 2").
+ .print("Failed: Belief Revision").
-@example_UBB_2_failure[atomic]
--!example_UBB_2
+@example_brf_continue_fail[atomic]
+-!example_brf_continue
<-
// Notice this does not hold, since belief revision rejected the less trusted assertion made by ben.
?~contact(somewhere)[o(travel)];
- .print("Completed: Updating Belief Base 2").
+ .print("Completed: Belief Revision").
@example_qbb[atomic, breakpoint]
+!example_QBB
@@ -157,18 +162,22 @@
@example_all_different[atomic]
+!example_all_different
<-
- .print("Example: all_different assertion");
+
+
+ .print("Example: all_different assertion");
+destination(butlins)[o(travel)];
+hotel(butlins_hotel)[o(travel)];
+hasAccommodation(butlins, butlins_hotel)[o(travel)];
+yoga(butlins_yoga)[o(travel)];
- +sunbathing(butlins_sunbathing)[o(travel)];
+ +sunbathing(butlins_sunbathing)[o(travel)];
+hasActivity(butlins, butlins_yoga)[o(travel)];
+ //jasdl.ia.all_different([butlins_yoga, butlins_sunbathing], travel); - DEPRECATED (see below)
+hasActivity(butlins, butlins_sunbathing)[o(travel)];
- //jasdl.ia.all_different([butlins_yoga, butlins_sunbathing], travel); - DEPRECATED (see below)
- +all_different([butlins_yoga, butlins_sunbathing])[o(self), something]; // all_different now represented as an se-literal. We can now query, inspect and send these assertions
+ +all_different([butlins_yoga, butlins_sunbathing])[o(self)]; // all_different now represented as an se-literal. We can now query, inspect and send these assertions
+
// Query below will not succeed unless butlins_yoga and butlins_sunbathing are different individuals since family destination requires min 2 *different* activities.
// Note: OWL doesn't make UNA and since these individuals do not belong to disjoint classes, therefore they must be explicitly asserted as different.
+
?familyDestination(butlins)[o(travel)];
?all_different([butlins_yoga, butlins_sunbathing, hilton])[o(self)];
/* ?all_different([hilton, fourSeasons])[o(travel)]; */ // Will fail, since hilton and fourSeasons cannot be established as distinct
@@ -178,6 +187,17 @@
@example_annotation_gathering[atomic]
+!example_annotation_gathering
<-
+ jasdl.ia.is_annotation_gathering_enabled(true); // why does True not fail immediately? possible Jason bug?
+ !example_annotation_gathering_continue.
+
+@example_annotation_gathering_fail[atomic]
+-!example_annotation_gathering
+ <-
+ .print("Annotation gathering feature disabled, skipping").
+
+@example_annotation_gathering_continue[atomic]
++!example_annotation_gathering_continue
+ <-
.print("Example: annotation gathering");
+ruralArea(kingsworthy)[o(travel), annotation];
?destination(kingsworthy)[o(travel), annotation];
@@ -190,9 +210,10 @@
+urbanArea(x)[o(travel), source(tom)];
+ruralArea(y)[o(travel), source(ben)];
// because knowledge from tom and ben contributed to the inference that x and y are distinct
- ?all_different([x,y])[o(travel), source(tom), source(ben)];
+ ?all_different([x,y])[o(self), source(tom), source(ben)];
// notice "something" annotation is gathered (added in !example_all_different) here since it all_different assertion contributes to this inference
+ +all_different([butlins_yoga, butlins_sunbathing])[o(self), something];
?familyDestination(butlins)[o(travel), something];
.print("Complete: annotation gathering").
Modified: trunk/applications/jasdl-owlapi/lib/bebops.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -98,10 +98,12 @@
private HashMap<Atom, Float> trustMap;
private boolean beliefRevisionEnabled;
+ private boolean annotationGatheringEnabled;
private List<MappingStrategy> defaultMappingStrategies = JasdlConfigurator.DEFAULT_MAPPING_STRATEGIES;
- public JasdlAgent(){
+
+ public JasdlAgent() throws Exception{
super();
// instantiate managers
@@ -160,7 +162,7 @@
public List<Literal> getABoxState() throws JasdlException{
List<Literal> bels = new Vector<Literal>();
for(OWLOntology ontology : ontologyManager.getOntologies()){
- for(OWLIndividualAxiom axiom : ontology.getIndividualAxioms()){
+ for(OWLIndividualAxiom axiom : ontology.getIndividualAxioms()){
Literal l = axiomToSELiteralConverter.convert(axiom).getLiteral();
bels.add(l);
}
@@ -184,10 +186,12 @@
public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException {
// TODO: what annotations should revision contractions contain? all! (or none? - same effect)
+
// No! the same. -a[x] only undermines assertions leading to a[x]!
// if we are performing belief-revision all annotations will be gathered (shortcut - use none?) ensuring axiom will be obliterated
// annotations never solely lead to conflicts.
+ // TODO: these is a bug hiding in this somewhere. Using below causes strange failures
if(!isBeliefRevisionEnabled()){ // if experimental feature is disabled
return super.brf(beliefToAdd, beliefToDel, i);
}
@@ -210,13 +214,19 @@
BeliefBaseSemiRevisor bbrev = new BeliefBaseSemiRevisor(axiomToAdd, getOntologyManager(), new JasdlReasonerFactory(), getLogger());
List<OWLAxiom> contractList = bbrev.revise(new TBoxAxiomKernelsetFilter(), new JasdlIncisionFunction(this, sl));
- // will only have reached here if new belief is accepted.
- addList.add(beliefToAdd);
+
for(OWLAxiom contract : contractList){
removeList.add(axiomToSELiteralConverter.convert((OWLIndividualAxiom)contract).getLiteral());
}
- revisionApplied = true;
+ if(!removeList.isEmpty()){
+ getLogger().info("brf: contracted "+removeList);
+ revisionApplied = true;
+ }
+
+ addList.add(beliefToAdd); // will only reach here if belief accepted (or bef is disabled)
+
}catch(BebopsRevisionFailedException e){
+ getLogger().info("brf: rejected "+e.getMessage());
throw new RevisionFailedException(); // propagate upwards
}catch(NotEnrichedException e){
// can't perform DL-based belief revision on SN-Literals
@@ -233,6 +243,7 @@
// Need to perform removals before additions so our ontology instance never becomes inconsistent
for(Literal removed : removeList){
+
boolean ok = false;
if(revisionApplied){
ok = true;
@@ -246,7 +257,8 @@
}
ok = believes(removed, u);
if(ok) removed.apply(u);
- }
+ }
+
if(ok){
if(getBB().remove(removed)){
if(toReturn == null){
@@ -545,7 +557,8 @@
}
} catch (OWLReasonerException e) {
throw new JasdlException("Unable to refresh reasoner. Reason: "+e);
- }
+ }
+
}
@@ -561,9 +574,25 @@
Log4JLogger kb_logger = (Log4JLogger)pellet.getKB().log;
kb_logger.getLogger().setLevel(level);
}
- }
+ }
/**
+ * For some reason, use of pellet's isConsistent(OWLOntology) method causes strange behaviour.
+ * So we wrap it's isConsistent() method here.
+ * TODO: resolve this issue properly
+ * @return
+ * @throws JasdlException
+ */
+ public boolean isBBConsistent() throws JasdlException{
+ if(getReasoner() instanceof org.mindswap.pellet.owlapi.Reasoner){
+ return((org.mindswap.pellet.owlapi.Reasoner)getReasoner()).isConsistent();
+ }else{
+ //TODO: FaCT++
+ throw new JasdlException("isBBConsistent not implemented for FaCT++ reasoner");
+ }
+ }
+
+ /**
* *Must* be unique within society!
* @return
*/
@@ -676,7 +705,20 @@
return trustMap.get(name);
}
+
+
+ public boolean isAnnotationGatheringEnabled() {
+ return annotationGatheringEnabled;
+ }
+
+
+
+ public void setAnnotationGatheringEnabled(boolean annotationGatheringEnabled) {
+ this.annotationGatheringEnabled = annotationGatheringEnabled;
+ }
+
+
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -20,6 +20,7 @@
import java.util.Vector;
import java.util.logging.Level;
+import org.mindswap.pellet.PelletOptions;
import org.semanticweb.owl.inference.OWLReasoner;
import org.semanticweb.owl.model.OWLEntity;
import org.semanticweb.owl.model.OWLOntology;
@@ -34,14 +35,15 @@
public static String MAS2J_TRUSTRATING = "_trustRating";
public static String MAS2J_KNOWNAGENTS = "_knownAgents";
public static String MAS2J_USEBELIEFREVISION = "_useBeliefRevision";
+ public static String MAS2J_USEANNOTATIONGATHERING = "_useAnnotationGathering";
public static String MAS2J_REASONERCLASS = "_reasonerClass";
public static List<MappingStrategy> DEFAULT_MAPPING_STRATEGIES = Arrays.asList( new MappingStrategy[] { new DecapitaliseMappingStrategy()} );
public static String DEFAULT_REASONER_CLASS = "org.mindswap.pellet.owlapi.Reasoner";
public static boolean DEFAULT_USEBELIEFREVISION = false;
+ public static boolean DEFAULT_USEANNOTATIONGATHERING = false;
-
/**
* List of reserved ontology labels. Currently:
* <ul>
@@ -65,6 +67,7 @@
loadReasoner(stts);
loadDefaultMappingStrategies(stts);
setUseBeliefRevision(stts);
+ setUseAnnotationGathering(stts);
loadOntologies(stts);
applyManualMappings(stts);
loadKnownAgents(stts);
@@ -108,7 +111,17 @@
}
}
+ private void setUseAnnotationGathering(Settings stts) throws JasdlException{
+ try{
+ // set whether to use belief revision or not
+ String useAnnotationGathering = prepareUserParameter(stts, MAS2J_PREFIX + MAS2J_USEANNOTATIONGATHERING);
+ agent.setAnnotationGatheringEnabled(Boolean.parseBoolean(useAnnotationGathering));
+ }catch(JasdlConfigurationException e){
+ agent.setAnnotationGatheringEnabled(DEFAULT_USEANNOTATIONGATHERING);
+ }
+ }
+
/**
* Load ontologies as specified in .mas2j settings
* @param stts .mas2j settings
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -45,7 +45,8 @@
boolean containsAxiom = ontology.containsAxiom(axiom);
if(!containsAxiom){
- agent.getOntologyManager().applyChange(new AddAxiom(ontology, axiom));
+ agent.getOntologyManager().applyChange(new AddAxiom(ontology, axiom));
+ agent.refreshReasoner();
}
boolean containsAllAnnots = true;
@@ -55,13 +56,16 @@
if(!ontology.containsAxiom(annotAxiom)){
containsAllAnnots = false;
agent.getOntologyManager().applyChange(new AddAxiom(ontology, annotAxiom));
+ agent.refreshReasoner();
}
- }
+ }
- if(!containsAxiom || !containsAllAnnots){
- agent.refreshReasoner();
- if(!agent.isBeliefRevisionEnabled()){ // if brf disabled, resort to legacy consistency maintenance mechanism
- if(!agent.getReasoner().isConsistent(ontology)){
+
+
+ if(!containsAxiom || !containsAllAnnots){
+ if(!agent.isBeliefRevisionEnabled()){ // if brf disabled, resort to legacy consistency maintenance mechanism
+ if(!agent.isBBConsistent()){
+ getLogger().info("legacy consistency assurance: rejected "+axiom);
RemoveAxiom rem = new RemoveAxiom(ontology, axiom);
agent.getOntologyManager().applyChange(rem);
agent.refreshReasoner();
@@ -192,6 +196,8 @@
getLogger().fine("Getting relevancies for "+l);
+
+
Set<Literal> relevant = new HashSet<Literal>();
try{
SELiteral sl = agent.getSELiteralFactory().construct(l);
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -15,7 +15,7 @@
import bebops.common.IncisionFunction;
-public class JasdlIncisionFunction implements IncisionFunction{
+public class JasdlIncisionFunction extends IncisionFunction{
private JasdlAgent agent;
@@ -39,23 +39,21 @@
* Currently calculated using ASSERTED source annotations only.
* No source annotation is taken as trust = 0;
*/
- public Set<OWLAxiom> apply(Set<Set<OWLAxiom>> kernelset) {
+ public Set<OWLAxiom> applyToOne(Set<OWLAxiom> akernel){
try{
Set<OWLAxiom> chosen = new HashSet<OWLAxiom>();
- for(Set<OWLAxiom> akernel : kernelset){
- if(!akernel.isEmpty()){
- OWLAxiom leastTrusted = null; // guaranteed to take a value
- float minTrustRating = 1f;
- for(OWLAxiom axiom : akernel){
- float trustRating = getTrustRating(axiom);
- agent.getLogger().finest("Trust rating of "+axiom+"="+trustRating);
- if(trustRating <= minTrustRating){
- minTrustRating = trustRating;
- leastTrusted = axiom;
- }
+ if(!akernel.isEmpty()){
+ OWLAxiom leastTrusted = null; // guaranteed to take a value
+ float minTrustRating = 1f;
+ for(OWLAxiom axiom : akernel){
+ float trustRating = getTrustRating(axiom);
+ agent.getLogger().finest("Trust rating of "+axiom+"="+trustRating);
+ if(trustRating <= minTrustRating){
+ minTrustRating = trustRating;
+ leastTrusted = axiom;
}
- chosen.add(leastTrusted);
- }
+ }
+ chosen.add(leastTrusted);
}
return chosen;
}catch(Exception e){
@@ -66,6 +64,7 @@
/**
* Currently returns the trust rating of the most trusted source. Future work will look at better ways of calculating this.
+ * TODO: Essentially duplicating work here. Annotation gathering (performed by AxiomToSELiteralConverter) requires axiom-pinponting - so does contraction.
* @param axiom
* @return
* @throws JasdlException
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-04-02 21:13:50 UTC (rev 1201)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -1,6 +1,8 @@
package jasdl.bridge.factory;
import jasdl.asSemantics.JasdlAgent;
+import jasdl.bb.JasdlReasonerFactory;
+import jasdl.bb.TBoxAxiomKernelsetFilter;
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
import jasdl.bridge.seliteral.SELiteral;
@@ -17,20 +19,27 @@
import java.util.List;
import java.util.Set;
import java.util.Vector;
+import java.util.logging.Logger;
+import org.semanticweb.owl.inference.OWLReasonerException;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
import org.semanticweb.owl.model.OWLClassAssertionAxiom;
import org.semanticweb.owl.model.OWLConstant;
import org.semanticweb.owl.model.OWLDataPropertyAssertionAxiom;
import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
+import org.semanticweb.owl.model.OWLException;
import org.semanticweb.owl.model.OWLIndividual;
import org.semanticweb.owl.model.OWLIndividualAxiom;
import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owl.model.OWLOntology;
+import org.semanticweb.owl.model.OWLOntologyChangeException;
+import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLTypedConstant;
+import bebops.pinpointing.KernelOperator;
+
/**
* Accepts an arbitrary OWLIndividualAxiom and, depending on its type, creates a SE-Literal encoding of it.
* Will always result in a ground SELiteral (since OWLIndividualAxioms must always be ground)<p>
@@ -50,7 +59,8 @@
*/
private JasdlAgent agent;
- public AxiomToSELiteralConverter(JasdlAgent agent){
+
+ public AxiomToSELiteralConverter(JasdlAgent agent) throws OWLReasonerException, OWLOntologyCreationException, OWLOntologyChangeException{
this.agent = agent;
}
@@ -59,19 +69,53 @@
* TODO: Shift to a factory?
* @param sl
*/
- public static List<Term> getAssertedAnnotations(OWLAxiom axiom, OWLOntology ontology){
+ public List<Term> getAssertedAnnotations(OWLAxiom axiom){
List<Term> result = new Vector<Term>();
- // get annotations
- Set<OWLAxiomAnnotationAxiom> annotAxioms = axiom.getAnnotationAxioms(ontology);
- for(OWLAxiomAnnotationAxiom annotAxiom : annotAxioms){ // remember, possibly semantically-naive payload!
- Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
- result.add(annot);
+ // get annotations from all known ontologies
+ for(OWLOntology ontology : agent.getOntologyManager().getOntologies()){
+ Set<OWLAxiomAnnotationAxiom> annotAxioms = axiom.getAnnotationAxioms(ontology);
+ for(OWLAxiomAnnotationAxiom annotAxiom : annotAxioms){ // remember, possibly semantically-naive payload!
+ Term annot = Literal.parse(annotAxiom.getAnnotation().getAnnotationValueAsConstant().getLiteral());
+ result.add(annot);
+ }
}
return result;
}
+ public List<Term> getInferredAnnotations(OWLAxiom axiom) throws JasdlException{
+ try {
+ List<Term> annots = new Vector<Term>();
+ KernelOperator kernelOperator = new KernelOperator(agent.getOntologyManager(), new JasdlReasonerFactory());
+ //Set<OWLAxiom> supportingAxioms = OWLReasonerAdapter.flattenSetOfSets((kernelOperator.apply(axiom, true)));
+ Set<OWLAxiom> supportingAxioms = (new TBoxAxiomKernelsetFilter()).applyToOne((kernelOperator.applySingle(axiom, true)));
+ getLogger().finest("Explanation for "+axiom+": "+supportingAxioms);
+ for(OWLAxiom supportingAxiom : supportingAxioms){
+ annots.addAll(getAssertedAnnotations(supportingAxiom));
+ }
+ getLogger().finest("Annotations: "+annots);
+ return annots;
+ } catch (OWLException e) {
+ throw new JasdlException("Annotation gathering failed for "+axiom, e);
+ }
+ }
+
/**
+ * Utility method to get the annotations of an axiom as an array of terms within the ontology referenced by alias
+ * @param alias
+ * @param axiom
+ * @return
+ * @throws UnknownMappingException
+ */
+ private Term[] getAnnots(Alias alias, OWLAxiom axiom) throws JasdlException{
+ List<Term> annots = getAssertedAnnotations(axiom);
+ if(agent.isAnnotationGatheringEnabled()) annots.addAll(getInferredAnnotations(axiom)); // optional, experimental feature
+ return (Term[])annots.toArray(new Term[annots.size()]);
+ }
+
+
+
+ /**
* Polymorphically applies appropriate factory method depending on specialisation of axiom
* @param axiom
* @return
@@ -176,18 +220,10 @@
return agent.getSELiteralFactory().construct(alias, is, getAnnots(alias, axiom));
}
- /**
- * Utility method to get the annotations of an axiom as an array of terms within the ontology referenced by alias
- * @param alias
- * @param axiom
- * @return
- * @throws UnknownMappingException
- */
- private Term[] getAnnots(Alias alias, OWLAxiom axiom) throws UnknownMappingException{
- OWLOntology ontology = agent.getLabelManager().getRight(alias.getLabel());
- List<Term> collection = getAssertedAnnotations(axiom, ontology);
- return (Term[])collection.toArray(new Term[collection.size()]);
- }
+ public Logger getLogger(){
+ return agent.getLogger();
+ }
+
}
Added: trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java (rev 0)
+++ trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java 2008-04-03 01:24:25 UTC (rev 1202)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
+ *
+ * This file is part of JASDL.
+ *
+ * JASDL is free software: you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * JASDL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Lesser GNU General Public License for more details.
+ *
+ * You should have received a copy of the Lesser GNU General Public License
+ * along with JASDL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package jasdl.ia;
+
+import jasdl.asSemantics.JasdlAgent;
+import jason.asSemantics.DefaultInternalAction;
+import jason.asSemantics.TransitionSystem;
+import jason.asSemantics.Unifier;
+import jason.asSyntax.Literal;
+import jason.asSyntax.Term;
+
+import java.util.logging.Logger;
+
+/**
+ * @author Tom Klapiscak
+ *
+ * Usage jasdl.ia.define_class(classname, classexpr, label), where:
+ * - classname is an atomic name used to refer to this class in future. Must begin with a lowercase letter and not clash with any AgentSpeak keyword
+ * - classexpr is a expression defining this class
+ *
+ * Changed class name to atom only - forces valid alias syntax
+ *
+ */
+public class is_annotation_gathering_enabled extends DefaultInternalAction {
+
+
+ private Logger logger = Logger.getLogger("jasdl."+is_annotation_gathering_enabled.class.getName());
+
+ @Override
+ public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
+ try {
+ JasdlAgent agent = (JasdlAgent)ts.getAg();
+ Literal res = agent.isAnnotationGatheringEnabled() ? Literal.LTrue : Literal.LFalse;
+ return un.unifies(args[0], res);
+ } catch (Exception e) {
+ logger.warning("Error in internal action 'jasdl.ia.is_annotation_gathering_enabled'! Reason:");
+ e.printStackTrace(); ...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-18 18:19:04
|
Revision: 1223
http://jason.svn.sourceforge.net/jason/?rev=1223&view=rev
Author: tomklapiscak
Date: 2008-04-18 11:18:50 -0700 (Fri, 18 Apr 2008)
Log Message:
-----------
Major JASDL revision. Highlights:
Belief base contraction made more efficient (recursive contraction of first-level support lists unnecessary). Contraction now defaults to off since it is experimental. Added .mas2j settings and internal actions jasdl.ia.is_contraction_enabled and jasdl.ia.set_contraction_enabled.
Added option to use Pellet's incremental explanation generator rather than the Bebops library (which uses OWL-APIs black-box debugging features). Deprecated for now due to apparent bugs.
Trigger generalisation mechanism revamped. Can now deal with arbitrary nestings of SE-Literals within Semantically-naive literals. Implemented using an extension to Jason's standard unifier, DLUnifier, that overrides Jason's standard unifier to generalise unification of SE-Literals to include ontological rules. Specifically, functors need not directly match, but be related by subsumption.
jasdl.ia.define_class now supports complex XSD data ranges. i.e. can express classes of the form "travel:hotel and travel:hasPricePerNight some double [<= 15]" - the class of all hotels that have a nightly price of less than or equal to 15.
Added WIP "commerce" example JASDL application.
Revamped JASDL's syntactic-translation protocol for SE-Messages and SE-Percepts. Clearer semantics and improved efficiency. Aliasing now applied also to individuals nested within SE-Literals. Extracted to general ProtocolProcessor class (i.e. messages / percepts).
JASDL can now support SE-percepts (percepts consisting of SE-Literals):
JASDLBeliefBase now handles SE-percepts correctly
Added JASDLEnvironment - to be extended by any JASDL agent making use of an environment. Maintains own JASDLOntologyManager and ensures syntactic-translation processing is performed on SE-Percepts entering standard percept operations (i.e. adding "named", "anon", "i" annotations, etc). Provides a framework of convenience methods for creating SE-percepts (i.e. SELiteralFactory).
JASDLAgArch ensures incoming SE-Percepts are translated back SE-Literals according to local mappings of perceiving agent.
Miscellanous internal actions added:
jasdl.ia.get_types(Functor, Label, direct, Types): unifies Types with a list of classifications of the individual referenced by (Functor, Label). If direct is set, only asserted types are listed, otherwise all inferred types are.
jasdl.ia.get_anonymous_individual(Functor): unifies Functor with a guaranteed unique (wrt. known individuals in ontologies), anonymous individual name.
jasdl.ia.get_class_definition(SELiteral, Rendering): unifies Rendering with the NS-prefix manchester OWL syntax rendering (same used by jasdl.ia.define_class) of the class describing the assertion made by SELiteral.
jasdl.ia.get_functor(Literal, Functor): unifies Functor with the functor of Literal (useful for extracting the class/property alias used by an SE-Literal)
jasdl.ia.get_individual(ClassAssertion, Individual): Unifies Individual with the individual referenced by the SE-Literal ClassAssertion.
jasdl.ia.send(agent, askOne, hotel(hilton)[o(travel)], thing(X)[o(travel)]): Wraps around Jason's default .send performative to enable generalised unification (by setting the current suspended intended-means to use DLUnifier - see above) on the fourth parameter synchronous askOne messages. This this example, X will unify with hilton since "thing" subsumes "hotel".
Extracted ontology management functionality (ontology loading, anonymous instantiation, aliasing, reasoning, labelling and class definition, etc) from JASDLAgent to JASDLOntologyManager
Tidied up static parameter fields and extracted them to JASDLParams class.
Revamped exception handling.
JASDL now makes proper use of XSDVocabulary enumeration provided with OWL-API (rather than duplicating in custom XSDDatatype enum)
SELiterals can no longer be specified with a String "o" term: doesn't fit in well with new design.
Run-time defined classes with clashing alias mappings now override old ones.
Run-time instantiated individuals are added into a (semantically) meaningless assertion axiom - ensures the toEntity method can find them (needed in particular for run-time class renderings).
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j
trunk/applications/jasdl-owlapi/examples/travel_agent/customer.asl
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/places.owl
trunk/applications/jasdl-owlapi/examples/travel_agent/ontologies/travel.owl
trunk/applications/jasdl-owlapi/examples/travel_agent/travel_agent.asl
trunk/applications/jasdl-owlapi/lib/bebops.jar
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/MappingManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/Alias.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DecapitaliseMappingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/DefinitionManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/LabelManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/label/OntologyURIManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralClassAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralObjectPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_belief_revision_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_belief_revision_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/util/Common.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NSPrefixOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/URIOWLEntityChecker.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/examples/commerce/
trunk/applications/jasdl-owlapi/examples/commerce/.classpath
trunk/applications/jasdl-owlapi/examples/commerce/.project
trunk/applications/jasdl-owlapi/examples/commerce/bin/
trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
trunk/applications/jasdl-owlapi/examples/commerce/logging.properties
trunk/applications/jasdl-owlapi/examples/commerce/onts/
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/src/
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/society.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/delivery_van.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop1.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/testing.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceEnvironment.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceView.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/CommerceModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelAgent.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCrate.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomer.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelDeliveryVan.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelMobileAgent.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelObject.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelPA.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelShop.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/Product.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/CommerceException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelAgentException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelDeliveryVanException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelMobileAgentException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelShopException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/util/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/util/Common.java
trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/package.html
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgentConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/package.html
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JASDLPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/
trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLKernelsetFilter.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/DLUnifier.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java
trunk/applications/jasdl-owlapi/src/jasdl/env/
trunk/applications/jasdl-owlapi/src/jasdl/env/JASDLEnvironment.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_anonymous_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_class_definition.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_functor.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_types.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_contraction_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/logging/
trunk/applications/jasdl-owlapi/src/jasdl/ia/logging/log.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/send.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_contraction_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/package.html
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLConfigurationException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLDuplicateMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLInvalidSELiteralException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLMessageContentException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLNotEnrichedException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLUnknownMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/IndividualAxiomToDescriptionConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/XSDDatatypeChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/NsPrefixOWLObjectShortFormProvider.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/URIOWLObjectShortFormProvider.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/XSDVocabularyUtils.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/architecture/IncomingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JasdlAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/OutgoingPropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/PropContProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JasdlConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JasdlPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlIncisionFunction.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JasdlReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/TBoxAxiomKernelsetFilter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AliasFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/DuplicateMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/InvalidSELiteralException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JasdlConfigurationException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JasdlException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/NotEnrichedException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/UnknownMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/URIOWLObjectRenderer.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/XSDDataType.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/xsd/XSDDataTypeUtils.java
Property Changed:
----------------
trunk/applications/jasdl-owlapi/examples/
Property changes on: trunk/applications/jasdl-owlapi/examples
___________________________________________________________________
Name: svn:ignore
- testing
brf_test
+ testing
brf_test
commerce (copy)
commerce (another copy)
Property changes on: trunk/applications/jasdl-owlapi/examples/commerce
___________________________________________________________________
Name: svn:ignore
+ .stop___MAS
Added: trunk/applications/jasdl-owlapi/examples/commerce/.classpath
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/.classpath (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/.classpath 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/home/tom/workspace/jason/lib/jason.jar" sourcepath="/home/tom/workspace/jason/src">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/home/tom/workspace/jason/doc/api/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry combineaccessrules="false" kind="src" path="/jasdl-owlapi"/>
+ <classpathentry kind="lib" path="/jasdl-owlapi/lib/owlapi-bin.jar" sourcepath="/home/tom/workspace/owlapi/antbuild/build/owlapi-src.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/home/tom/workspace/owlapi/antbuild/build/javadoc/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
Added: trunk/applications/jasdl-owlapi/examples/commerce/.project
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/.project (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/.project 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>commerce</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/applications/jasdl-owlapi/examples/commerce/bin
___________________________________________________________________
Name: svn:ignore
+ classes
Added: trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+
+ This file was generated by Jason ?
+ http://jason.sf.net
+
+ April 18, 2008 - 18:12:11
+-->
+
+<project name ="commerce"
+ basedir=".."
+ default="run">
+
+ <property name="mas2j.project.file" value="commerce.mas2j"/>
+ <property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
+ <property name="build.dir" value="${basedir}/bin/classes" />
+
+ <property name="jasonJar" value="/home/tom/workspace/jason/lib/jason.jar"/>
+
+ <path id="project.classpath">
+ <pathelement location="${basedir}"/>
+ <pathelement location="${build.dir}"/>
+ <pathelement location="${jasonJar}"/>
+ <fileset dir="../../lib" > <include name="**/*.jar" /> </fileset>
+ <pathelement location="../../../jmca/lib/jmca.jar"/>
+
+ </path>
+
+ <!-- tasks the user can override in his/her c-build.xml script -->
+ <target name="user-init">
+ </target>
+ <target name="user-end">
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ <antcall target="user-init" />
+ </target>
+
+ <target name="compile" depends="init">
+ <condition property="srcdir" value="${basedir}/src/java" else="${basedir}" >
+ <available file="${basedir}/src/java" />
+ </condition>
+ <javac srcdir="${srcdir}" destdir="${build.dir}" debug="true" optimize="true" >
+ <classpath refid="project.classpath"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <delete file="${ant.project.name}.jar" />
+ <copy file="${jasonJar}" tofile="${ant.project.name}.jar" />
+ <copy file="${mas2j.project.file}" tofile="default.mas2j" />
+ <jar update="yes" jarfile="${ant.project.name}.jar" >
+ <fileset dir="${basedir}">
+ <include name="**/*.asl" />
+ <include name="**/*.mas2j" />
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="**/*.class" />
+ </fileset>
+ </jar>
+ <delete file="default.mas2j" />
+ </target>
+
+
+ <target name="jnlp" depends="jar" >
+ <mkdir dir="${basedir}/${ant.project.name}-jws"/>
+ <java classname="jason.infra.centralised.CreateJNLP"
+ failonerror="true" fork="yes" dir="${basedir}/${ant.project.name}-jws" >
+ <classpath refid="project.classpath"/>
+ <arg line="${ant.project.name} ${mas2j.project.file}"/>
+ </java>
+ <copy todir="${basedir}/${ant.project.name}-jws" failonerror="no">
+ <fileset dir="${basedir}/lib" includes="**/*.jar" />
+ <fileset dir="${basedir}" includes="${ant.project.name}.jar" />
+ <fileset dir="/home/tom/workspace/jason/src/images" includes="Jason-GMoreau-Icon.jpg" />
+ </copy>
+ <signjar jar="${basedir}/${ant.project.name}-jws/${ant.project.name}.jar" alias="jason"
+ storepass="rbjhja" keypass="rbjhja" keystore="/home/tom/workspace/jason/src/jasonKeystore" />
+ <echo message="**" />
+ <echo message="** Java Web Start application created in directory ${ant.project.name}-jws" />
+ <echo message="** Update the codebase (in the second line of the .jnlp file)" />
+ <echo message="** with the URL where you will upload the application." />
+ <echo message="**" />
+ </target>
+
+
+ <target name="run" depends="compile" >
+ <echo message="Running project ${ant.project.name}" />
+ <java classname="jason.infra.centralised.RunCentralisedMAS"
+ failonerror="true" fork="yes" dir="${basedir}" >
+ <classpath refid="project.classpath"/>
+ <arg line="${mas2j.project.file} ${debug} "/>
+ <jvmarg line="-Xmx750M"/>
+ </java>
+ <antcall target="user-end" />
+ </target>
+
+ <target name="clean" >
+ <delete failonerror="no" includeEmptyDirs="true" verbose="true">
+ <fileset dir="${basedir}" includes="**/*.class"/>
+ </delete>
+ </target>
+
+
+
+</project>
Added: trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<project name ="custombuild" basedir="..">
+ <!-- Ensure we are using the latest build of Jason -->
+ <property name="jasonJar" value="../../../../lib/jason.jar"/>
+
+ <import file="build.xml"/>
+
+ <target name="user-init">
+ <ant dir="../../../../" inheritAll="false" target="plugin"/>
+ <ant dir="../../../jmca" inheritAll="false"/>
+ <ant dir="../.." inheritAll="false"/>
+ </target>
+
+ <target name="user-end">
+ </target>
+</project>
Added: trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,60 @@
+/* Jason Project */
+
+MAS commerce {
+
+ infrastructure: Centralised
+
+ environment: commerce.env.CommerceEnvironment
+
+ agents:
+ shop1
+ [
+ jasdl_ontologies="c,s",
+ jasdl_c_uri="/onts/commerce.owl",
+ jasdl_s_uri="/onts/society.owl"
+ ]
+ #1
+ agentArchClass jasdl.architecture.JASDLAgArch
+ agentClass jasdl.asSemantics.JASDLAgent
+ beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+ delivery_van
+ [
+ jasdl_ontologies="c,s",
+ jasdl_c_uri="/onts/commerce.owl",
+ jasdl_s_uri="/onts/society.owl"
+ ]
+ #2
+ agentArchClass jasdl.architecture.JASDLAgArch
+ agentClass jasdl.asSemantics.JASDLAgent
+ beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+ customer
+ [
+ jasdl_ontologies="c,s",
+ jasdl_c_uri="/onts/commerce.owl",
+ jasdl_s_uri="/onts/society.owl"
+ ]
+ #3
+ agentArchClass jasdl.architecture.JASDLAgArch
+ agentClass jasdl.asSemantics.JASDLAgent
+ beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+ pa
+ [
+ jasdl_ontologies="c,s",
+ jasdl_c_uri="/onts/commerce.owl",
+ jasdl_s_uri="/onts/society.owl"
+ ]
+ #3
+ agentArchClass jasdl.architecture.JASDLAgArch
+ agentClass jasdl.asSemantics.JASDLAgent
+ beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+
+ classpath: "../../lib/**/*.jar"; // JASDL's libraries
+ "../../../jmca/lib/jmca.jar"; // JMCA
+
+ aslSourcePath: "src/asl";
+}
+
Added: trunk/applications/jasdl-owlapi/examples/commerce/logging.properties
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/logging.properties (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/logging.properties 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,50 @@
+# Jason Default log configuration
+#
+# Comment/uncomment the following lines to setup your log
+#
+
+# default Jason MAS Console
+handlers = jason.runtime.MASConsoleLogHandler
+
+# To use the ConsoleHandler, use the following line instead.
+#handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default logging level. Other values are:
+# SEVERE (only severe messages)
+# WARNING (only warnings and severe messages)
+# INFO (normal output)
+# FINE (debug level of messages)
+.level = INFO
+
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# Jason Handler parameters
+jason.runtime.MASConsoleLogHandler.level = ALL
+jason.runtime.MASConsoleLogHandler.formatter = jason.runtime.MASConsoleLogFormatter
+# set one text area for each agent
+jason.runtime.MASConsoleLogHandler.tabbed = true
+
+# default file output is in project's directory.
+java.util.logging.FileHandler.pattern = mas.log
+#java.util.logging.FileHandler.pattern = mas-%u.log
+java.util.logging.FileHandler.limit = 500000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = jason.runtime.MASConsoleLogFormatter
+#java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to FINE and above.
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = jason.runtime.MASConsoleLogFormatter
+
+java.level=OFF
+javax.level=OFF
+sun.level=OFF
+jade.level=OFF
+
Added: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-18 18:18:50 UTC (rev 1223)
@@ -0,0 +1,583 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+ <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+ <!ENTITY owl11 "http://www.w3.org/2006/12/owl11#" >
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY owl11xml "http://www.w3.org/2006/12/owl11-xml#" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+ <!ENTITY commerce "http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#" >
+]>
+
+
+<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#"
+ xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:owl11="http://www.w3.org/2006/12/owl11#"
+ xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:commerce="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#">
+ <owl:Ontology rdf:about=""/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Object Properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#contains -->
+
+ <owl:ObjectProperty rdf:about="#contains">
+ <rdf:type rdf:resource="&owl;TransitiveProperty"/>
+ <rdfs:range rdf:resource="#Ingredient"/>
+ <rdfs:domain rdf:resource="#Product"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasBrand -->
+
+ <owl:ObjectProperty rdf:about="#hasBrand">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:range rdf:resource="#Product"/>
+ <rdfs:domain rdf:resource="#Purchase"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasCustomer -->
+
+ <owl:ObjectProperty rdf:about="#hasCustomer">
+ <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
+ <rdfs:domain rdf:resource="#Order...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-20 16:47:45
|
Revision: 1230
http://jason.svn.sourceforge.net/jason/?rev=1230&view=rev
Author: tomklapiscak
Date: 2008-04-20 09:47:30 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
Given an incoming trigger, t, suppose we generalise to an SE-Plan, p, when looking for a relevant plan to deal with t.
The special variables JASDL_TG_CAUSE_RETAIN_ANNOTS and JASDL_TG_CAUSE are unified within the unifier of the intention that p is pushed onto
with t (including all annotations) and t with all annotations but "o" dropped. Has already proved to be a useful mechanism in the commerce example.
SE-Plans are now "inserted into" the plan library (in fact just the list of candidate SE-Plans returned) in order of generality (most specific first).
The algorithm to determine whether the trigger of one SE-Plan is more specific than another also supports arbitrarily nested SE-Literals.
Individuals are only instantiated under the enclosing SE-Literal's ontology if no reference to the individual (i.e. it's functor only) can be found across all ontologies known to the agent. In this sense, individuals are global across ontologies. TODO: is this safe? what if we want to reference two individuals by the same functor, but different label (i.e. ontology)? Qualify individuals with the [o(...)] annotation perhaps?
Fixed bug in jasdl.define_class. Abolishes defined class AFTER expression has been parsed in case the class definition uses a previously defined class by the same name within it.
Manchester OWL syntax renderers now renders class expressions in "normal form" (NsPrefix and URI short form providers extend Normalising short form provider that detects run-time defined classes and substitutes them for their renderings in terms of schema-defined classes). Both "anon" outgoing message annotations and classes renderings produced by jasdl.ia.get_class_definition are now inherently in normal form (the latter solves the thorny issue of run-time defined classes being defined in terms of themselves). Common#normaliseExpression deprecated since it is no longer needed.
Problem with Jason + JASDL - annotations of selected events added to triggers of intended means plan clones. Sometimes results in SE-Literals with multiple "o" annotations - hacked for now (last "o" removed).
jasdl.ia.define_class now removes assertions involving abolished definitions.
Continuing work on commerce example.
jasdl.ia.get_unique_individual now produces an individual name guaranteed to be unique across entire agent society (by prefixing identifier with agent name).
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/README
trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceEnvironment.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/CommerceModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomer.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelShop.java
trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgentConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JASDLPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/DLUnifier.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralToAxiomConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/protocol/IncomingProtocolProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/protocol/OutgoingProtocolProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/protocol/ProtocolProcessor.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/env/JASDLEnvironment.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_anonymous_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_class_definition.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/NsPrefixOWLObjectShortFormProvider.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/URIOWLObjectShortFormProvider.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomerListener.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/CustomerUIFrame.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/CustomerUIPanel.java
trunk/applications/jasdl-owlapi/src/jasdl/test/JASDLBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JASDLCommon.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NsPrefixOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/NormalisingOWLObjectShortFormProvider.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/test/JasdlBeliefBaseTest.java
trunk/applications/jasdl-owlapi/src/jasdl/util/Common.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NSPrefixOWLEntityChecker.java
Modified: trunk/applications/jasdl-owlapi/README
===================================================================
--- trunk/applications/jasdl-owlapi/README 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/README 2008-04-20 16:47:30 UTC (rev 1230)
@@ -20,4 +20,18 @@
Please refer to /trunk/jason/applications/jasdl-owlapi/examples/travel_agent/config.mas2j for an example of how to configure JASDL agents.
-Thank you for your interest in JASDL!
\ No newline at end of file
+*** Known issues ***
+
+The -+ operator does not function properly. Until this problem is fixed the operation must be performed in two steps as shown here:
+-+a;
+becomes:
+-a;
++a;
+
+When TG is applied to complex test goals, unifications do not propagate correctly
+
+Trigger generalisation is not properly applied when searching for an suitable failure event for intended means that are not in the top level of an intention.
+
+
+
+Thank you for your interest in JASDL!
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-20 16:47:30 UTC (rev 1230)
@@ -5,7 +5,7 @@
This file was generated by Jason ?
http://jason.sf.net
- April 18, 2008 - 18:12:11
+ April 20, 2008 - 17:28:53
-->
<project name ="commerce"
Modified: trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-20 16:47:30 UTC (rev 1230)
@@ -7,13 +7,13 @@
environment: commerce.env.CommerceEnvironment
agents:
- shop1
+ shop
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
jasdl_s_uri="/onts/society.owl"
]
- #1
+ #2
agentArchClass jasdl.architecture.JASDLAgArch
agentClass jasdl.asSemantics.JASDLAgent
beliefBaseClass jasdl.bb.JASDLBeliefBase;
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-20 16:47:30 UTC (rev 1230)
@@ -75,10 +75,17 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#includedIn -->
+
+ <owl:ObjectProperty rdf:about="#includedIn">
+ <owl:inverseOf rdf:resource="#includes"/>
+ </owl:ObjectProperty>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#includes -->
<owl:ObjectProperty rdf:about="#includes">
- <rdf:type rdf:resource="&owl;TransitiveProperty"/>
<rdfs:domain rdf:resource="#Order"/>
<rdfs:range rdf:resource="#Purchase"/>
</owl:ObjectProperty>
@@ -116,6 +123,16 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasProductDescription -->
+
+ <owl:DatatypeProperty rdf:about="#hasProductDescription">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:domain rdf:resource="#Purchase"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasQuantity -->
<owl:DatatypeProperty rdf:about="#hasQuantity">
@@ -126,6 +143,15 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasShopDescription -->
+
+ <owl:DatatypeProperty rdf:about="#hasShopDescription">
+ <rdfs:domain rdf:resource="#Purchase"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasVolume -->
<owl:DatatypeProperty rdf:about="#hasVolume">
@@ -339,31 +365,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#InStock -->
-
- <owl:Class rdf:about="#InStock">
- <owl:equivalentClass>
- <owl:Class>
- <owl:intersectionOf rdf:parseType="Collection">
- <rdf:Description rdf:about="#Product"/>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#hasInStock"/>
- <owl:someValuesFrom>
- <rdf:Description>
- <rdf:type rdf:resource="&owl;DataRange"/>
- <owl11:minInclusive rdf:datatype="&xsd;int">1</owl11:minInclusive>
- <owl11:onDataRange rdf:resource="&xsd;int"/>
- </rdf:Description>
- </owl:someValuesFrom>
- </owl:Restriction>
- </owl:intersectionOf>
- </owl:Class>
- </owl:equivalentClass>
- <rdfs:subClassOf rdf:resource="#Product"/>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Ingredient -->
<owl:Class rdf:about="#Ingredient">
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-04-20 16:47:30 UTC (rev 1230)
@@ -57,23 +57,20 @@
- <!--
- ///////////////////////////////////////////////////////////////////////////////////////
- //
- // Data properties
- //
- ///////////////////////////////////////////////////////////////////////////////////////
- -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#ownedBy -->
+ <owl:ObjectProperty rdf:about="#ownedBy">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ </owl:ObjectProperty>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#isBusy -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#owns -->
- <owl:DatatypeProperty rdf:about="#isBusy">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:range rdf:resource="&xsd;int"/>
- </owl:DatatypeProperty>
+ <owl:ObjectProperty rdf:about="#owns">
+ <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
+ <owl:inverseOf rdf:resource="#ownedBy"/>
+ </owl:ObjectProperty>
@@ -96,6 +93,22 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Butchers -->
+
+ <owl:Class rdf:about="#Butchers">
+ <rdfs:subClassOf rdf:resource="#Shop"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Company -->
+
+ <owl:Class rdf:about="#Company">
+ <rdfs:subClassOf rdf:resource="&owl;Thing"/>
+ </owl:Class>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Customer -->
<owl:Class rdf:about="#Customer">
@@ -114,6 +127,14 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#GreenGrocers -->
+
+ <owl:Class rdf:about="#GreenGrocers">
+ <rdfs:subClassOf rdf:resource="#Shop"/>
+ </owl:Class>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#PA -->
<owl:Class rdf:about="#PA">
@@ -134,9 +155,9 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Tesco -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Supermarket -->
- <owl:Class rdf:about="#Tesco">
+ <owl:Class rdf:about="#Supermarket">
<rdfs:subClassOf rdf:resource="#Shop"/>
</owl:Class>
@@ -185,18 +206,13 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van1 -->
- <DeliveryVan rdf:about="#delivery_van1">
- <isBusy rdf:datatype="&xsd;int">0</isBusy>
- </DeliveryVan>
+ <DeliveryVan rdf:about="#delivery_van1"/>
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van2 -->
- <DeliveryVan rdf:about="#delivery_van2">
- <isBusy rdf:datatype="&xsd;int">0</isBusy>
- <isEmployedBy rdf:resource="#shop1"/>
- </DeliveryVan>
+ <DeliveryVan rdf:about="#delivery_van2"/>
@@ -220,12 +236,28 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#shop1 -->
- <Tesco rdf:about="#shop1">
+ <Supermarket rdf:about="#shop1">
<employs rdf:resource="#delivery_van1"/>
- </Tesco>
+ <ownedBy rdf:resource="#tescos_inc"/>
+ </Supermarket>
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#shop2 -->
+
+ <Butchers rdf:about="#shop2">
+ <employs rdf:resource="#delivery_van2"/>
+ <ownedBy rdf:resource="#tescos_inc"/>
+ </Butchers>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#tescos_inc -->
+
+ <Company rdf:about="#tescos_inc"/>
+
+
+
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
@@ -237,15 +269,17 @@
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
+ <rdf:Description rdf:about="#pa3"/>
+ <rdf:Description rdf:about="#customer3"/>
+ <rdf:Description rdf:about="#delivery_van1"/>
<rdf:Description rdf:about="#pa2"/>
<rdf:Description rdf:about="#shop1"/>
<rdf:Description rdf:about="#pa1"/>
+ <rdf:Description rdf:about="#customer1"/>
<rdf:Description rdf:about="#customer2"/>
- <rdf:Description rdf:about="#customer1"/>
+ <rdf:Description rdf:about="#tescos_inc"/>
<rdf:Description rdf:about="#delivery_van2"/>
- <rdf:Description rdf:about="#delivery_van1"/>
- <rdf:Description rdf:about="#customer3"/>
- <rdf:Description rdf:about="#pa3"/>
+ <rdf:Description rdf:about="#shop2"/>
</owl:distinctMembers>
</rdf:Description>
</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl 2008-04-20 16:47:30 UTC (rev 1230)
@@ -6,36 +6,44 @@
* - the structural information in the ontology gives us a richer palette for semantic matching over and above that available through
* e.g. synonym matching.
* Assuming central repository of agents and their types (society.owl schema)
+ * IDs are propagated through annotations to match product request brands with quantities
*/
-!behave.
-
- // need to use SE-Literals to take advantage of syntactic translation
-+!behave
- <-
- .random(Rand);
- .wait(Rand*2000);
- .my_name(Me);
- jasdl.ia.define_class(employedPA, "s:pA and s:isEmployedBy value s:", Me);
- ?employedPA(PA)[o(self)];
- !order(PA, Me, bread(_)[o(c)], 1);
- !order(PA, Me, milk(_)[o(c)], 1);
- !order(PA, Me, bread(hovis)[o(c)], 1);
- .send(PA, achieve, confirm_order(Me)).
+
++ui_product_request(ProductDescription, ShopDescription, Qty)[source(percept)]
+ <-
+ .print("UI recieved request");
+ // Get a PA employed by me
+ ?employs(PA);
-+!order(PA, Order, Product, Qty)
+ // Explicitly discard the percept - in case an identical request comes in next perception cycle (we still want to catch it)
+ -ui_product_request(ProductDescription, ShopDescription, Qty)[source(percept)];
+
+ // Must be defined locally in order to take advantage of syntactic translation.
+ // If these were simply sent as string to PA and this agent had different entity aliases / ontology labels
+ // then the PA would not be able to understand the request.
+
+ jasdl.ia.define_class(suitableProduct, ProductDescription);
+ jasdl.ia.define_class(suitableShop, ShopDescription);
+
+
+ // Request a suitable brand from the PA
+ jasdl.ia.send(PA, achieve, suitable(suitableProduct(_)[o(self)], suitableShop(_)[o(self)], Qty)).
+
+
++!product(Brand)[o(c), source(PA), approve, id(ID)] :
+ employs(PA)
<-
- .send(PA, achieve, order(Order, Product, Qty));
- Confirmed = confirmed(Order, Brand, Qty)[source(PA)];
- .concat("+", Confirmed, WaitConfirmed); .wait(WaitConfirmed);
- -Confirmed.
+ approve(Brand);
+ .send(PA, tell, approved(product(Brand)[o(c), id(ID)])).
-+order_complete(Order)[source(Shop)]
+-!product(Brand)[o(c), source(PA), approve, id(ID)] :
+ employs(PA)
<-
- -order_complete(Order)[source(Shop)];
- !behave.
+ .send(PA, tell, rejected(product(Brand)[o(c), id(ID)])).
+
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl 2008-04-18 18:55:08 UTC (rev 1229)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl 2008-04-20 16:47:30 UTC (rev 1230)
@@ -2,30 +2,130 @@
-+!order(Order, Product, Qty)[source(Employer)] : isEmployedBy(Employer)
++!suitable(ProductClass, ShopClass, Qty)[source(Customer)] :
+ isEmployedBy(Customer)
+ <-
+ ?hasOrder(Customer, Order)[o(c)];
+ .print(Order);
+
+ ?ShopClass;
+ jasdl.ia.get_individual(ShopClass, Shop);
+
+
+ // Generate a unique (guaranteed across entire agent society) request identifier (individual)
+ jasdl.ia.get_anonymous_individual(ID);
+
+ jasdl.ia.get_class_definition(ShopClass, ShopDescription);
+ jasdl.ia.get_class_definition(ProductClass, ProductDescription);
+
+ // Add the condition that the product must be in stock (this is not something the customer should be concerned with)
+ .concat("(",ProductDescription,") and c:hasInStock some integer [ >= ",Qty,"]",ProductDescriptionInStock);
+
+ // Parse the product description into a class
+ jasdl.ia.define_class(productInStock, ProductDescriptionInStock);
+
+ .print("Asking ",Shop,":", ProductDescriptionInStock);
+
+ // Ask for all brands that match these criteria
+ //jasdl.ia.send(Shop, achieve, suitable(description(Brand)[o(self)])[id(ID)]).
+ jasdl.ia.send(Shop, askOne, productInStock(Brand)[o(self), id(ID)]);
+
+ +purchase(ID)[o(c)];
+ +includes(Order, ID)[o(c)];
+ +hasQuantity(ID, Qty)[o(c)];
+ +hasProductDescription(ID, ProductDescription)[o(c)];
+ +hasShopDescription(ID, ShopDescription)[o(c)].
+
+
++product(Brand)[o(c), id(ID), source(Shop)] :
+ shop(Shop)[o(s)] // from a known shop
<-
- ?shop(Shop)[o(s)];
- jasdl.ia.send(Shop, askOne, hasOrder(Employer, Order)[o(c)], hasOrder(Employer, Order)[o(c)]);
- // get me a brand that is in stock
- jasdl.ia.get_class_definition(Product, ProductDefinition);
- jasdl.ia.define_class(productInStock, ProductDefinition);//, " and (c:hasInStock some integer [>= ",Qty ," ])");
- jasdl.ia.send(Shop, askOne, productInStock(Brand)[o(self)], product(Brand)[o(c)]);
- .print("Brand name: ", Brand);
- /* Check against medical requirements of customer */
- .send(Shop, achieve, add_to_order(Order, Brand, Qty));
- Confirmed = confirmed(Order, Brand, Qty)[source(Shop)];
- .concat("+", Confirmed, WaitConfirmed); .wait(WaitConfirmed);
- -Confirmed;
- .send(Employer, tell, Confirmed).
+ !approve(product(Brand)[o(c), id(ID)]).
++referral(Referred)[id(ID), source(Shop)] :
+ shop(Referred)[o(s)] &
+ shop(Shop)[o(s)]
+ <-
+ -referral(Referred)[id(ID), source(Shop)];
+ .print("referred to ", Referred).
-+!confirm_order(Order)[source(Employer)] : isEmployedBy(Employer)
++failed[id(ID), source(Shop)] :
+ shop(Shop)[o(s)]
<-
- ?shop(Shop)[o(s)];
- .send(Shop, achieve, confirm_order(Order)).
+ !abolish_purchase(ID);
+ .print("Failed!").
++!approve(A)
+ <-
+
+ // get my employer (rule expressed in terms of SE-Literals, see common/society.asl)
+ ?isEmployedBy(Employer);
+
+ .my_name(Me);
+ .add_annot(A, source(Me), B);
+
+ // ask customer for approval
+ // We add the approve annotation to isolate this
+ // type of query from others
+ .add_annot(B, approve, C);
+ .send(Employer, achieve, C).
+
++approved(product(Brand)[o(c), id(ID)])[source(Employer)] :
+ isEmployedBy(Employer)
+ <-
+ +hasBrand(ID, Brand)[o(c)];
+ .print("Approved ", Brand, " (id: ", ID, ")").
+
+@sdfdsf[breakpoint]
++rejected(product(Brand)[o(c), id(ID)])[source(Employer)] :
+ isEmployedBy(Employer)
+ <-
+ ?includedIn(ID, Order)[o(c)];
+ ?hasQuantity(ID, Qty)[o(c)];
+ ?hasProductDescription(ID, ProductDescription)[o(c)];
+ ?hasShopDescription(ID, ShopDescription)[o(c)];
+
+ !abolish_purchase(ID);
+
+ .concat("(",ProductDescription,") and not {c:",Brand,"}", AmmendedProductDescription);
+ .print("Rejected ", Brand, " (id: ", ID, ")");
+
+ // We need this individual to be instantiated in our own commerce ontology
+ // to allow us to safely refer to it in class expressions
+ //+product(Brand)[o(c)];
+
+ // Get the class describing the type of product, adding the additional requirement that it
+ // also not be the individual rejected by the customer
+ jasdl.ia.define_class(ammendedProductClass, AmmendedProductDescription);
+
+ // Get the class describing the desired type of shop, without changing any requirements
+ jasdl.ia.define_class(shopClass, ShopDescription);
+
+ .print("Rejected ", Brand, ". Retry with shop=", ShopDescription, " and product=", AmmendedProductDescription);
+
+ // We use the same achieve goal used by a customer here, effectively emulating a customer request, but with the ammended product
+ // description, given the customer's rejection
+ !suitable(ammendedProductClass(_)[o(self)], shopClass(_)[o(self)], Qty)[source(Employer)].
++!abolish_purchase(ID) :
+ purchase(ID)[o(c)]
+ <-
+ -hasProductDescription(ID, _)[o(c), source(self)];
+ -hasShopDescription(ID, _)[o(c), source(self)];
+ -includedIn(ID, _)[o(c), source(self)];
+ -hasQuantity(ID, _)[o(c), source(self)];
+ -purchase(ID)[o(c), source(self)].
+
+
+/* Opening a new order.
+ * Will only be generated with no order can be found (or at least none by this name)
+ */
++?hasOrder(Customer, Order)[o(c)] :
+ isEmployedBy(Customer)
+ <-
+ jasdl.ia.get_anonymous_individual(Order);
+ +hasOrder(Customer, Order)[o(c)].
Added: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl 2008-04-20 16:47:30 UTC (rev 1230)
@@ -0,0 +1,240 @@
+{include("common/society.asl")}
+
++!kqml_received(Sender, askOne, Content[o(O), id(ID)], MsgId) :
+ pA(PA)[o(s)]
+ <-
+ .add_annot(Content, source(Sender), X);
+ .add_annot(X, o(O), Y);
+ .add_annot(Y, id(ID), Z);
+ ?Z.
+
+
+
+
+
+
+
+
++?product(Brand)[o(c), id(ID), source(PA)] : JASDL_TG_CAUSE
+ <-
+ //.add_annot(JASDL_TG_CAUSE, id(ID), Response);
+ //.send(PA, tell, Response).
+ jasdl.ia.get_individual(JASDL_TG_CAUSE, Brand);
+ .print("Sending ", JASDL_TG_CAUSE);
+ .send(PA, tell, product(Brand)[o(c), id(ID)]).
+
+/** Plans dealing with a failure to find a suitable product within the belief-base of this agent */
+
++?thing(Brand)[o(owl), id(ID), source(PA)] :
+ not JASDL_TG_CAUSE
+ <-
+ .print("Requested unknown product, moreover, no other shops in this company can be identified to potentially service this request");
+ .send(PA, tell, failure[id(ID)]).
+
++?product(Brand)[o(c), id(ID), source(PA)] :
+ not JASDL_TG_CAUSE &
+ .my_name(Me) &
+ ownedBy(Me, Owner)[o(s)] &
+ jasdl.ia.define_class(mightStock, "s:shop and s:ownedBy value s:",Owner," and (not {s:",Me,"})") &
+ mightStock(Shop)[o(self)]
+ <-
+ .print("Requested unknown product, attempting to refer to any other shop owned by this company");
+ .send(PA, tell, referral(Shop)[id(ID)]).
+
+/**
+ * No suitable product has been found in this agent's belief base. However,
+ * because it is a type of meat product, it might be worth looking for butchers
+ * owned by this company and referring to PA to them (if any are known).
+ */
++?meat(Brand)[o(c), id(ID), source(PA)] :
+ not JASDL_TG_CAUSE &
+ .my_name(Me) &
+ ownedBy(Me, Owner)[o(s)] &
+ jasdl.ia.define_class(mightStock, "s:butchers and s:ownedBy value s:",Owner," and (not {s:",Me,"})") &
+ mightStock(Butchers)[o(self)]
+ <-
+ .print("Requested unknown meat product, attempting to refer to a butchers owned by this company");
+ .send(PA, tell, referral(Butchers)[id(ID)]).
+
+/****************************************************************/
+
+
+
+
+
++!add_to_order(Order, Brand, Qty)[source(PA)] :
+ product(Brand)[o(c)] & // check known product brand
+ hasCustomer(Order, Customer)[o(c)] & employs(Customer, PA)[o(s)] & // check PA is authorised to speak on behalf of customer whose order it is
+ hasInStock(Brand, StockLevel)[o(c)] & StockLevel>=Qty // check we have enough stock
+ <-
+
+ // get a unique purchase identifier
+ jasdl.ia.get_anonymous_individual(PID);
+
+ // add purchase
+ +purchase(PID)[o(c)];
+ +includes(Order, PID)[o(c)];
+ +hasBrand(PID, Brand)[o(c)];
+ +hasQuantity(PID, Qty)[o(c)];
+ .send(PA, tell, confirmed(Order, Brand, Qty)).
+
+
+
++!confirm_order(Order)[source(PA)] :
+ hasCustomer(Order, Customer)[o(c)] &
+ employs(Customer, PA)[o(s)]
+ <-
+ !deploy(Order);
+ !allocate_available(Van);
+ !recall(Van);
+ !load(Order, Van);
+ !dispatch(Order, Van);
+ !unload(Order, Van);
+ +available(Van);
+ .abolish(includes(Order, _)[o(c)]);
+ .send(Customer, tell, order_complete(Order)).
+
+
+
+@available[atomic]
++!allocate_available(Van)
+ <-
+ ?available(Van)[source(_)];
+ -available(Van)[source(_)].
+
++?available(Van)
+ <-
+ .concat("+",available(Van)[source(_)], WaitFor);
+ .wait(WaitFor);
+ ?available(Van)[source(_)].
+
++!load(Order, Van) : .my_name(Me) & inVicinityOf(Van)
+ <-
+ -hasPosition(Van, X, Y)[source(Van)];
+ .findall(PID, includes(Order, PID)[o(c)], PIDs);
+ .send(Van, achieve, load(PIDs));
+ L=loading_complete[source(Van)];
+ .concat("+", L, WaitFor);
+ .wait(WaitFor);
+ -L.
+
++!unload(Order, Van)
+ <-
+ .findall(PID, includes(Order, PID)[o(c)], PIDs);
+ .send(Van, achieve, unload(PIDs));
+ L=unloading_complete[source(Van)];
+ .concat("+", L, WaitFor);
+ .wait(WaitFor);
+ -L.
+
++!recall(Van)
+ <-
+ .my_name(Me);
+ ?hasPosition(Me, MX, MY);
+ !hasPosition(Van, MX, MY).
+
++!dispatch(Order, Van)
+ <-
+ ?hasCustomer(Order, Customer)[o(c)];
+ .send(Customer, askOne, hasPosition(Customer, X, Y), hasPosition(Customer, X, Y));
+ !hasPosition(Van, X, Y).
+
+
++!hasPosition(Van, X, Y) : L=hasPosition(Van, X, Y) & not L
+ <-
+ .send(Van, achieve, hasPosition(Van, X, Y));
+ .concat("+", L[source(Van)], WaitFor);
+ .wait(WaitFor);
+ -L.
+
++!hasPosition(Van, X, Y) : L=hasPosition(Van, X, Y) & L.
+
+
+
+
++!deploy([]).
++!deploy([Purchase|Purchases])
+ <-
+ ?hasBrand(Purchase, Brand)[o(c)];
+ ?hasQuantity(Purchase, Qty)[o(c)];
+ deploy(Purchase, Brand, Qty);
+ .print("Deploying crate", Purchase);
+ !deploy(Purchases).
++!deploy(Order)
+ <-
+ .findall(PID, includes(Order, PID)[o(c)], PIDs);
+ !deploy(PIDs).
+
+
+
+
++?details(Brand, Details) : product(PID)[o(c)]
+ <-
+ ?hasPrice(Brand, Price)[o(c)];
+ ?hasInStock(Brand, StockLevel)[o(c)];
+ jasdl.ia.get_types(Brand, self, true, Types);
+ .concat("Brand Name=", Brand, ", Stock level=", StockLevel, ", Price=", ", Classifications=", Types, Price...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-22 18:25:21
|
Revision: 1240
http://jason.svn.sourceforge.net/jason/?rev=1240&view=rev
Author: tomklapiscak
Date: 2008-04-22 11:25:14 -0700 (Tue, 22 Apr 2008)
Log Message:
-----------
Pre-release nearly complete
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/README
trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/delivery_van.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceEnvironment.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceView.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/CommerceModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomer.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomerListener.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelShop.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/CustomerUIPanel.java
trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgentConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/package.html
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JASDLPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_anonymous_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_class_definition.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_functor.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_individual.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_types.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_belief_revision_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/is_contraction_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_annotation_gathering_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_belief_revision_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/set_contraction_enabled.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JASDLCommon.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NsPrefixOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/URIOWLEntityChecker.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/doc/
trunk/applications/jasdl-owlapi/doc/mas2jconfiguration
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/src/jasdl/bridge/DLUnifier.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/send.java
Property Changed:
----------------
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/
Modified: trunk/applications/jasdl-owlapi/README
===================================================================
--- trunk/applications/jasdl-owlapi/README 2008-04-22 16:46:22 UTC (rev 1239)
+++ trunk/applications/jasdl-owlapi/README 2008-04-22 18:25:14 UTC (rev 1240)
@@ -20,6 +20,23 @@
Please refer to /trunk/jason/applications/jasdl-owlapi/examples/travel_agent/config.mas2j for an example of how to configure JASDL agents.
+
+********************************************************
+--- Directory Structure ---
+
+The JASDL distribution is structured as such:
+
+ README - This file
+
+ docs/
+ mas2jconfig - Instructions on mas2j setup for a JASDL agent
+ java - Java docs for JASDL
+
+
+
+
+********************************************************
+
*** Known issues ***
The -+ operator does not function properly. Until this problem is fixed the operation must be performed in two steps as shown here:
@@ -32,6 +49,11 @@
Trigger generalisation is not properly applied when searching for an suitable failure event for intended means that are not in the top level of an intention.
+Complex test goals resulting from queries against the ontology (those whose event has a SE-Literal, e.g. ?hotel(hilton)[o(travel)]), prevent their instantiating intention from properly generating failure events.
+Any test queries (and hence ask messages) that might result in the trigger generalisation mechanism being employed will need to include the "jasdl_tg_cause(_)" annotation (the parameter will not be unified and so is best left anonymous for clarity). If future work deems this issue unavoidable, JASDL will make a pass through the plan library and add this annotation automatically where required so the developer need not worry about it.
+
+
+
Thank you for your interest in JASDL!
Added: trunk/applications/jasdl-owlapi/doc/mas2jconfiguration
===================================================================
--- trunk/applications/jasdl-owlapi/doc/mas2jconfiguration (rev 0)
+++ trunk/applications/jasdl-owlapi/doc/mas2jconfiguration 2008-04-22 18:25:14 UTC (rev 1240)
@@ -0,0 +1,161 @@
+The following file documents how to configure a Jason agent to make use of JASDL.
+
+
+********************************************************
+--- Necessary settings for standard Jason parameters ---
+
+For each JASDL agent, the following must be set to use JASDL classes (or extensions thereof) as shown.
+
+ agentArchClass jasdl.architecture.JASDLAgArch
+ agentClass jasdl.asSemantics.JASDLAgent
+ beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+If your MAS makes use of an environment class, the following must be set to use a JASDL class (or an extension thereof) as shown:
+
+ environment: jasdl.env.JASDLEnvironment
+
+Additionally, we must ensure all of the libraries JASDL is dependent upon are in the classpath of a JASDL agent.
+This is not an issue if the libraries are under the agent's directory. However, to avoid unneccesary duplication,
+since commerce and travel_agent are nested within the JASDL distribution, we set the classpath for these as follows:
+
+ classpath: "../../lib/**/*.jar";
+
+********************************************************
+
+
+********************************************************
+--- Necessary JASDL agent settings ---
+
+For each JASDL agent, the following must be specified in its user parameters.
+
+ jasdl_ontologies = "<o_1>, <o_2> ...., <o_n>"
+
+ Where each <o_n> is an atomic label used to identify the ontology within the "o" annotation in the agent's
+ .asl code.
+
+Additionally, for each <o_n>, we must specify the reachable physical URI of the ontology so it can be loaded, as follows:
+
+ jasdl_<o_n>_uri = "<uri>"
+
+ Where <uri> is a valid URI. Note that this can also be specified relative to the execution path of the agent (i.e. the location
+ of the .mas2j file).
+
+********************************************************
+
+
+********************************************************
+--- Optional JASDL agent settings ---
+
+For each JASDL agent, the following settings may be specified in its user parameters. Note that these configure advanced
+features of JASDL, and will not be necessary in some circumstances.
+
+ jasdl_<o>_mapping_strategies = "<class_1>, <class_2> ..., <class_n>"
+
+ Where <o> is some atomic ontology label specified in jasdl_ontologies (see above), and each <class_n>
+ is the fully-qualified class name of an implementation of the jasdl.bridge.mapping.aliasing.MappingStrategy interface.
+ This specifies the automatic mapping strategies that will be applied to the ontological entities
+ contained within <o>. Such a strategy should apply a consistent mapping from the fragment of an entity URI
+ to the atomic functor used to refer to it in the agent's .asl code. For example:
+
+ jasdl_travel_mapping_strategies = "jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy",
+ which decapitalises the first letter of any resource whose fragment begins with an upper case letter
+ (in order to make it compatible with AgentSpeak syntax). For instance, this would cause
+ "http://www.owl-ontologies.com/travel.owl#Hotel" to map to the alias "hotel", thus we could refer to
+ this entity with the SE-Literal hotel(X)[o(travel)].
+
+ Note that if an automatic mapping strategy results in a name clash (two identical aliases), JASDL will
+ assign the offending resource an anonymous label. For example, if we applied the strategy above and we had the
+ resources "http://.../travel.owl#Hotel" and "http://.../travel.hotel" (encountered in that order), the latter
+ would be assigned the alias "anon_alias_<n>", where <n> is an integer guaranteeing the uniqueness of the
+ anonymous label.
+
+ This setting defaults to "jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy"
+
+ jasdl_default_mappings_strategies = "<class_1>, <class_2> ..., <class_n>"
+
+ Where each <class_n> is the fully-qualified class name of an implementation of the jasdl.bridge.mapping.aliasing.MappingStrategy interface.
+ This specifies the mapping strategies that will be applied to any ontologies / ontological entities instantiated
+ during the execution of the agent.
+
+ This setting defaults to "jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy"
+
+ jasdl_<o>_manual_mappings = "<alias_1>=<fragment_1> ... , <alias_n>=<fragment_n>"
+
+ Where each alias_n is the desired alias for the entity referred to by the URI fragment <fragment_n> (which identifies a resource
+ in the ontology referred to by <0>, e.g. "Hotel" might refer to "http://.../travel.owl#Hotel"). We might wish to map
+ the alias "hotel" to this resource, which would achieve using the pair "hotel=Hotel".
+
+ It is predicted that this setting will be of most use when the agent designer is aware of, and wishes to prevent,
+ a name clash that will result from the automatic mapping strategies specified (thus causing an entity to be assigned an
+ anonymous alias).
+
+ This setting defaults to ""
+
+ jasdl_reasonerClass = "<class>"
+
+ Where <class> is the fully-qualified class name of an implementation of the org.semanticweb.owl.inference.OWLReasoner
+ interface, supported by the OWL-API. Currently, JASDL defaults to use Pellet ("org.mindswap.pellet.owlapi.Reasoner").
+ However, there is experimental support for FaCT++ ("uk.ac.manchester.cs.factplusplus.owlapi.Reasoner"), but you advised
+ against its use for now, since JASDL support for it is largely untested and very buggy.
+
+ This setting defaults to "org.mindswap.pellet.owlapi.Reasoner".
+
+The following features are used to enable or support features of JASDL that are currently highly experimental. Moreover,
+they are all computationally expensive to execute and can slow the execution of a JASDL agent significantly.
+As a result, their usage is (for now) discouraged.
+
+ jasdl_useAnnotationGathering = "<boolean>"
+
+ If set to "true", when quering the belief base for an SE-Literal, the resulting SE-Literal, x, will possess
+ not only the annotations explicitly asserted to belong to it, but also the annotations of all SE-Literals
+ whose corresponding assertion in some way contributes to the entailement of x.
+
+ This setting defaults to "false".
+
+ jasdl_useContraction = "<boolean>"
+
+ If set to "true", when removing an SE-Literal, x, from the belief base, JASDL will remove not only x itself,
+ but also all SE-Literals whose corresponding assertion in some way contributes to the entailement of x.
+
+ IMPORTANT NOTE: a common problem when contraction is disabled is encountered when attempting to remove an asserted
+ object property using a SE-Literal removal that refers to the inverse of the asserted property. Without
+ contraction, the assertion will not be removed - the object property used in the original assertion must be used.
+
+ This setting defaults to "false".
+
+ jasdl_useBeliefRevision = "<boolean>"
+
+ If set to "true", JASDL employs its (experimental) DL-based belief revision mechanism.
+
+ This setting defaults to "false". In which case, JASDL employs its legacy consistency assurance mechanism
+ whereby inconsistent assertions are simply rolled back, giving precedence to earlier ones.
+
+ This setting defaults to "false".
+
+ jasdl_known_agents = "<ag_1>, <ag_2> ..., <ag_n>"
+
+ Where each <ag_n> is the name of an agent we might refer to in the source annotation of an SE-Literal.
+ This, combined with their assigned trust ratings (see below), is currently used (only) by JASDL's
+ experimental DL-based belief revision and belief base contraction support.
+
+ In these cases, it is used by the "incision function", which determines which supporting assertions to
+ undermine when attempting to contract a belief (removing the belief itself and all assertions leading to its entailement).
+ Assertions associated (by the source annotation) with least-trusted agents
+ (i.e. those with lowest trust rating - see below) are removed first.
+
+ This setting defaults to "".
+
+ jasdl_<ag_n>_trustRating = "<float>"
+
+ Where each <ag_n> is the name of an agent we might refer to in the source annotation of an SE-Literal, one for each
+ specified in the known_agents setting (see above) and <float> is a numerical value between 0 and 1. See above for
+ discussion on how this is used.
+
+ This setting is mandatory for each agent specified by known_agents and so has no default.
+
+********************************************************
+
+
+
+
+
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-22 16:46:22 UTC (rev 1239)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-22 18:25:14 UTC (rev 1240)
@@ -5,7 +5,7 @@
This file was generated by Jason ?
http://jason.sf.net
- April 20, 2008 - 17:28:53
+ April 22, 2008 - 19:07:12
-->
<project name ="commerce"
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml 2008-04-22 16:46:22 UTC (rev 1239)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml 2008-04-22 18:25:14 UTC (rev 1240)
@@ -7,7 +7,7 @@
<import file="build.xml"/>
<target name="user-init">
- <ant dir="../../../../" inheritAll="false" target="plugin"/>
+ <ant dir="../../../../" inheritAll="false" target="jar"/>
<ant dir="../../../jmca" inheritAll="false"/>
<ant dir="../.." inheritAll="false"/>
</target>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-22 16:46:22 UTC (rev 1239)
+++ trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-22 18:25:14 UTC (rev 1240)
@@ -1,4 +1,13 @@
-/* Jason Project */
+/* .mas2j configuration of the commerce MAS
+ * Note:
+ * - this takes advantage of defaults for many of the settings available
+ * for the configuration of a JASDL agent. Please consult docs/mas2jconfiguration
+ * for full documentation of these.
+ * - in the interests of simplicitly, all agents make use of the same label mappings for ontologies
+ * and (automatic and manual) alias mappings for ontological entities.
+ * There could be set arbitrarily for each agent (and the .asl code updated accordingly) and JASDL would
+ * still function correctly.
+ */
MAS commerce {
@@ -7,13 +16,15 @@
environment: commerce.env.CommerceEnvironment
agents:
+
+
shop
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
jasdl_s_uri="/onts/society.owl"
]
- #2
+ #3
agentArchClass jasdl.architecture.JASDLAgArch
agentClass jasdl.asSemantics.JASDLAgent
beliefBaseClass jasdl.bb.JASDLBeliefBase;
@@ -24,7 +35,7 @@
jasdl_c_uri="/onts/commerce.owl",
jasdl_s_uri="/onts/society.owl"
]
- #2
+ #4
agentArchClass jasdl.architecture.JASDLAgArch
agentClass jasdl.asSemantics.JASDLAgent
beliefBaseClass jasdl.bb.JASDLBeliefBase;
@@ -44,7 +55,9 @@
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
- jasdl_s_uri="/onts/society.owl"
+ jasdl_s_uri="/onts/society.owl",
+
+ jasdl_useContraction = "true"
]
#3
agentArchClass jasdl.architecture.JASDLAgArch
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-22 16:46:22 UTC (rev 1239)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-22 18:25:14 UTC (rev 1240)
@@ -40,7 +40,6 @@
<owl:ObjectProperty rdf:about="#contains">
<rdf:type rdf:resource="&owl;TransitiveProperty"/>
- <rdfs:range rdf:resource="#Ingredient"/>
<rdfs:domain rdf:resource="#Product"/>
</owl:ObjectProperty>
@@ -59,7 +58,6 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasCustomer -->
<owl:ObjectProperty rdf:about="#hasCustomer">
- <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
<rdfs:domain rdf:resource="#Order"/>
</owl:ObjectProperty>
@@ -68,13 +66,21 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasOrder -->
<owl:ObjectProperty rdf:about="#hasOrder">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
<rdfs:range rdf:resource="#Order"/>
<owl:inverseOf rdf:resource="#hasCustomer"/>
</owl:ObjectProperty>
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasShop -->
+
+ <owl:ObjectProperty rdf:about="#hasShop">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:domain rdf:resource="#Purchase"/>
+ </owl:ObjectProperty>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#includedIn -->
<owl:ObjectProperty rdf:about="#includedIn">
@@ -123,16 +129,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasProductDescription -->
-
- <owl:DatatypeProperty rdf:about="#hasProductDescription">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:domain rdf:resource="#Purchase"/>
- <rdfs:range rdf:resource="&xsd;string"/>
- </owl:DatatypeProperty>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasQuantity -->
<owl:DatatypeProperty rdf:about="#hasQuantity">
@@ -143,25 +139,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasShopDescription -->
-
- <owl:DatatypeProperty rdf:about="#hasShopDescription">
- <rdfs:domain rdf:resource="#Purchase"/>
- <rdfs:range rdf:resource="&xsd;string"/>
- </owl:DatatypeProperty>
-
-
-
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasVolume -->
-
- <owl:DatatypeProperty rdf:about="#hasVolume">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:domain rdf:resource="#Product"/>
- <rdfs:range rdf:resource="&xsd;double"/>
- </owl:DatatypeProperty>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasWeight -->
<owl:DatatypeProperty rdf:about="#hasWeight">
@@ -183,26 +160,10 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Allergen -->
-
- <owl:Class rdf:about="#Allergen">
- <rdfs:subClassOf rdf:resource="#Ingredient"/>
- <rdfs:comment
- >Ingredients that are common allergens</rdfs:comment>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Beef -->
<owl:Class rdf:about="#Beef">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#BeefIngredient"/>
- </owl:Restriction>
- </owl:equivalentClass>
- <rdfs:subClassOf rdf:resource="#Meat"/>
+ <rdfs:subClassOf rdf:resource="#MeatProduct"/>
<owl:disjointWith rdf:resource="#Chicken"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -212,12 +173,6 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Bread -->
<owl:Class rdf:about="#Bread">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#Gluten"/>
- </owl:Restriction>
- </owl:equivalentClass>
<rdfs:subClassOf rdf:resource="#Grocery"/>
</owl:Class>
@@ -234,94 +189,18 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Chicken -->
<owl:Class rdf:about="#Chicken">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#ChickenIngredient"/>
- </owl:Restriction>
- </owl:equivalentClass>
- <rdfs:subClassOf rdf:resource="#Meat"/>
+ <rdfs:subClassOf rdf:resource="#MeatProduct"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ContainsGluten -->
-
- <owl:Class rdf:about="#ContainsGluten">
- <owl:equivalentClass>
- <owl:Class>
- <owl:intersectionOf rdf:parseType="Collection">
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#Gluten"/>
- </owl:Restriction>
- <rdf:Description rdf:about="#Grocery"/>
- </owl:intersectionOf>
- </owl:Class>
- </owl:equivalentClass>
- </owl:Class>
-
-
-
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ContainsLactose -->
-
- <owl:Class rdf:about="#ContainsLactose">
- <owl:equivalentClass>
- <owl:Class>
- <owl:intersectionOf rdf:parseType="Collection">
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#Lactose"/>
- </owl:Restriction>
- <rdf:Description rdf:about="#Grocery"/>
- </owl:intersectionOf>
- </owl:Class>
- </owl:equivalentClass>
- </owl:Class>
-
-
-
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ContainsMeat -->
-
- <owl:Class rdf:about="#ContainsMeat">
- <owl:equivalentClass>
- <owl:Class>
- <owl:intersectionOf rdf:parseType="Collection">
- <rdf:Description rdf:about="#Grocery"/>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:someValuesFrom rdf:resource="#MeatIngredient"/>
- </owl:Restriction>
- </owl:intersectionOf>
- </owl:Class>
- </owl:equivalentClass>
- </owl:Class>
-
-
-
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ContainsNuts -->
-
- <owl:Class rdf:about="#ContainsNuts">
- <owl:equivalentClass>
- <owl:Class>
- <owl:intersectionOf rdf:parseType="Collection">
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#Nuts"/>
- </owl:Restriction>
- <rdf:Description rdf:about="#Grocery"/>
- </owl:intersectionOf>
- </owl:Class>
- </owl:equivalentClass>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Cream -->
<owl:Class rdf:about="#Cream">
<rdfs:subClassOf rdf:resource="#Dairy"/>
+ <owl:disjointWith rdf:resource="#Butter"/>
+ <owl:disjointWith rdf:resource="#Milk"/>
</owl:Class>
@@ -329,12 +208,6 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Dairy -->
<owl:Class rdf:about="#Dairy">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#Lactose"/>
- </owl:Restriction>
- </owl:equivalentClass>
<rdfs:subClassOf rdf:resource="#Grocery"/>
</owl:Class>
@@ -343,13 +216,7 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Fish -->
<owl:Class rdf:about="#Fish">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#FishIngredient"/>
- </owl:Restriction>
- </owl:equivalentClass>
- <rdfs:subClassOf rdf:resource="#Meat"/>
+ <rdfs:subClassOf rdf:resource="#MeatProduct"/>
<owl:disjointWith rdf:resource="#Beef"/>
<owl:disjointWith rdf:resource="#Chicken"/>
<owl:disjointWith rdf:resource="#Lamb"/>
@@ -357,20 +224,18 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Grocery -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#GreenVegetable -->
- <owl:Class rdf:about="#Grocery">
- <rdfs:subClassOf rdf:resource="#Product"/>
+ <owl:Class rdf:about="#GreenVegetable">
+ <rdfs:subClassOf rdf:resource="#Vegetable"/>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Ingredient -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Grocery -->
- <owl:Class rdf:about="#Ingredient">
- <rdfs:subClassOf rdf:resource="#Grocery"/>
- <rdfs:comment
- >Ingredients that must be noted since some people cannot eat them</rdfs:comment>
+ <owl:Class rdf:about="#Grocery">
+ <rdfs:subClassOf rdf:resource="#Product"/>
</owl:Class>
@@ -378,40 +243,25 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Lamb -->
<owl:Class rdf:about="#Lamb">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#LambIngredient"/>
- </owl:Restriction>
- </owl:equivalentClass>
- <rdfs:subClassOf rdf:resource="#Meat"/>
+ <rdfs:subClassOf rdf:resource="#MeatProduct"/>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Meat -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#MeatProduct -->
- <owl:Class rdf:about="#Meat">
+ <owl:Class rdf:about="#MeatProduct">
<rdfs:subClassOf rdf:resource="#Grocery"/>
<owl:disjointWith rdf:resource="#Vegetable"/>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#MeatIngredient -->
-
- <owl:Class rdf:about="#MeatIngredient">
- <rdfs:subClassOf rdf:resource="#Ingredient"/>
- <rdfs:comment
- >Types of meat that food may contain</rdfs:comment>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Milk -->
<owl:Class rdf:about="#Milk">
<rdfs:subClassOf rdf:resource="#Dairy"/>
+ <owl:disjointWith rdf:resource="#Butter"/>
</owl:Class>
@@ -430,20 +280,6 @@
<owl:Class rdf:about="#Product">
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
- <rdfs:subClassOf>
- <owl:Class>
- <owl:unionOf rdf:parseType="Collection">
- <owl:Restriction>
- <owl:onProperty rdf:resource="#hasVolume"/>
- <owl:someValuesFrom rdf:resource="&xsd;double"/>
- </owl:Restriction>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#hasWeight"/>
- <owl:someValuesFrom rdf:resource="&xsd;double"/>
- </owl:Restriction>
- </owl:unionOf>
- </owl:Class>
- </rdfs:subClassOf>
</owl:Class>
@@ -464,15 +300,19 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#RootVegetable -->
+
+ <owl:Class rdf:about="#RootVegetable">
+ <rdfs:subClassOf rdf:resource="#Vegetable"/>
+ <owl:disjointWith rdf:resource="#GreenVegetable"/>
+ </owl:Class>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ShepherdsPie -->
<owl:Class rdf:about="#ShepherdsPie">
- <owl:equivalentClass>
- <owl:Restriction>
- <owl:onProperty rdf:resource="#contains"/>
- <owl:hasValue rdf:resource="#BeefIngredient"/>
- </owl:Restriction>
- </owl:equivalentClass>
+ <rdfs:subClassOf rdf:resource="#MeatProduct"/>
<rdfs:subClassOf rdf:resource="#Ready...
[truncated message content] |
|
From: <tom...@us...> - 2008-04-25 01:38:36
|
Revision: 1253
http://jason.svn.sourceforge.net/jason/?rev=1253&view=rev
Author: tomklapiscak
Date: 2008-04-24 18:38:25 -0700 (Thu, 24 Apr 2008)
Log Message:
-----------
JASDL pre-release (version 0.1) complete
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/README
trunk/applications/jasdl-owlapi/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/.classpath
trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/society.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/customer.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/delivery_van.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceEnvironment.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceView.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/CommerceModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelAgent.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCrate.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomer.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelCustomerListener.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelDeliveryVan.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelMobileAgent.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelObject.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelPA.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/ModelShop.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/model/Product.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/CommerceException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelAgentException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelDeliveryVanException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelMobileAgentException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelShopException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/CustomerUIPanel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/util/Common.java
trunk/applications/jasdl-owlapi/lib/bebops.jar
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgentConfigurator.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JASDLCommon.java
Removed Paths:
-------------
trunk/applications/jasdl-owlapi/examples/travel_agent/
trunk/applications/jasdl-owlapi/src/jasdl/test/
Property Changed:
----------------
trunk/applications/jasdl-owlapi/doc/
Modified: trunk/applications/jasdl-owlapi/README
===================================================================
--- trunk/applications/jasdl-owlapi/README 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/README 2008-04-25 01:38:25 UTC (rev 1253)
@@ -2,58 +2,56 @@
Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
JASDL is distributed under the LGPL license (see COPYING and COPYING.LESSER)
+Thank you for downloading this pre-release of JASDL.
-*** Running JASDL ***
+My apologies that the documentation is somewhat lacking for this release - this will be addressed soon. For now, the AgentSpeak code for the commerce example is richly commented and so should give you an idea of what is going on. For documentation of the additional internal actions that JASDL provides please consult the jasdl.ia.* package javadocs.
-Firstly, please check you are using the latest revision of the entire Jason trunk from the SVN before use.
+PLEASE NOTE: Your .jason/user.properties file must contain the jasonJar property pointing to a Jason .jar built using source from the Jason SVN revision 1240 or later. Please consult Jason documentation for instructions how to do this.
-To run a JASDL agent, its class-path must include all jars under the sub-directories:
- * trunk/applications/jasdl-owlapi/lib
- * trunk/applications/jmca/lib
- * All standard Jason libraries, please ensure that these are built from the latest revision of the Jason trunk.
+JASDL requires JDK version 5 or later to compile and run.
-The (unmodified) travel_agent example (trunk/applications/jasdl-owlapi/examples/travel_agent/config.mas2j)
-must be run in-situ within the Jason trunk. All necessary ant tasks will be performed by its custom build script.
-
-*** Configuring JASDL ***
+If you have any questions, please don't hesitate to email and I'd be glad to help.
-Please refer to /trunk/jason/applications/jasdl-owlapi/examples/travel_agent/config.mas2j for an example of how to configure JASDL agents.
-
-
-
********************************************************
+
--- Directory Structure ---
The JASDL distribution is structured as such:
-
- README - This file
+ src/ - JASDL source code
+
+ bin/ - Compilation target for JASDL classes
+
+ lib/ - Libraries that JASDL and applications developed using it are dependent upon
+
docs/
- mas2jconfig - Instructions on mas2j setup for a JASDL agent
- java - Java docs for JASDL
+ mas2jconfig - Instructions on configuration of a JASDL agent
+ java - Javadocs for JASDL
-
-
+ examples/ - Examples of applications developed using JASDL
+ commerce/ - An example JASDL application simulating an "e-commerce" scenario. Please consult commerce/README for more information
+
+
+
********************************************************
-*** Known issues ***
+--- Compiling JASDL ---
-The -+ operator does not function properly. Until this problem is fixed the operation must be performed in two steps as shown here:
--+a;
-becomes:
--a;
-+a;
+To compile JASDL run ant on its base directory (the directory this file is in).
-When TG is applied to complex test goals, unifications do not propagate correctly
+********************************************************
-Trigger generalisation is not properly applied when searching for an suitable failure event for intended means that are not in the top level of an intention.
+--- Running JASDL ---
-Complex test goals resulting from queries against the ontology (those whose event has a SE-Literal, e.g. ?hotel(hilton)[o(travel)]), prevent their instantiating intention from properly generating failure events.
+A Jason agent developed using JASDL can be run like any other. Please consult docs/mas2jconfig for instructions on how to setup the .mas2j file of a JASDL agent and examples/commerce/commerce.mas2j for an example.
+********************************************************
+--- Known issues ---
+
Any test queries (and hence ask messages) that might result in the trigger generalisation mechanism being employed will need to include the "jasdl_tg_cause(_)" annotation (the parameter will not be unified and so is best left anonymous for clarity). If future work deems this issue unavoidable, JASDL will make a pass through the plan library and add this annotation automatically where required so the developer need not worry about it.
+*******************************************************
-
-Thank you for your interest in JASDL!
+Finally, thank you for your interest in JASDL! I look forward to hearing your feedback.
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,44 +1,69 @@
<project basedir="." default="jar" name="jasdl">
- <property name="jason.dir" value="../.."/>
- <property name="apps.dir" value="${jason.dir}/applications"/>
- <property name="jmca.dir" value="${apps.dir}/jmca"/>
- <property name="bebops.dir" value="${apps.dir}/bebops"/>
- <property name="bebops.jar" value="${bebops.dir}/lib/bebops.jar"/>
- <property name="asunit.dir" value="${apps.dir}/as-unit-test"/>
+
+ <property file="${user.home}/.jason/user.properties"/>
+
<property name="source.dir" value="${basedir}/src" />
<property name="build.dir" value="${basedir}/bin" />
- <property name="apidocs.dir" value="${basedir}/doc/api" />
+ <property name="apidocs.dir" value="${basedir}/doc/api/java" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="jasdl.jar" value="${lib.dir}/jasdl.jar" />
+
+
+ <!-- Distribution properties -->
+ <property name="version.jasdl" value="0"/>
+ <property name="release.jasdl" value="1"/>
+
+ <property name="dist.dir" value="${user.home}/tmp/jasdl-owlapi-${version.jasdl}.${release.jasdl}" />
+ <property name="dist.file" value="${dist.dir}.zip" />
+
+
+ <!-- For conveniently building bebops, jason and jmca if present -->
+ <property name="jason.dir" value="../../../jason"/>
+ <property name="apps.dir" value="${jason.dir}/applications"/>
+ <property name="bebops.dir" value="${apps.dir}/bebops"/>
+ <property name="bebops.jar" value="${bebops.dir}/lib/bebops.jar"/>
+ <property name="jmca.dir" value="${apps.dir}/jmca"/>
+ <property name="jmca.jar" value="${jmca.dir}/lib/jmca.jar"/>
+ <property name="jason.dir" value="${apps.dir}/jmca"/>
+
+ <available file="${jason.dir}" type="dir" property="jason.available"/>
+
+ <target name="jason" if="jason.available">
+ <echo message="Building Jason (${jason.dir})"/>
+ <ant dir="${jason.dir}" inheritAll="false" target="jar"/>
+ </target>
-
+ <available file="${bebops.dir}" type="dir" property="bebops.available"/>
+ <target name="bebops" if="bebops.available">
+ <echo message="Building Bebops"/>
+ <ant dir="${bebops.dir}" inheritAll="false"/>
+ <copy file="${bebops.jar}" todir="${lib.dir}"/>
+ </target>
+
+ <available file="${jmca.dir}" type="dir" property="jmca.available"/>
+
+ <target name="jmca" if="jmca.available">
+ <echo message="Building JMCA"/>
+ <ant dir="${jmca.dir}" inheritAll="false"/>
+ <copy file="${jmca.jar}" todir="${lib.dir}"/>
+ </target>
+
+
<path id="project.classpath">
- <pathelement location="${jason.dir}/lib/jason.jar"/>
- <pathelement location="${jmca.dir}/lib/jmca.jar"/>
- <pathelement location="${asunit.dir}/lib/asunit.jar"/>
+ <pathelement location="${jasonJar}"/> <!-- taken from ./jason/user.properties -->
<fileset dir="./lib">
<include name="**/*.jar"/>
</fileset>
</path>
- <path id="test.classpath">
- <path refid="project.classpath" />
- <pathelement location="${build.dir}" />
- </path>
-
<target name="init">
<tstamp/>
<mkdir dir="${build.dir}"/>
- <available file="${bebops.dir}" type="dir" property="bebops.available"/>
</target>
- <target name="bebops" depends="init" if="bebops.available">
- <ant dir="${bebops.dir}" inheritAll="false"/>
- <copy file="${bebops.jar}" todir="${lib.dir}"/>
- </target>
- <target name="compile" depends="init, bebops">
+ <target name="compile" depends="init,jason,bebops,jmca">
<javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5">
<classpath refid="project.classpath" />
</javac>
@@ -54,18 +79,6 @@
<delete dir="${apidocs.dir}"/>
</target>
-
- <target name="test" depends="jar">
- <junit printsummary="yes" failureProperty="test.failure">
- <classpath refid="test.classpath" />
- <formatter type="plain" usefile="false" />
- <batchtest>
- <fileset dir="${source.dir}" includes="jasdl/test/*Test.java" />
- </batchtest>
- </junit>
- <fail message="test failed" if="test.failure" />
- </target>
-
<target name="apidoc" depends="compile" >
<javadoc
packagenames="jasdl.*"
@@ -81,5 +94,43 @@
</javadoc>
</target>
+ <target name="dist" depends="clean, jar, apidoc">
+ <echo message="Generating JASDL ${version.jasdl}.${release.jasdl}" />
+
+ <fixcrlf srcdir="${basedir}" eol="crlf" includes="**/*.txt,**/*.bat" />
+
+ <delete failonerror="no" includeEmptyDirs="true" >
+ <fileset dir="${dist.dir}" />
+ <fileset file="${dist.file}" />
+ </delete>
+
+ <mkdir dir="${dist.dir}" />
+
+ <copy todir="${dist.dir}">
+ <fileset dir="${basedir}" includes="build.xml" />
+ <fileset dir="${basedir}" includes="COPYING" />
+ <fileset dir="${basedir}" includes="COPYING.LESSER" />
+ <fileset dir="${basedir}" includes="log4j.properties" />
+ <fileset dir="${basedir}" includes="README" />
+
+ <fileset dir="${basedir}" includes="doc/**/*" />
+ <fileset dir="${basedir}" includes="lib/**/*" />
+ <fileset dir="${basedir}" includes="src/**/*" />
+
+ <fileset dir="${basedir}" includes="examples/commerce/commerce.mas2j" />
+ <fileset dir="${basedir}" includes="examples/commerce/logging.properties" />
+ <fileset dir="${basedir}" includes="examples/commerce/README" />
+
+ <fileset dir="${basedir}" includes="examples/commerce/bin/c-build.xml" />
+ <fileset dir="${basedir}" includes="examples/commerce/src/**/*" />
+ <fileset dir="${basedir}" includes="examples/commerce/onts/**/*" />
+
+
+ </copy>
+
+ <zip basedir="${dist.dir}/.." includes="jasdl-owlapi*/**/*" zipfile="${dist.file}"/>
+ </target>
+
+
</project>
Property changes on: trunk/applications/jasdl-owlapi/doc
___________________________________________________________________
Name: svn:ignore
+ api
Modified: trunk/applications/jasdl-owlapi/examples/commerce/.classpath
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/.classpath 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/.classpath 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/home/tom/workspace/jason/lib/jason.jar" sourcepath="/home/tom/workspace/jason/src">
<attributes>
<attribute name="javadoc_location" value="file:/home/tom/workspace/jason/doc/api/"/>
@@ -13,5 +12,6 @@
<attribute name="javadoc_location" value="file:/home/tom/workspace/owlapi/antbuild/build/javadoc/"/>
</attributes>
</classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-04-25 01:38:25 UTC (rev 1253)
@@ -2,10 +2,10 @@
<!--
- This file was generated by Jason ?
+ This file was generated by Jason 1.0.2
http://jason.sf.net
- April 22, 2008 - 19:07:12
+ April 25, 2008 - 00:06:35
-->
<project name ="commerce"
@@ -23,7 +23,6 @@
<pathelement location="${build.dir}"/>
<pathelement location="${jasonJar}"/>
<fileset dir="../../lib" > <include name="**/*.jar" /> </fileset>
- <pathelement location="../../../jmca/lib/jmca.jar"/>
</path>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/c-build.xml 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name ="custombuild" basedir="..">
- <!-- Ensure we are using the latest build of Jason -->
- <property name="jasonJar" value="../../../../lib/jason.jar"/>
-
+
<import file="build.xml"/>
- <target name="user-init">
- <ant dir="../../../../" inheritAll="false" target="jar"/>
- <ant dir="../../../jmca" inheritAll="false"/>
- <ant dir="../.." inheritAll="false"/>
+ <target name="user-init">
+ <!-- compile JASDL for convenience -->
+ <ant dir="../../" inheritAll="false" target="jar"/>
</target>
<target name="user-end">
Modified: trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/commerce.mas2j 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,12 +1,18 @@
/* .mas2j configuration of the commerce MAS
- * Note:
+ * Notes:
* - this takes advantage of defaults for many of the settings available
* for the configuration of a JASDL agent. Please consult docs/mas2jconfiguration
* for full documentation of these.
* - in the interests of simplicitly, all agents make use of the same label mappings for ontologies
* and (automatic and manual) alias mappings for ontological entities.
- * There could be set arbitrarily for each agent (and the .asl code updated accordingly) and JASDL would
- * still function correctly.
+ * These could be set arbitrarily for each agent (and the .asl code updated accordingly) and JASDL would
+ * still function correctly.
+ * - Each agent in the society must have associated with it an individual in society.owl (with a matching name) and
+ * a ModelAgent instance in the CommerceModel (where its ID matches agent name).
+ * - Although ontology URIs reference related local resources on the file system, they could equally reference (reachable) remote or local
+ * resources (e.g. http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl). In fact, any valid URI can be used here.
+ * - Since we make extensive use of inverse object properties, we enable the experimental "contraction" feature to ensure their removals
+ * are properly handled.
*/
MAS commerce {
@@ -22,7 +28,8 @@
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
- jasdl_s_uri="/onts/society.owl"
+ jasdl_s_uri="/onts/society.owl",
+ jasdl_useContraction = "true"
]
#3
agentArchClass jasdl.architecture.JASDLAgArch
@@ -33,7 +40,8 @@
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
- jasdl_s_uri="/onts/society.owl"
+ jasdl_s_uri="/onts/society.owl",
+ jasdl_useContraction = "true"
]
#4
agentArchClass jasdl.architecture.JASDLAgArch
@@ -44,7 +52,8 @@
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
- jasdl_s_uri="/onts/society.owl"
+ jasdl_s_uri="/onts/society.owl",
+ jasdl_useContraction = "true"
]
#3
agentArchClass jasdl.architecture.JASDLAgArch
@@ -55,8 +64,7 @@
[
jasdl_ontologies="c,s",
jasdl_c_uri="/onts/commerce.owl",
- jasdl_s_uri="/onts/society.owl",
-
+ jasdl_s_uri="/onts/society.owl",
jasdl_useContraction = "true"
]
#3
@@ -66,7 +74,6 @@
classpath: "../../lib/**/*.jar"; // JASDL's libraries
- "../../../jmca/lib/jmca.jar"; // JMCA
aslSourcePath: "src/asl";
}
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-04-25 01:38:25 UTC (rev 1253)
@@ -21,7 +21,12 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:commerce="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#">
- <owl:Ontology rdf:about=""/>
+ <owl:Ontology rdf:about="">
+ <rdfs:comment
+ >Individuals (i.e. brands of product) are not instantiated in this ontology schema (since product catalogue varies between shops and should not be shared information). Instead, they are instantiated by the CommerceModel class using SE-Percepts.</rdfs:comment>
+ <rdfs:comment
+ >The full potential for expressing types of products has not been explored here. For example, we could define a "contains" object property, relating a class of products to a notable ingredient that a customer may wish to avoid such as an allergen (e.g. lactose, gluten, etc).</rdfs:comment>
+ </owl:Ontology>
@@ -292,14 +297,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ReadyMeal -->
-
- <owl:Class rdf:about="#ReadyMeal">
- <rdfs:subClassOf rdf:resource="#Grocery"/>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#RootVegetable -->
<owl:Class rdf:about="#RootVegetable">
@@ -309,15 +306,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#ShepherdsPie -->
-
- <owl:Class rdf:about="#ShepherdsPie">
- <rdfs:subClassOf rdf:resource="#MeatProduct"/>
- <rdfs:subClassOf rdf:resource="#ReadyMeal"/>
- </owl:Class>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#Vegetable -->
<owl:Class rdf:about="#Vegetable">
@@ -326,15 +314,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#VegetableCurry -->
-
- <owl:Class rdf:about="#VegetableCurry">
- <rdfs:subClassOf rdf:resource="#ReadyMeal"/>
- <owl:disjointWith rdf:resource="#ShepherdsPie"/>
- </owl:Class>
-
-
-
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-04-25 01:38:25 UTC (rev 1253)
@@ -40,6 +40,8 @@
<owl:ObjectProperty rdf:about="#employs">
<rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
+ <rdfs:comment
+ >Inverse of isEmployedBy. An agent can employ many other agents (but each agent may only be employed by one agent)</rdfs:comment>
<rdfs:domain rdf:resource="#Agent"/>
<rdfs:range rdf:resource="#Agent"/>
</owl:ObjectProperty>
@@ -50,6 +52,8 @@
<owl:ObjectProperty rdf:about="#isEmployedBy">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:comment
+ >Inverse of isEmployedByemploys. Each agent may only be employed by one agent (but an agent can employ many other agents)</rdfs:comment>
<rdfs:domain rdf:resource="#Agent"/>
<rdfs:range rdf:resource="#Agent"/>
<owl:inverseOf rdf:resource="#employs"/>
@@ -61,6 +65,10 @@
<owl:ObjectProperty rdf:about="#ownedBy">
<rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:comment
+ >An agent is owned by exactly one company. Inverse of owns</rdfs:comment>
+ <rdfs:domain rdf:resource="#Agent"/>
+ <rdfs:range rdf:resource="#Company"/>
</owl:ObjectProperty>
@@ -69,6 +77,9 @@
<owl:ObjectProperty rdf:about="#owns">
<rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
+ <rdfs:comment
+ >A company can own many agents. Inverse of ownedBy</rdfs:comment>
+ <rdfs:domain rdf:resource="#Company"/>
<owl:inverseOf rdf:resource="#ownedBy"/>
</owl:ObjectProperty>
@@ -216,15 +227,15 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van_3 -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van3 -->
- <rdf:Description rdf:about="#delivery_van_3"/>
+ <DeliveryVan rdf:about="#delivery_van3"/>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van_4 -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#delivery_van4 -->
- <rdf:Description rdf:about="#delivery_van_4"/>
+ <DeliveryVan rdf:about="#delivery_van4"/>
@@ -250,7 +261,7 @@
<Supermarket rdf:about="#shop1">
<employs rdf:resource="#delivery_van1"/>
- <employs rdf:resource="#delivery_van_4"/>
+ <employs rdf:resource="#delivery_van4"/>
<ownedBy rdf:resource="#tescos_inc"/>
</Supermarket>
@@ -268,7 +279,7 @@
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#shop3 -->
<GreenGrocers rdf:about="#shop3">
- <employs rdf:resource="#delivery_van_3"/>
+ <employs rdf:resource="#delivery_van3"/>
<ownedBy rdf:resource="#tescos_inc"/>
</GreenGrocers>
@@ -291,20 +302,20 @@
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
- <rdf:Description rdf:about="#customer3"/>
<rdf:Description rdf:about="#customer2"/>
- <rdf:Description rdf:about="#shop2"/>
+ <rdf:Description rdf:about="#delivery_van1"/>
+ <rdf:Description rdf:about="#pa2"/>
+ <rdf:Description rdf:about="#shop1"/>
<rdf:Description rdf:about="#delivery_van2"/>
<rdf:Description rdf:about="#pa1"/>
- <rdf:Description rdf:about="#delivery_van_3"/>
<rdf:Description rdf:about="#customer1"/>
<rdf:Description rdf:about="#tescos_inc"/>
<rdf:Description rdf:about="#shop3"/>
- <rdf:Description rdf:about="#shop1"/>
- <rdf:Description rdf:about="#pa2"/>
- <rdf:Description rdf:about="#delivery_van_4"/>
- <rdf:Description rdf:about="#delivery_van1"/>
+ <rdf:Description rdf:about="#delivery_van3"/>
<rdf:Description rdf:about="#pa3"/>
+ <rdf:Description rdf:about="#shop2"/>
+ <rdf:Description rdf:about="#customer3"/>
+ <rdf:Description rdf:about="#delivery_van4"/>
</owl:distinctMembers>
</rdf:Description>
</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,15 +1,41 @@
+/*
+ * Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
+ *
+ * This file is part of JASDL.
+ *
+ * JASDL is free software: you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * JASDL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Lesser GNU General Public License for more details.
+ *
+ * You should have received a copy of the Lesser GNU General Public License
+ * along with JASDL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+!abolish_order(Order) :
- order(Order)[o(c)]
+ order(Order)[o(c)] // must be a known order
<-
- // Abolish beliefs about purchases included in this order, we no longer need them
+ // Abolish beliefs about purchases included in this order, we no longer need them
.findall(Purchase, includes(Order, Purchase)[o(c)], Purchases);
!abolish_purchases(Purchases);
-order(Order)[o(c), source(_)];
- // note: inverse of hasOrder
+ // note: inverse of hasOrder
-hasCustomer(Order, Customer)[o(c), source(_)].
-
+
+/*
+ * Terminal case
+ */
+!abolish_purchases([]).
+
+/*
+ * Recursive case
+ */
+!abolish_purchases([Purchase|Purchases])
<-
!abolish_purchase(Purchase);
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/society.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/society.asl 2008-04-24 22:26:31 UTC (rev 1252)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/society.asl 2008-04-25 01:38:25 UTC (rev 1253)
@@ -1,9 +1,30 @@
/*
+ * Copyright (C) 2008 Thomas Klapiscak (t.g...@du...)
+ *
+ * This file is part of JASDL.
+ *
+ * JASDL is free software: you can redistribute it and/or modify
+ * it under the terms of the Lesser GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * JASDL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Lesser GNU General Public License for more details.
+ *
+ * You should have received a copy of the Lesser GNU General Public License
+ * along with JASDL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
* PA is employed by a single ...
[truncated message content] |
|
From: <tom...@us...> - 2008-06-05 22:04:13
|
Revision: 1323
http://jason.svn.sourceforge.net/jason/?rev=1323&view=rev
Author: tomklapiscak
Date: 2008-06-05 15:04:11 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Added jasdl.owl, the JASDL-specific extension to the OWL2MAS template configuration ontology.
Added OWL2MAS custom agent object property handler classes for "jasdl.owl". These are instantiated dynamically based on a class name specified within a special OWL annotation. This annotation is applied to an object property that requires some special processing required to translate an extension of jasdl.owl into its corresponding .mas2j file.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/build.xml
trunk/applications/jasdl-owlapi/lib/bebops.jar
trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java
trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLReasonerFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/mapping/aliasing/AllDifferentPlaceholder.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/protocol/OutgoingProtocolProcessingStrategy.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/protocol/ProtocolProcessor.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteral.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralAllDifferentAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/bridge/seliteral/SELiteralDataPropertyAssertion.java
trunk/applications/jasdl-owlapi/src/jasdl/env/JASDLEnvironment.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/define_class.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_functor.java
trunk/applications/jasdl-owlapi/src/jasdl/ia/logging/log.java
trunk/applications/jasdl-owlapi/src/jasdl/util/JASDLCommon.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLDuplicateMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLInvalidSELiteralException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/exception/JASDLUnknownMappingException.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/NsPrefixOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/parsing/URIOWLEntityChecker.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/rendering/URIOWLObjectShortFormProvider.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/lib/owl2mas.jar
trunk/applications/jasdl-owlapi/onts/
trunk/applications/jasdl-owlapi/onts/jasdl.owl
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/DefaultMappingStrategyClassHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/OntologyHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/ReasonerClassHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/TrustRatingHandler.java
Modified: trunk/applications/jasdl-owlapi/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/build.xml 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/build.xml 2008-06-05 22:04:11 UTC (rev 1323)
@@ -25,6 +25,9 @@
<property name="jmca.dir" value="${apps.dir}/jmca"/>
<property name="jmca.jar" value="${jmca.dir}/lib/jmca.jar"/>
<property name="jason.dir" value="${apps.dir}/jmca"/>
+
+ <property name="owl2mas.dir" value="${apps.dir}/owl2mas"/>
+ <property name="owl2mas.jar" value="${owl2mas.dir}/lib/owl2mas.jar"/>
<available file="${jason.dir}" type="dir" property="jason.available"/>
@@ -49,7 +52,15 @@
<copy file="${jmca.jar}" todir="${lib.dir}"/>
</target>
+ <available file="${owl2mas.dir}" type="dir" property="owl2mas.available"/>
+ <target name="owl2mas" if="owl2mas.available">
+ <echo message="Building OWL2MAS"/>
+ <ant dir="${owl2mas.dir}" inheritAll="false"/>
+ <copy file="${owl2mas.jar}" todir="${lib.dir}"/>
+ </target>
+
+
<path id="project.classpath">
<pathelement location="${jasonJar}"/> <!-- taken from ./jason/user.properties -->
<fileset dir="./lib">
@@ -63,7 +74,7 @@
</target>
- <target name="compile" depends="init,jason,bebops,jmca">
+ <target name="compile" depends="init,jason,bebops,jmca,owl2mas">
<javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5">
<classpath refid="project.classpath" />
</javac>
Modified: trunk/applications/jasdl-owlapi/lib/bebops.jar
===================================================================
(Binary files differ)
Added: trunk/applications/jasdl-owlapi/lib/owl2mas.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jasdl-owlapi/lib/owl2mas.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jasdl-owlapi/onts/jasdl.owl
===================================================================
--- trunk/applications/jasdl-owlapi/onts/jasdl.owl (rev 0)
+++ trunk/applications/jasdl-owlapi/onts/jasdl.owl 2008-06-05 22:04:11 UTC (rev 1323)
@@ -0,0 +1,397 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+ <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+ <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" >
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+ <!ENTITY mas "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#" >
+ <!ENTITY jasdl "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#" >
+]>
+
+
+<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#"
+ xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl"
+ xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
+ xmlns:mas="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#"
+ xmlns:jasdl="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:owl2="http://www.w3.org/2006/12/owl2#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#">
+ <owl:Ontology rdf:about="">
+ <owl:imports rdf:resource="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl"/>
+ </owl:Ontology>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Annotation properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+ <owl:AnnotationProperty rdf:about="&mas;PropertyHandler"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Object Properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#default_mapping_strategy -->
+
+ <owl:ObjectProperty rdf:about="#default_mapping_strategy">
+ <mas:PropertyHandler
+ >jasdl.owl2mas.handler.DefaultMappingStrategyClassHandler</mas:PropertyHandler>
+ <rdfs:range rdf:resource="#MappingStrategyClass"/>
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentObjectProperty"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#hasOntology -->
+
+ <owl:ObjectProperty rdf:about="#hasOntology">
+ <mas:PropertyHandler
+ >jasdl.owl2mas.handler.OntologyHandler</mas:PropertyHandler>
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentObjectProperty"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_manual_mapping -->
+
+ <owl:ObjectProperty rdf:about="#ontology_manual_mapping">
+ <rdfs:range rdf:resource="#ManualMapping"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_mapping_strategy -->
+
+ <owl:ObjectProperty rdf:about="#ontology_mapping_strategy">
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.OntologyHandler</rdfs:comment>
+ <rdfs:range rdf:resource="#MappingStrategyClass"/>
+ <rdfs:domain rdf:resource="#Ontology"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#reasoner_class -->
+
+ <owl:ObjectProperty rdf:about="#reasoner_class">
+ <mas:PropertyHandler
+ >jasdl.owl2mas.handler.ReasonerClassHandler</mas:PropertyHandler>
+ <rdfs:range rdf:resource="#ReasonerClass"/>
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentObjectProperty"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#trust_rating -->
+
+ <owl:ObjectProperty rdf:about="#trust_rating">
+ <mas:PropertyHandler
+ >jasdl.owl2mas.handler.TrustRatingHandler</mas:PropertyHandler>
+ <rdfs:range rdf:resource="#TrustRating"/>
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentObjectProperty"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#trust_rating_agent -->
+
+ <owl:ObjectProperty rdf:about="#trust_rating_agent">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:comment
+ >Used by Used by jasdl.owl2mas.handler.TrustRatingHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#TrustRating"/>
+ <rdfs:range rdf:resource="&mas;Agent"/>
+ </owl:ObjectProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#userAgentObjectProperty -->
+
+ <owl:ObjectProperty rdf:about="&mas;userAgentObjectProperty"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Data properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#jasdl_useAnnotationGathering -->
+
+ <owl:DatatypeProperty rdf:about="#jasdl_useAnnotationGathering">
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentDataProperty"/>
+ <rdfs:range rdf:resource="&xsd;boolean"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#jasdl_useBeliefRevision -->
+
+ <owl:DatatypeProperty rdf:about="#jasdl_useBeliefRevision">
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentDataProperty"/>
+ <rdfs:range rdf:resource="&xsd;boolean"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#jasdl_useContraction -->
+
+ <owl:DatatypeProperty rdf:about="#jasdl_useContraction">
+ <rdfs:subPropertyOf rdf:resource="&mas;userAgentDataProperty"/>
+ <rdfs:range rdf:resource="&xsd;boolean"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#manual_mapping_alias -->
+
+ <owl:DatatypeProperty rdf:about="#manual_mapping_alias">
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.ManualMappingHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#ManualMapping"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#manual_mapping_fragment -->
+
+ <owl:DatatypeProperty rdf:about="#manual_mapping_fragment">
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.ManualMappingHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#ManualMapping"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_label -->
+
+ <owl:DatatypeProperty rdf:about="#ontology_label">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.OntologyHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#Ontology"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_uri -->
+
+ <owl:DatatypeProperty rdf:about="#ontology_uri">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.OntologyHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#Ontology"/>
+ <rdfs:range rdf:resource="&xsd;string"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#trust_rating_value -->
+
+ <owl:DatatypeProperty rdf:about="#trust_rating_value">
+ <rdfs:comment
+ >Used by jasdl.owl2mas.handler.TrustRatingHandler</rdfs:comment>
+ <rdfs:domain rdf:resource="#TrustRating"/>
+ <rdfs:range rdf:resource="&xsd;float"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasClassName -->
+
+ <owl:DatatypeProperty rdf:about="&mas;hasClassName"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#userAgentDataProperty -->
+
+ <owl:DatatypeProperty rdf:about="&mas;userAgentDataProperty"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Classes
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ManualMapping -->
+
+ <owl:Class rdf:about="#ManualMapping">
+ <rdfs:subClassOf rdf:resource="&owl;Thing"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#MappingStrategyClass -->
+
+ <owl:Class rdf:about="#MappingStrategyClass">
+ <rdfs:subClassOf rdf:resource="&mas;Class"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#Ontology -->
+
+ <owl:Class rdf:about="#Ontology">
+ <rdfs:subClassOf rdf:resource="&owl;Thing"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ReasonerClass -->
+
+ <owl:Class rdf:about="#ReasonerClass">
+ <rdfs:subClassOf rdf:resource="&mas;Class"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#TrustRating -->
+
+ <owl:Class rdf:about="#TrustRating">
+ <rdfs:subClassOf rdf:resource="&owl;Thing"/>
+ </owl:Class>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Agent -->
+
+ <owl:Class rdf:about="&mas;Agent"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#AgentArchClass -->
+
+ <owl:Class rdf:about="&mas;AgentArchClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#AgentClass -->
+
+ <owl:Class rdf:about="&mas;AgentClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#BeliefBaseClass -->
+
+ <owl:Class rdf:about="&mas;BeliefBaseClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Class -->
+
+ <owl:Class rdf:about="&mas;Class"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#EnvironmentClass -->
+
+ <owl:Class rdf:about="&mas;EnvironmentClass"/>
+
+
+
+ <!-- http://www.w3.org/2002/07/owl#Thing -->
+
+ <owl:Class rdf:about="&owl;Thing"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Individuals
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#DecapitaliseMappingStrategy -->
+
+ <MappingStrategyClass rdf:about="#DecapitaliseMappingStrategy">
+ <mas:hasClassName
+ >jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy</mas:hasClassName>
+ </MappingStrategyClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLAgArch -->
+
+ <mas:AgentArchClass rdf:about="#JASDLAgArch">
+ <mas:hasClassName
+ >jasdl.architecture.JASDLAgArch</mas:hasClassName>
+ </mas:AgentArchClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLAgent -->
+
+ <mas:AgentClass rdf:about="#JASDLAgent">
+ <mas:hasClassName
+ >jasdl.asSemantics.JASDLAgent</mas:hasClassName>
+ </mas:AgentClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLBeliefBase -->
+
+ <mas:BeliefBaseClass rdf:about="#JASDLBeliefBase">
+ <mas:hasClassName
+ >jasdl.bb.JASDLBeliefBase</mas:hasClassName>
+ </mas:BeliefBaseClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLEnvironment -->
+
+ <mas:EnvironmentClass rdf:about="#JASDLEnvironment">
+ <mas:hasClassName
+ >jasdl.env.JASDLEnvironment</mas:hasClassName>
+ </mas:EnvironmentClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#pellet -->
+
+ <ReasonerClass rdf:about="#pellet">
+ <mas:hasClassName
+ >org.mindswap.pellet.owlapi.Reasoner</mas:hasClassName>
+ </ReasonerClass>
+</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/JASDLParams.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -1,15 +1,20 @@
package jasdl;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.DecapitaliseMappingStrategy;
import jasdl.bridge.mapping.aliasing.MappingStrategy;
import jason.asSyntax.Atom;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
public class JASDLParams {
+ /**
+ * Namespace of the JASDL configuration ontology
+ */
+ public static String JASDL_OWL_NS = "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#";
+
public static float DEFAULT_TRUST_RATING = 0;
public static String JASDL_TG_CAUSE_RETAIN_ANNOTS = "JASDL_TG_CAUSE_RETAIN_ANNOTS";
Modified: trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/architecture/JASDLAgArch.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -20,9 +20,6 @@
package jasdl.architecture;
import jasdl.asSemantics.JASDLAgent;
-import jasdl.bridge.protocol.IncomingProtocolProcessingStrategy;
-import jasdl.bridge.protocol.OutgoingProtocolProcessingStrategy;
-import jasdl.bridge.protocol.ProtocolProcessingStrategy;
import jasdl.bridge.protocol.ProtocolProcessor;
import jasdl.util.exception.JASDLException;
import jason.JasonException;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -42,7 +42,6 @@
import jason.RevisionFailedException;
import jason.architecture.AgArch;
import jason.asSemantics.Intention;
-import jason.asSemantics.Option;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.Literal;
@@ -84,7 +83,7 @@
* @author Tom Klapiscak
*
*/
-public class JASDLAgent extends JmcaAgent {
+public class JASDLAgent extends JmcaAgent{
private JASDLOntologyManager jom;
@@ -102,9 +101,7 @@
// override plan library
- setPL(new JASDLPlanLibrary(this));
-
-
+ setPL(new JASDLPlanLibrary(this));
}
@@ -124,12 +121,17 @@
for(SEPlan se : ((JASDLPlanLibrary)getPL()).getSEPlans()){
getLogger().finest(se.getTrigger().toString());
}
+
+ //getTS().getC().addEventListener(new JASDLCircumstanceListener(this));
return ts;
}
+
+
+
@Override
public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException {
// TODO: what annotations should revision contractions contain? all! (or none? - same effect)
@@ -271,6 +273,8 @@
getJom().refreshReasoner();
}
+
+
/**
* *Must* be unique within society!
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -19,21 +19,18 @@
*/
package jasdl.bb;
-import jasdl.JASDLParams;
import jasdl.asSemantics.JASDLAgent;
import jasdl.bb.bebops.JASDLIncisionFunction;
import jasdl.bb.bebops.JASDLKernelsetFilter;
import jasdl.bb.bebops.JASDLReasonerFactory;
import jasdl.bridge.seliteral.SELiteral;
import jasdl.bridge.seliteral.SELiteralAllDifferentAssertion;
-import jasdl.bridge.seliteral.SELiteralClassAssertion;
import jasdl.util.exception.JASDLException;
import jasdl.util.exception.JASDLNotEnrichedException;
import jason.asSemantics.Agent;
import jason.asSemantics.Unifier;
import jason.asSyntax.Literal;
import jason.asSyntax.Term;
-import jason.asSyntax.VarTerm;
import jason.bb.BeliefBase;
import jason.bb.DefaultBeliefBase;
@@ -50,7 +47,6 @@
import org.semanticweb.owl.model.OWLAnnotation;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
-import org.semanticweb.owl.model.OWLClassAssertionAxiom;
import org.semanticweb.owl.model.OWLDifferentIndividualsAxiom;
import org.semanticweb.owl.model.OWLIndividual;
import org.semanticweb.owl.model.OWLIndividualAxiom;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLReasonerFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLReasonerFactory.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bb/bebops/JASDLReasonerFactory.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -19,7 +19,6 @@
*/
package jasdl.bb.bebops;
-import org.mindswap.pellet.PelletOptions;
import org.mindswap.pellet.owlapi.Reasoner;
import org.semanticweb.owl.inference.OWLReasoner;
import org.semanticweb.owl.model.OWLOntologyManager;
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/JASDLOntologyManager.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -32,7 +32,6 @@
import jasdl.bridge.mapping.aliasing.MappingStrategy;
import jasdl.bridge.mapping.label.LabelManager;
import jasdl.bridge.mapping.label.OntologyURIManager;
-import jasdl.util.JASDLCommon;
import jasdl.util.exception.JASDLDuplicateMappingException;
import jasdl.util.exception.JASDLException;
import jasdl.util.exception.JASDLInvalidSELiteralException;
@@ -120,7 +119,7 @@
private boolean annotationGatheringEnabled;
- public JASDLOntologyManager(Logger logger) {
+ public JASDLOntologyManager(Logger logger) throws OWLException{
this.logger = logger;
this.personalOntologyURI = URI.create("http://self.ontology/default.owl");
aliasManager = new AliasManager();
@@ -144,6 +143,7 @@
manchesterNsPrefixDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(getOntologyManager().getOWLDataFactory(), new NsPrefixOWLEntityChecker(this));
manchesterURIDescriptionParser = new ManchesterOWLSyntaxDescriptionParser(getOntologyManager().getOWLDataFactory(), new URIOWLEntityChecker(this));
+
}
/**
@@ -400,11 +400,13 @@
getReasoner().loadOntologies(imports);
getReasoner().classify();
} catch (OWLReasonerException e) {
- throw new JASDLException("Unable to load " + uri + ". Reason: " + e);
+ throw new JASDLException("Unable to load " + uri, e);
}
initOntology(ontology, label, uri, ontology.getURI(), false); // (successfully) loaded ontologies never personal
applyMappingStrategies(ontology, strategies);
getLogger().fine("Loaded ontology from " + uri + " and assigned label " + label);
+
+
return ontology;
} catch (OWLOntologyCreationException e) {
throw new JASDLException("Unable to load ontology", e);
@@ -596,15 +598,19 @@
refreshReasoner();
}
+
+ public void refreshReasoner() throws JASDLException{
+ refreshReasoner(getReasoner());
+ }
- public void refreshReasoner() throws JASDLException {
+ public void refreshReasoner(OWLReasoner refresh) throws JASDLException {
try {
- if (getReasoner() instanceof uk.ac.manchester.cs.factplusplus.owlapi.Reasoner) {
+ if (refresh instanceof uk.ac.manchester.cs.factplusplus.owlapi.Reasoner) {
((uk.ac.manchester.cs.factplusplus.owlapi.Reasoner) getReasoner()).classify();
- } else if (getReasoner() instanceof org.mindswap.pellet.owlapi.Reasoner) {
+ } else if (refresh instanceof org.mindswap.pellet.owlapi.Reasoner) {
((org.mindswap.pellet.owlapi.Reasoner) getReasoner()).refresh();
} else {
- getReasoner().classify();
+ refresh.classify();
}
} catch (OWLReasonerException e) {
throw new JASDLException("Unable to refresh reasoner. Reason: " + e);
@@ -638,14 +644,18 @@
* @return
* @throws JASDLException
*/
- public boolean areOntologiesConsistent() throws JASDLException {
- if (getReasoner() instanceof org.mindswap.pellet.owlapi.Reasoner) {
- return ((org.mindswap.pellet.owlapi.Reasoner) getReasoner()).isConsistent();
+ public boolean areOntologiesConsistent(OWLReasoner check) throws JASDLException {
+ if (check instanceof org.mindswap.pellet.owlapi.Reasoner) {
+ return ((org.mindswap.pellet.owlapi.Reasoner) check).isConsistent();
} else {
//TODO: FaCT++
throw new JASDLException("isBBConsistent not implemented for FaCT++ reasoner");
}
}
+
+ public boolean areOntologiesConsistent() throws JASDLException{
+ return areOntologiesConsistent(getReasoner());
+ }
public OWLDataFactory getOWLDataFactory() {
return getOntologyManager().getOWLDataFactory();
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/AxiomToSELiteralConverter.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -41,7 +41,6 @@
import java.util.logging.Logger;
import org.mindswap.pellet.owlapi.Reasoner;
-import org.semanticweb.owl.inference.OWLReasonerException;
import org.semanticweb.owl.model.AddAxiom;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLAxiomAnnotationAxiom;
@@ -54,8 +53,6 @@
import org.semanticweb.owl.model.OWLIndividualAxiom;
import org.semanticweb.owl.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owl.model.OWLOntology;
-import org.semanticweb.owl.model.OWLOntologyChangeException;
-import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLTypedConstant;
import org.semanticweb.owl.model.RemoveAxiom;
import org.semanticweb.owl.vocab.XSDVocabulary;
@@ -212,7 +209,9 @@
object = DefaultTerm.parse(constant.getLiteral().toString());
}
} else {
- throw new JASDLException("JASDL does not support untyped data ranges such as: " + axiom);
+ // Untyped, assume string to be on the safe side
+ object = DefaultTerm.parse("\"" + constant.getLiteral().toString() + "\"");
+ //throw new JASDLException("JASDL does not support untyped data ranges such as: " + axiom);
}
return jom.getSELiteralFactory().construct(alias, subject, object, getAnnots(alias, axiom));
}
Modified: trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java 2008-06-05 21:41:20 UTC (rev 1322)
+++ trunk/applications/jasdl-owlapi/src/jasdl/bridge/factory/SELiteralFactory.java 2008-06-05 22:04:11 UTC (rev 1323)
@@ -24,8 +24,8 @@
import jasdl.bridge.mapping.aliasing.Alias;
import jasdl.bridge.mapping.aliasing.AllDifferentPlaceholder;
import jasdl.bridge.seliteral.SELiteral;
+import jasdl.util.exception.JASDLException;
import jasdl.util.exception.JASDLInvalidSELiteralExc...
[truncated message content] |
|
From: <tom...@us...> - 2008-06-06 17:12:28
|
Revision: 1325
http://jason.svn.sourceforge.net/jason/?rev=1325&view=rev
Author: tomklapiscak
Date: 2008-06-06 10:12:25 -0700 (Fri, 06 Jun 2008)
Log Message:
-----------
Commerce case-study MAS now configured and instantiated via OWL2MAS using OWL ontologies alone.
Use run.sh from command line. JASON_HOME and OWL2MAS_HOME environment variables must be set to base-directory of Jason and OWL2MAS distributions respectively.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/commerce/.classpath
trunk/applications/jasdl-owlapi/examples/commerce/README
trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/env/CommerceEnvironment.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelDeliveryVanException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelMobileAgentException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/ModelShopException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/ui/customer/CustomerUIPanel.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/DefaultMappingStrategyClassHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/OntologyHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/ReasonerClassHandler.java
trunk/applications/jasdl-owlapi/src/jasdl/owl2mas/handler/TrustRatingHandler.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/examples/commerce/MAS.mas2j
trunk/applications/jasdl-owlapi/examples/commerce/run.sh
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/exception/AgentModelException.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceAgentModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CrateModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CustomerModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/DeliveryVanModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/EmbodiedAgentModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/MobileAgentModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/ModelCustomerListener.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/PAModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/Product.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/ShopModel.java
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/view/
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/view/CommerceView.java
Property Changed:
----------------
trunk/applications/jasdl-owlapi/examples/
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/
Property changes on: trunk/applications/jasdl-owlapi/examples
___________________________________________________________________
Name: svn:ignore
- testing
brf_test
commerce (copy)
commerce (another copy)
+ testing
brf_test
commerce (copy)
commerce (another copy)
ica
owls
Modified: trunk/applications/jasdl-owlapi/examples/commerce/.classpath
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/.classpath 2008-06-06 16:54:01 UTC (rev 1324)
+++ trunk/applications/jasdl-owlapi/examples/commerce/.classpath 2008-06-06 17:12:25 UTC (rev 1325)
@@ -13,5 +13,7 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="/jasdl-owlapi/lib/pellet/pellet.jar" sourcepath="/home/tom/workspace/pellet/src"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/owl2mas"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Added: trunk/applications/jasdl-owlapi/examples/commerce/MAS.mas2j
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/MAS.mas2j (rev 0)
+++ trunk/applications/jasdl-owlapi/examples/commerce/MAS.mas2j 2008-06-06 17:12:25 UTC (rev 1325)
@@ -0,0 +1,29 @@
+/*
+ Jason Project
+
+ -- created on June 06, 2008
+*/
+
+MAS soc {
+ infrastructure: Centralised
+
+ environment: commerce.env.CommerceEnvironment
+
+ agents:
+ a_greengrocers shop.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ delivery_van_4 delivery_van.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ a_supermarket shop.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ toms_pa pa.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ a_butchers shop.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ jims_pa pa.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ caz customer.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ cazs_pa pa.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ delivery_van_1 delivery_van.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ delivery_van_3 delivery_van.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ jim customer.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ tom customer.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+ delivery_van_2 delivery_van.asl [jasdl_s_uri="/onts/society.owl", jasdl_c_uri="/onts/commerce.owl", jasdl_ontologies="c,s", jasdl_useContraction="true"] agentArchClass jasdl.architecture.JASDLAgArch agentClass jasdl.asSemantics.JASDLAgent beliefBaseClass jasdl.bb.JASDLBeliefBase;
+
+ classpath: "../../lib/**/*.jar";
+ aslSourcePath: "src/asl";
+}
\ No newline at end of file
Modified: trunk/applications/jasdl-owlapi/examples/commerce/README
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/README 2008-06-06 16:54:01 UTC (rev 1324)
+++ trunk/applications/jasdl-owlapi/examples/commerce/README 2008-06-06 17:12:25 UTC (rev 1325)
@@ -51,3 +51,14 @@
society.owl - An ontology describing a society of agents and how they are related to one another
*******************************************************
+
+
+Some Notes:
+ - in the interests of simplicitly, all agents make use of the same label mappings for ontologies
+ and (automatic and manual) alias mappings for ontological entities.
+ These could be set arbitrarily for each agent (and the .asl code updated accordingly) and JASDL would
+ still function correctly.
+ - Although ontology URIs reference related local resources on the file system, they could equally reference (reachable) remote or local
+ resources (e.g. http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl). In fact, any valid URI can be used here.
+ - Since we make extensive use of inverse object properties, we enable the experimental "contraction" feature to ensure their removals
+ are properly handled.
Modified: trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-06-06 16:54:01 UTC (rev 1324)
+++ trunk/applications/jasdl-owlapi/examples/commerce/bin/build.xml 2008-06-06 17:12:25 UTC (rev 1325)
@@ -5,18 +5,18 @@
This file was generated by Jason 1.0.2
http://jason.sf.net
- April 25, 2008 - 00:06:35
+ June 06, 2008 - 17:38:11
-->
-<project name ="commerce"
+<project name ="soc"
basedir=".."
default="run">
- <property name="mas2j.project.file" value="commerce.mas2j"/>
+ <property name="mas2j.project.file" value="MAS.mas2j"/>
<property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
<property name="build.dir" value="${basedir}/bin/classes" />
- <property name="jasonJar" value="/home/tom/workspace/jason/lib/jason.jar"/>
+ <property name="jasonJar" value="/home/tom/workspace/jason/bin/../lib/jason.jar"/>
<path id="project.classpath">
<pathelement location="${basedir}"/>
@@ -73,10 +73,10 @@
<copy todir="${basedir}/${ant.project.name}-jws" failonerror="no">
<fileset dir="${basedir}/lib" includes="**/*.jar" />
<fileset dir="${basedir}" includes="${ant.project.name}.jar" />
- <fileset dir="/home/tom/workspace/jason/src/images" includes="Jason-GMoreau-Icon.jpg" />
+ <fileset dir="/home/tom/workspace/jason/bin/../src/images" includes="Jason-GMoreau-Icon.jpg" />
</copy>
<signjar jar="${basedir}/${ant.project.name}-jws/${ant.project.name}.jar" alias="jason"
- storepass="rbjhja" keypass="rbjhja" keystore="/home/tom/workspace/jason/src/jasonKeystore" />
+ storepass="rbjhja" keypass="rbjhja" keystore="/home/tom/workspace/jason/bin/../src/jasonKeystore" />
<echo message="**" />
<echo message="** Java Web Start application created in directory ${ant.project.name}-jws" />
<echo message="** Update the codebase (in the second line of the .jnlp file)" />
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-06-06 16:54:01 UTC (rev 1324)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-06-06 17:12:25 UTC (rev 1325)
@@ -14,13 +14,13 @@
<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#"
xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:commerce="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#"
xmlns:owl11="http://www.w3.org/2006/12/owl11#"
xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:commerce="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#">
+ xmlns:owl="http://www.w3.org/2002/07/owl#">
<owl:Ontology rdf:about="">
<rdfs:comment
>Individuals (i.e. brands of product) are not instantiated in this ontology schema (since product catalogue varies between shops and should not be shared information). Instead, they are instantiated by the CommerceModel class using SE-Percepts.</rdfs:comment>
@@ -41,15 +41,6 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#contains -->
-
- <owl:ObjectProperty rdf:about="#contains">
- <rdf:type rdf:resource="&owl;TransitiveProperty"/>
- <rdfs:domain rdf:resource="#Product"/>
- </owl:ObjectProperty>
-
-
-
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#hasBrand -->
<owl:ObjectProperty rdf:about="#hasBrand">
@@ -169,8 +160,6 @@
<owl:Class rdf:about="#Beef">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
- <owl:disjointWith rdf:resource="#Chicken"/>
- <owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -187,6 +176,7 @@
<owl:Class rdf:about="#Butter">
<rdfs:subClassOf rdf:resource="#Dairy"/>
+ <owl:disjointWith rdf:resource="#Cream"/>
</owl:Class>
@@ -195,6 +185,8 @@
<owl:Class rdf:about="#Chicken">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
+ <owl:disjointWith rdf:resource="#Beef"/>
+ <owl:disjointWith rdf:resource="#Fish"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -204,8 +196,6 @@
<owl:Class rdf:about="#Cream">
<rdfs:subClassOf rdf:resource="#Dairy"/>
- <owl:disjointWith rdf:resource="#Butter"/>
- <owl:disjointWith rdf:resource="#Milk"/>
</owl:Class>
@@ -223,7 +213,6 @@
<owl:Class rdf:about="#Fish">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
<owl:disjointWith rdf:resource="#Beef"/>
- <owl:disjointWith rdf:resource="#Chicken"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -249,6 +238,7 @@
<owl:Class rdf:about="#Lamb">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
+ <owl:disjointWith rdf:resource="#Beef"/>
</owl:Class>
@@ -257,7 +247,6 @@
<owl:Class rdf:about="#MeatProduct">
<rdfs:subClassOf rdf:resource="#Grocery"/>
- <owl:disjointWith rdf:resource="#Vegetable"/>
</owl:Class>
@@ -267,6 +256,7 @@
<owl:Class rdf:about="#Milk">
<rdfs:subClassOf rdf:resource="#Dairy"/>
<owl:disjointWith rdf:resource="#Butter"/>
+ <owl:disjointWith rdf:resource="#Cream"/>
</owl:Class>
@@ -310,6 +300,7 @@
<owl:Class rdf:about="#Vegetable">
<rdfs:subClassOf rdf:resource="#Grocery"/>
+ <owl:disjointWith rdf:resource="#MeatProduct"/>
</owl:Class>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-06-06 16:54:01 UTC (rev 1324)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-06-06 17:12:25 UTC (rev 1325)
@@ -3,31 +3,49 @@
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
- <!ENTITY owl11 "http://www.w3.org/2006/12/owl11#" >
+ <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
- <!ENTITY owl11xml "http://www.w3.org/2006/12/owl11-xml#" >
+ <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
- <!ENTITY society "http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#" >
+ <!ENTITY mas "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#" >
+ <!ENTITY jasdl "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#" >
+ <!ENTITY society "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#" >
]>
-<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#"
- xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl"
+<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#"
+ xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl"
+ xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
+ xmlns:mas="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#"
+ xmlns:jasdl="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:society="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#"
+ xmlns:owl2="http://www.w3.org/2006/12/owl2#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:owl11="http://www.w3.org/2006/12/owl11#"
- xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
- xmlns:society="http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <owl:Ontology rdf:about=""/>
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#">
+ <owl:Ontology rdf:about="">
+ <owl:imports rdf:resource="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl"/>
+ </owl:Ontology>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
+ // Annotation properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+ <owl:AnnotationProperty rdf:about="&mas;AgentClass"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
@@ -36,51 +54,77 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#employs -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#hasOntology -->
- <owl:ObjectProperty rdf:about="#employs">
- <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
- <rdfs:comment
- >Inverse of isEmployedBy. An agent can employ many other agents (but each agent may only be employed by one agent)</rdfs:comment>
- <rdfs:domain rdf:resource="#Agent"/>
- <rdfs:range rdf:resource="#Agent"/>
- </owl:ObjectProperty>
+ <owl:ObjectProperty rdf:about="&jasdl;hasOntology"/>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#isEmployedBy -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#environment -->
+ <owl:ObjectProperty rdf:about="&mas;environment"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasAgent -->
+
+ <owl:ObjectProperty rdf:about="&mas;hasAgent"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasAgentArchClass -->
+
+ <owl:ObjectProperty rdf:about="&mas;hasAgentArchClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasAgentClass -->
+
+ <owl:ObjectProperty rdf:about="&mas;hasAgentClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasBeliefBaseClass -->
+
+ <owl:ObjectProperty rdf:about="&mas;hasBeliefBaseClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#infrastructure -->
+
+ <owl:ObjectProperty rdf:about="&mas;infrastructure"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#employs -->
+
+ <owl:ObjectProperty rdf:about="#employs"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#isEmployedBy -->
+
<owl:ObjectProperty rdf:about="#isEmployedBy">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:comment
- >Inverse of isEmployedByemploys. Each agent may only be employed by one agent (but an agent can employ many other agents)</rdfs:comment>
- <rdfs:domain rdf:resource="#Agent"/>
- <rdfs:range rdf:resource="#Agent"/>
+ <rdfs:range rdf:resource="&mas;Agent"/>
+ <rdfs:domain rdf:resource="&mas;Agent"/>
<owl:inverseOf rdf:resource="#employs"/>
</owl:ObjectProperty>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#ownedBy -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#ownedBy -->
<owl:ObjectProperty rdf:about="#ownedBy">
- <rdf:type rdf:resource="&owl;FunctionalProperty"/>
- <rdfs:comment
- >An agent is owned by exactly one company. Inverse of owns</rdfs:comment>
- <rdfs:domain rdf:resource="#Agent"/>
- <rdfs:range rdf:resource="#Company"/>
+ <owl:inverseOf rdf:resource="#owns"/>
</owl:ObjectProperty>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#owns -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#owns -->
<owl:ObjectProperty rdf:about="#owns">
- <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
- <rdfs:comment
- >A company can own many agents. Inverse of ownedBy</rdfs:comment>
+ <rdfs:range rdf:resource="&mas;Agent"/>
<rdfs:domain rdf:resource="#Company"/>
- <owl:inverseOf rdf:resource="#ownedBy"/>
</owl:ObjectProperty>
@@ -88,6 +132,85 @@
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
+ // Data properties
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#jasdl_useContraction -->
+
+ <owl:DatatypeProperty rdf:about="&jasdl;jasdl_useContraction"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_label -->
+
+ <owl:DatatypeProperty rdf:about="&jasdl;ontology_label"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#ontology_uri -->
+
+ <owl:DatatypeProperty rdf:about="&jasdl;ontology_uri"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#agentModelDataProperty -->
+
+ <owl:DatatypeProperty rdf:about="&mas;agentModelDataProperty"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#aslSourcePath -->
+
+ <owl:DatatypeProperty rdf:about="&mas;aslSourcePath"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#classpath -->
+
+ <owl:DatatypeProperty rdf:about="&mas;classpath"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#filename -->
+
+ <owl:DatatypeProperty rdf:about="&mas;filename"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#hasClassName -->
+
+ <owl:DatatypeProperty rdf:about="&mas;hasClassName"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#x_position -->
+
+ <owl:DatatypeProperty rdf:about="#x_position">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:subPropertyOf rdf:resource="&mas;agentModelDataProperty"/>
+ <rdfs:range rdf:resource="&xsd;integer"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#y_position -->
+
+ <owl:DatatypeProperty rdf:about="#y_position">
+ <rdf:type rdf:resource="&owl;FunctionalProperty"/>
+ <rdfs:subPropertyOf rdf:resource="&mas;agentModelDataProperty"/>
+ <rdfs:range rdf:resource="&xsd;integer"/>
+ </owl:DatatypeProperty>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
@@ -96,23 +219,41 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Agent -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#Ontology -->
- <owl:Class rdf:about="#Agent">
- <rdfs:subClassOf rdf:resource="&owl;Thing"/>
- </owl:Class>
+ <owl:Class rdf:about="&jasdl;Ontology"/>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Butchers -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Agent -->
+ <owl:Class rdf:about="&mas;Agent"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#EnvironmentClass -->
+
+ <owl:Class rdf:about="&mas;EnvironmentClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#MAS -->
+
+ <owl:Class rdf:about="&mas;MAS"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#Butchers -->
+
<owl:Class rdf:about="#Butchers">
<rdfs:subClassOf rdf:resource="#Shop"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.ShopModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Company -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#Company -->
<owl:Class rdf:about="#Company">
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
@@ -120,56 +261,62 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Customer -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#Customer -->
<owl:Class rdf:about="#Customer">
- <rdfs:subClassOf rdf:resource="#Agent"/>
- <owl:disjointWith rdf:resource="#DeliveryVan"/>
- <owl:disjointWith rdf:resource="#PA"/>
+ <rdfs:subClassOf rdf:resource="&mas;Agent"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.CustomerModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#DeliveryVan -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#DeliveryVan -->
<owl:Class rdf:about="#DeliveryVan">
- <rdfs:subClassOf rdf:resource="#Agent"/>
+ <rdfs:subClassOf rdf:resource="&mas;Agent"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.DeliveryVanModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#GreenGrocers -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#GreenGrocers -->
<owl:Class rdf:about="#GreenGrocers">
<rdfs:subClassOf rdf:resource="#Shop"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.ShopModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#PA -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#PA -->
<owl:Class rdf:about="#PA">
- <rdfs:subClassOf rdf:resource="#Agent"/>
- <owl:disjointWith rdf:resource="#DeliveryVan"/>
+ <rdfs:subClassOf rdf:resource="&mas;Agent"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.PAModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Shop -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#Shop -->
<owl:Class rdf:about="#Shop">
- <rdfs:subClassOf rdf:resource="#Agent"/>
- <owl:disjointWith rdf:resource="#Customer"/>
- <owl:disjointWith rdf:resource="#DeliveryVan"/>
- <owl:disjointWith rdf:resource="#PA"/>
+ <rdfs:subClassOf rdf:resource="&mas;Agent"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.ShopModel</mas:AgentClass>
</owl:Class>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#Supermarket -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#Supermarket -->
<owl:Class rdf:about="#Supermarket">
<rdfs:subClassOf rdf:resource="#Shop"/>
+ <mas:AgentClass rdf:datatype="&xsd;string"
+ >commerce.model.ShopModel</mas:AgentClass>
</owl:Class>
@@ -191,106 +338,313 @@
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#customer1 -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLAgArch -->
- <Customer rdf:about="#customer1">
- <employs rdf:resource="#pa1"/>
- </Customer>
+ <rdf:Description rdf:about="&jasdl;JASDLAgArch"/>
- <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/society.owl#customer2 -->
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#JASDLAgent -->
- <Customer rdf:about="#customer2">
- <employs rdf:resource="#...
[truncated message content] |
|
From: <tom...@us...> - 2008-06-12 02:15:34
|
Revision: 1339
http://jason.svn.sourceforge.net/jason/?rev=1339&view=rev
Author: tomklapiscak
Date: 2008-06-11 19:15:26 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
jasdl_tg_cause annotation deprecated in favour of jasdl.ia.get_tg_cause(Trigger, RetainAnnots) internal action.
Tidied up and improved efficiency of DL based semi-revision.
Most specific SE-Plan precedence implemented using JMCA option selection module rather than in plan library. This is configured for commerce case-study using JMCA OWL2MAS extensions.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
trunk/applications/jasdl-owlapi/examples/commerce/run.sh
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
trunk/applications/jasdl-owlapi/lib/bebops.jar
trunk/applications/jasdl-owlapi/onts/jasdl.owl
trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/JASDLPlanLibrary.java
trunk/applications/jasdl-owlapi/src/jasdl/asSyntax/SEPlan.java
trunk/applications/jasdl-owlapi/src/jasdl/bb/JASDLBeliefBase.java
trunk/applications/jasdl-owlapi/src/jasdl/util/owlapi/IndividualAxiomToDescriptionConverter.java
Added Paths:
-----------
trunk/applications/jasdl-owlapi/src/jasdl/ia/get_tg_cause.java
trunk/applications/jasdl-owlapi/src/jasdl/jmca/
trunk/applications/jasdl-owlapi/src/jasdl/jmca/selection/
trunk/applications/jasdl-owlapi/src/jasdl/jmca/selection/MostSpecificOptionSelectionStrategy.java
Property Changed:
----------------
trunk/applications/jasdl-owlapi/examples/
trunk/applications/jasdl-owlapi/examples/commerce/src/asl/
Property changes on: trunk/applications/jasdl-owlapi/examples
___________________________________________________________________
Name: svn:ignore
- testing
brf_test
commerce (copy)
commerce (another copy)
ica
owls
+ testing
brf_test
commerce (copy)
commerce (another copy)
ica
owls
brf
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/commerce.owl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -3,9 +3,9 @@
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
- <!ENTITY owl11 "http://www.w3.org/2006/12/owl11#" >
+ <!ENTITY owl2 "http://www.w3.org/2006/12/owl2#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
- <!ENTITY owl11xml "http://www.w3.org/2006/12/owl11-xml#" >
+ <!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY commerce "http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#" >
@@ -14,10 +14,10 @@
<rdf:RDF xmlns="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#"
xml:base="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl"
+ xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
xmlns:commerce="http://www.dur.ac.uk/t.g.klapiscak/onts/commerce.owl#"
- xmlns:owl11="http://www.w3.org/2006/12/owl11#"
- xmlns:owl11xml="http://www.w3.org/2006/12/owl11-xml#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:owl2="http://www.w3.org/2006/12/owl2#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
@@ -160,6 +160,9 @@
<owl:Class rdf:about="#Beef">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
+ <owl:disjointWith rdf:resource="#Chicken"/>
+ <owl:disjointWith rdf:resource="#Fish"/>
+ <owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -177,6 +180,7 @@
<owl:Class rdf:about="#Butter">
<rdfs:subClassOf rdf:resource="#Dairy"/>
<owl:disjointWith rdf:resource="#Cream"/>
+ <owl:disjointWith rdf:resource="#Milk"/>
</owl:Class>
@@ -185,7 +189,6 @@
<owl:Class rdf:about="#Chicken">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
- <owl:disjointWith rdf:resource="#Beef"/>
<owl:disjointWith rdf:resource="#Fish"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -196,6 +199,7 @@
<owl:Class rdf:about="#Cream">
<rdfs:subClassOf rdf:resource="#Dairy"/>
+ <owl:disjointWith rdf:resource="#Milk"/>
</owl:Class>
@@ -212,7 +216,6 @@
<owl:Class rdf:about="#Fish">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
- <owl:disjointWith rdf:resource="#Beef"/>
<owl:disjointWith rdf:resource="#Lamb"/>
</owl:Class>
@@ -222,6 +225,7 @@
<owl:Class rdf:about="#GreenVegetable">
<rdfs:subClassOf rdf:resource="#Vegetable"/>
+ <owl:disjointWith rdf:resource="#RootVegetable"/>
</owl:Class>
@@ -238,7 +242,6 @@
<owl:Class rdf:about="#Lamb">
<rdfs:subClassOf rdf:resource="#MeatProduct"/>
- <owl:disjointWith rdf:resource="#Beef"/>
</owl:Class>
@@ -247,6 +250,7 @@
<owl:Class rdf:about="#MeatProduct">
<rdfs:subClassOf rdf:resource="#Grocery"/>
+ <owl:disjointWith rdf:resource="#Vegetable"/>
</owl:Class>
@@ -255,8 +259,6 @@
<owl:Class rdf:about="#Milk">
<rdfs:subClassOf rdf:resource="#Dairy"/>
- <owl:disjointWith rdf:resource="#Butter"/>
- <owl:disjointWith rdf:resource="#Cream"/>
</owl:Class>
@@ -291,7 +293,6 @@
<owl:Class rdf:about="#RootVegetable">
<rdfs:subClassOf rdf:resource="#Vegetable"/>
- <owl:disjointWith rdf:resource="#GreenVegetable"/>
</owl:Class>
@@ -300,7 +301,6 @@
<owl:Class rdf:about="#Vegetable">
<rdfs:subClassOf rdf:resource="#Grocery"/>
- <owl:disjointWith rdf:resource="#MeatProduct"/>
</owl:Class>
@@ -308,4 +308,23 @@
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
+
+
+
+ <!--
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //
+ // General axioms
+ //
+ ///////////////////////////////////////////////////////////////////////////////////////
+ -->
+
+ <rdf:Description>
+ <rdf:type rdf:resource="&owl2;AllDisjointClasses"/>
+ <owl2:members rdf:parseType="Collection">
+ <rdf:Description rdf:about="#Order"/>
+ <rdf:Description rdf:about="#Product"/>
+ <rdf:Description rdf:about="#Purchase"/>
+ </owl2:members>
+ </rdf:Description>
</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/onts/society.owl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -9,6 +9,7 @@
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY mas "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#" >
+ <!ENTITY jmca "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#" >
<!ENTITY jasdl "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#" >
<!ENTITY society "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#" >
]>
@@ -19,6 +20,7 @@
xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
xmlns:mas="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#"
xmlns:jasdl="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#"
+ xmlns:jmca="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:society="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#"
xmlns:owl2="http://www.w3.org/2006/12/owl2#"
@@ -60,6 +62,18 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#hasSelectionStrategyClass -->
+
+ <owl:ObjectProperty rdf:about="&jmca;hasSelectionStrategyClass"/>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#hasSelectionStrategyClassEntry -->
+
+ <owl:ObjectProperty rdf:about="&jmca;hasSelectionStrategyClassEntry"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#environment -->
<owl:ObjectProperty rdf:about="&mas;environment"/>
@@ -158,6 +172,12 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#hasPosition -->
+
+ <owl:DatatypeProperty rdf:about="&jmca;hasPosition"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#agentModelDataProperty -->
<owl:DatatypeProperty rdf:about="&mas;agentModelDataProperty"/>
@@ -225,6 +245,12 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#SelectionStrategyClassEntry -->
+
+ <owl:Class rdf:about="&jmca;SelectionStrategyClassEntry"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Agent -->
<owl:Class rdf:about="&mas;Agent"/>
@@ -362,6 +388,12 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#MostSpecificOptionSelectionStrategyClass -->
+
+ <rdf:Description rdf:about="&jasdl;MostSpecificOptionSelectionStrategyClass"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Centralised -->
<rdf:Description rdf:about="&mas;Centralised"/>
@@ -377,6 +409,15 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#MostSpecificOptionSelectionStrategyClassEntry -->
+
+ <jmca:SelectionStrategyClassEntry rdf:about="#MostSpecificOptionSelectionStrategyClassEntry">
+ <jmca:hasPosition rdf:datatype="&xsd;integer">1</jmca:hasPosition>
+ <jmca:hasSelectionStrategyClass rdf:resource="&jasdl;MostSpecificOptionSelectionStrategyClass"/>
+ </jmca:SelectionStrategyClassEntry>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/society.owl#a_butchers -->
<Butchers rdf:about="#a_butchers">
@@ -387,6 +428,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<employs rdf:resource="#delivery_van_2"/>
<jasdl:hasOntology rdf:resource="#society"/>
@@ -404,6 +446,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<employs rdf:resource="#delivery_van_3"/>
<jasdl:hasOntology rdf:resource="#society"/>
@@ -421,6 +464,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<employs rdf:resource="#delivery_van_1"/>
<employs rdf:resource="#delivery_van_4"/>
@@ -439,6 +483,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<employs rdf:resource="#cazs_pa"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
@@ -454,6 +499,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</PA>
@@ -481,6 +527,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</DeliveryVan>
@@ -498,6 +545,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</DeliveryVan>
@@ -515,6 +563,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</DeliveryVan>
@@ -532,6 +581,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</DeliveryVan>
@@ -548,6 +598,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<employs rdf:resource="#jims_pa"/>
<jasdl:hasOntology rdf:resource="#society"/>
@@ -563,6 +614,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</PA>
@@ -624,6 +676,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
<employs rdf:resource="#toms_pa"/>
@@ -639,6 +692,7 @@
<mas:hasAgentArchClass rdf:resource="&jasdl;JASDLAgArch"/>
<mas:hasAgentClass rdf:resource="&jasdl;JASDLAgent"/>
<mas:hasBeliefBaseClass rdf:resource="&jasdl;JASDLBeliefBase"/>
+ <jmca:hasSelectionStrategyClassEntry rdf:resource="#MostSpecificOptionSelectionStrategyClassEntry"/>
<jasdl:hasOntology rdf:resource="#commerce"/>
<jasdl:hasOntology rdf:resource="#society"/>
</PA>
Modified: trunk/applications/jasdl-owlapi/examples/commerce/run.sh
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/run.sh 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/run.sh 2008-06-12 02:15:26 UTC (rev 1339)
@@ -5,7 +5,7 @@
exit 0
fi
-export CLASSPATH=$CLASSPATH:$PWD/../../lib/jasdl.jar
+export CLASSPATH=$CLASSPATH:$PWD/../../lib/jasdl.jar:$PWD/../../../jmca/lib/jmca.jar
bash $OWL2MAS_HOME/owl2mas.sh . soc ./onts/society.owl false $1
Property changes on: trunk/applications/jasdl-owlapi/examples/commerce/src/asl
___________________________________________________________________
Name: svn:ignore
- sho222p.asl
+ sho222p.asl
dalt08examples.asl
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/common/commerce.asl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -46,7 +46,7 @@
purchase(ID)[o(c)]
<-
-hasProductDescription(ID, _)[o(c), source(_)];
- -includedIn(ID, _)[o(c), source(_)];
+ .abolish(includedIn(ID, _)[o(c), source(_)]);
-hasQuantity(ID, _)[o(c), source(_)];
-purchase(ID)[o(c), source(_)];
-hasShop(ID, _)[o(c), source(_)].
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/pa.asl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -51,8 +51,8 @@
// Ask for all brands that match these criteria
.send(Shop, askOne,
- productInStock(Brand)[o(self), id(ID), stockist(Stockist), jasdl_tg_cause(_)],
- productInStock(Brand)[o(self), id(ID), stockist(Stockist), jasdl_tg_cause(_)]);
+ productInStock(Brand)[o(self), id(ID), stockist(Stockist)],
+ productInStock(Brand)[o(self), id(ID), stockist(Stockist)]);
// ask for the customer's approval
!!approve(ID, Brand, ProductDescription, Shop, Qty, Order, Stockist).
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/asl/shop.asl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -59,7 +59,7 @@
* of whom it should submit the delivery request to.
*/
@found_product_for_PA
-+?product(Brand)[o(c), id(ID), stockist(Me), jasdl_tg_cause(OriginalQuery)] :
++?product(Brand)[o(c), id(ID), stockist(Me)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
OriginalQuery // the agent has found a suitable product within its belief base
<-
.print("Recieved request and is able to service it");
@@ -69,13 +69,13 @@
/** TODO: Match other, more specific, types of product and opportunistically present special offers to the PA
* i.e. "buy two get one free on all types of milk" using a plan such as:
*
- * +?milk(Brand)[o(c), id(ID), stockist(Me), jasdl_tg_cause(OriginalQuery)] :
+ * +?milk(Brand)[o(c), id(ID), stockist(Me)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
* OriginalQuery
* <-
* ...
*/
-+?milk(Brand)[o(c), id(ID), stockist(Me), jasdl_tg_cause(OriginalQuery)] :
++?milk(Brand)[o(c), id(ID), stockist(Me)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
OriginalQuery // the agent has found a suitable product within its belief base
<-
.print("Recieved request and is able to service it");
@@ -88,7 +88,7 @@
* since their are both more specific than owl:thing (which is the most general concept) - additionally, plan ordering
* is irrelevant here since JASDL automatically assigns precence according to concept specificity for trigger generalisation
*/
-+?thing(Brand)[o(owl), id(ID), stockist(_), jasdl_tg_cause(OriginalQuery)] :
++?thing(Brand)[o(owl), id(ID), stockist(_)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
not OriginalQuery // the agent has not found a suitable product within its belief base
<-
!reset(ID);
@@ -98,7 +98,7 @@
/**
* Requested a type of product that this agent cannot supply, try asking any other shop.
*/
-+?product(Brand)[o(c), id(ID), stockist(Stockist), jasdl_tg_cause(OriginalQuery)] :
++?product(Brand)[o(c), id(ID), stockist(Stockist)] : jasdl.ia.get_tg_cause(OriginalQuery, false) & .print(OriginalQuery) &
not OriginalQuery & // the agent has not found a suitable product within its belief base
possibleStockist(ID, "s:shop", Try)
<-
@@ -109,7 +109,7 @@
/**
* Requested a type of vegetable product that this agent cannot supply, try asking a greengrocer or a supermarket.
*/
-+?vegetable(Brand)[o(c), id(ID), stockist(Stockist), jasdl_tg_cause(OriginalQuery)] :
++?vegetable(Brand)[o(c), id(ID), stockist(Stockist)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
not OriginalQuery & // the agent has not found a suitable product within its belief base
possibleStockist(ID, "s:greenGrocers or s:supermarket", Try)
<-
@@ -120,7 +120,7 @@
/**
* Requested a type of meat product that this agent cannot supply, try asking a butchers.
*/
-+?meatProduct(Brand)[o(c), id(ID), stockist(Stockist), jasdl_tg_cause(OriginalQuery)] :
++?meatProduct(Brand)[o(c), id(ID), stockist(Stockist)] : jasdl.ia.get_tg_cause(OriginalQuery, false) &
not OriginalQuery & // the agent has not found a suitable product within its belief base
possibleStockist(ID, "s:butchers", Try)
<-
@@ -137,9 +137,8 @@
.print("Trying ", PossibleStockist);
.add_annot(Query, id(ID), Q1);
.add_annot(Q1, stockist(Stockist), Q2);
- .add_annot(Q2, jasdl_tg_cause(_), Q3);
- .send(PossibleStockist, askOne, Q3, Q3);
- jasdl.ia.get_individual(Q3, Answer).
+ .send(PossibleStockist, askOne, Q2, Q2);
+ jasdl.ia.get_individual(Q2, Answer).
/**
Modified: trunk/applications/jasdl-owlapi/lib/bebops.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jasdl-owlapi/onts/jasdl.owl
===================================================================
--- trunk/applications/jasdl-owlapi/onts/jasdl.owl 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/onts/jasdl.owl 2008-06-12 02:15:26 UTC (rev 1339)
@@ -9,6 +9,7 @@
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY mas "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#" >
+ <!ENTITY jmca "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#" >
<!ENTITY jasdl "http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#" >
]>
@@ -18,12 +19,14 @@
xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
xmlns:mas="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#"
xmlns:jasdl="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#"
+ xmlns:jmca="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:owl2="http://www.w3.org/2006/12/owl2#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
<owl:Ontology rdf:about="">
+ <owl:imports rdf:resource="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl"/>
<owl:imports rdf:resource="http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl"/>
</owl:Ontology>
@@ -126,6 +129,12 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#hasAspect -->
+
+ <owl:ObjectProperty rdf:about="&jmca;hasAspect"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#userAgentObjectProperty -->
<owl:ObjectProperty rdf:about="&mas;userAgentObjectProperty"/>
@@ -290,6 +299,12 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#SelectionStrategyClass -->
+
+ <owl:Class rdf:about="&jmca;SelectionStrategyClass"/>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/mas.owl#Agent -->
<owl:Class rdf:about="&mas;Agent"/>
@@ -388,10 +403,26 @@
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#MostSpecificOptionSelectionStrategyClass -->
+
+ <jmca:SelectionStrategyClass rdf:about="#MostSpecificOptionSelectionStrategyClass">
+ <mas:hasClassName rdf:datatype="&xsd;string"
+ >jasdl.jmca.selection.MostSpecificOptionSelectionStrategy</mas:hasClassName>
+ <jmca:hasAspect rdf:resource="&jmca;Option"/>
+ </jmca:SelectionStrategyClass>
+
+
+
<!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jasdl.owl#pellet -->
<ReasonerClass rdf:about="#pellet">
<mas:hasClassName
>org.mindswap.pellet.owlapi.Reasoner</mas:hasClassName>
</ReasonerClass>
+
+
+
+ <!-- http://www.dur.ac.uk/t.g.klapiscak/onts/owl2mas/jmca.owl#Option -->
+
+ <rdf:Description rdf:about="&jmca;Option"/>
</rdf:RDF>
Modified: trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java
===================================================================
--- trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java 2008-06-12 02:04:57 UTC (rev 1338)
+++ trunk/applications/jasdl-owlapi/src/jasdl/asSemantics/JASDLAgent.java 2008-06-12 02:15:26 UTC (rev 1339)
@@ -25,7 +25,6 @@
import jasdl.asSyntax.SEPlan;
import jasdl.bb.JASDLBeliefBase;
import jasdl.bb.bebops.JASDLIncisionFunction;
-import jasdl.bb.bebops.JASDLKernelsetFilter;
import jasdl.bb.bebops.JASDLReasonerFactory;
import jasdl.bridge.JASDLOntologyManager;
import jasdl.bridge.factory.AxiomToSELiteralConverter;
@@ -38,37 +37,34 @@
import jasdl.bridge.seliteral.SELiteral;
import jasdl.util.exception.JASDLException;
import jasdl.util.exception.JASDLNotEnrichedException;
+import jasdl.util.owlapi.IndividualAxiomToDescriptionConverter;
import jason.JasonException;
import jason.RevisionFailedException;
import jason.architecture.AgArch;
import jason.asSemantics.Intention;
import jason.asSemantics.TransitionSystem;
-import jason.asSemantics.Unifier;
import jason.asSyntax.Literal;
import jason.bb.BeliefBase;
import jason.runtime.Settings;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import jmca.asSemantics.JmcaAgent;
-import org.mindswap.pellet.owlapi.Reasoner;
+import org.semanticweb.owl.apibinding.OWLManager;
import org.semanticweb.owl.inference.OWLReasoner;
-import org.semanticweb.owl.model.AddAxiom;
import org.semanticweb.owl.model.OWLAxiom;
import org.semanticweb.owl.model.OWLDataFactory;
import org.semanticweb.owl.model.OWLDescription;
-import org.semanticweb.owl.model.OWLOntology;
+import org.semanticweb.owl.model.OWLIndividualAxiom;
import org.semanticweb.owl.model.OWLOntologyManager;
import org.semanticweb.owl.model.RemoveAxiom;
-import bebops.semirevision.BeliefBaseSemiRevisor;
-import bebops.util.exception.BebopsRevisionFailedException;
+import bebops.common.TBoxAxiomKernelsetFilter;
-import com.clarkparsia.explanation.SatisfiabilityConverter;
+import com.clarkparsia.explanation.BlackBoxExplanation;
/**
* JASDL's extension to JMCA agent (and hence the default Jason agent).
@@ -122,155 +118,102 @@
getLogger().finest(se.getTrigger().toString());
}
- //getTS().getC().addEventListener(new JASDLCircumstanceListener(this));
return ts;
}
+
-
-
-
@Override
public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException {
- // TODO: what annotations should revision contractions contain? all! (or none? - same effect)
-
- // No! the same. -a[x] only undermines assertions leading to a[x]!
- // if we are performing belief-revision all annotations will be gathered (shortcut - use none?) ensuring axiom will be obliterated
- // annotations never solely lead to conflicts.
-
- if (!config.isBeliefRevisionEnabled()) { // if experimental feature is disabled
+
+ // if experimental feature is disabled or we are only removing (in which case brf need not be applied - OWL-DL is monotonic)
+ if (!config.isBeliefRevisionEnabled() || beliefToDel != null) {
return super.brf(beliefToAdd, beliefToDel, i);
- }
-
- List<Literal> addList = new Vector<Literal>();
- List<Literal> removeList = new Vector<Literal>();
-
- // NO LONGER APPLICABLE: For efficiency reasons: no need to check beliefs to be contracted if established by BB revisor (since they are implicitly grounded)
-
- // just accept beliefToDel. Assumption: Deletions never lead to inconsistencies?!
- if (beliefToDel != null) {
- getLogger().finest("Revise: -" + beliefToDel);
- removeList.add(beliefToDel);
- } else if (beliefToAdd != null) {
- if (config.isBeliefRevisionEnabled()) {
- try {
- getLogger().fine("Revise: +" + beliefToAdd);
- SELiteral sl = getSELiteralFactory().construct(beliefToAdd);
- if (JASDLParams.USE_BEBOPS_BELIEF_REVISION) {
- applyBebopsBeliefRevision(sl);
- } else {
- applyPelletOnlyBeliefRevision(sl);
- }
- // *** this point is only reached if the addition is accepted ***
- addList.add(beli...
[truncated message content] |