def get_agent_info(type_agn, directory_agent, sender, msgcnt):
    gmess = Graph()
    # Construimos el mensaje de registro
    gmess.bind('foaf', FOAF)
    gmess.bind('dso', DSO)
    ask_obj = agn[sender.name + '-Search']
    gmess.add((ask_obj, RDF.type, DSO.Search))
    gmess.add((ask_obj, DSO.AgentType, type_agn))

    # b_message =  build_message(gmess, perf=ACL.request, sender=sender.uri,receiver=directory_agent.uri, msgcnt=msgcnt,content=ask_obj)
    # print("mensaje contruido")

    gr = send_message(
        build_message(gmess,
                      perf=ACL.request,
                      sender=sender.uri,
                      receiver=directory_agent.uri,
                      msgcnt=msgcnt,
                      content=ask_obj), directory_agent.address)
    dic = get_message_properties(gr)
    content = dic['content']

    address = gr.value(subject=content, predicate=DSO.Address)
    url = gr.value(subject=content, predicate=DSO.Uri)
    name = gr.value(subject=content, predicate=FOAF.name)
    return Agent(name, url, address, None)
Beispiel #2
0
def get_agents_info(tipo, directory_agent, sender, msgcnt):
    gmess = Graph()
    # Construimos el mensaje de registro
    gmess.bind('foaf', FOAF)
    gmess.bind('dso', DSO)
    ask_obj = agn[sender.name + '-Search']

    gmess.add((ask_obj, RDF.type, DSO.Search))
    gmess.add((ask_obj, DSO.AgentType, tipo))
    gr = send_message(
        build_message(gmess,
                      perf=ACL.request,
                      sender=sender.uri,
                      receiver=directory_agent.uri,
                      msgcnt=msgcnt,
                      content=ask_obj), directory_agent.address)
    dic = get_message_properties(gr)
    content = dic['content']

    agn_uris = gr.objects(subject=content, predicate=FOAF.Agent)
    agentes = []
    for agn_uri in agn_uris:
        address = gr.value(subject=agn_uri, predicate=DSO.Address)
        url = gr.value(subject=agn_uri, predicate=DSO.Uri)
        name = gr.value(subject=agn_uri, predicate=FOAF.name)
        agentes.append(Agent(name, url, address, None))

    return agentes
Beispiel #3
0
def get_bag_agent_info(type_, directory_agent, sender, msgcnt):
    gmess = Graph()
    # Construimos el mensaje de registro
    gmess.bind('foaf', FOAF)
    gmess.bind('dso', DSO)
    ask_obj = agn[sender.name + '-Search']

    gmess.add((ask_obj, RDF.type, DSO.Search))
    gmess.add((ask_obj, DSO.AgentType, type_))
    gr = send_message(
        build_message(gmess,
                      perf=ACL.request,
                      sender=sender.uri,
                      receiver=directory_agent.uri,
                      msgcnt=msgcnt,
                      content=ask_obj), directory_agent.address)
    dic = get_message_properties(gr)
    content = dic['content']
    agents = []
    for (s, p, o) in gr.triples((content, None, None)):
        if str(p).startswith('http://www.w3.org/1999/02/22-rdf-syntax-ns#_'):
            address = gr.value(subject=o, predicate=DSO.Address)
            url = gr.value(subject=o, predicate=DSO.Uri)
            name = gr.value(subject=o, predicate=FOAF.name)
            agent = Agent(name, url, address, None)
            agents += [agent]

    return agents
def get_Neareast_Logistic_Center_info(type_agn, directory_agent, sender,
                                      msgcnt, cp):
    """Funcion que retorna el agente logistico mas cercano"""
    gmess = Graph()
    # Construimos el mensaje de registro
    gmess.bind('foaf', FOAF)
    gmess.bind('dso', DSO)
    ask_obj = agn[sender.name + '-Search']
    print("---paso 1 ---")

    gmess.add((ask_obj, RDF.type, DSO.Search))
    gmess.add((ask_obj, DSO.AgentType, type_agn))
    gmess.add((ask_obj, ECSDIAmazon.Codigo_postal, Literal(cp,
                                                           datatype=XSD.int)))
    print("---paso 2 ---")
    print(type_agn)
    print(directory_agent)
    print(sender.name, " ", sender.uri)
    print(msgcnt)

    gr = send_message(
        build_message(gmess,
                      perf=ACL.request,
                      sender=sender.uri,
                      receiver=directory_agent.uri,
                      msgcnt=msgcnt,
                      content=ask_obj), directory_agent.address)
    print("---paso 3 ---")
    dic = get_message_properties(gr)
    content = dic['content']

    address = gr.value(subject=content, predicate=DSO.Address)
    url = gr.value(subject=content, predicate=DSO.Uri)
    name = gr.value(subject=content, predicate=FOAF.name)
    print("----------------------------------------")
    print(name)
    print(url)
    print(address)

    return Agent(name, url, address, None)
Beispiel #5
0
def directory_search_agent(tipoDSO, origen,agenteDirectorio, mss_cnt):
    """
    Busca en el servicio de registro mandando un
    mensaje de request con una accion Search del servicio de directorio
    
    """

    gmess = Graph()

    gmess.bind('foaf', FOAF)
    gmess.bind('dso', DSO)
    reg_obj = agn[origen.name + '-search'] #nombre del graph -> AgenteCliente-search
    gmess.add((reg_obj, RDF.type, DSO.Search))  #añadimos el tipo de RDF-> Serach
    gmess.add((reg_obj, DSO.AgentType, tipoDSO)) #añadimos el tipo de agente que estamos pidiendo es el parm de la funcion (DSO.AgenteMostrarProductos)
    mss_cnt += 1
    msg = build_message(gmess, perf=ACL.request,
                        sender=origen.uri,
                        receiver=agenteDirectorio.uri,
                        content=reg_obj,
                        msgcnt=mss_cnt)
    gr = send_message(msg, agenteDirectorio.address)
    
    # Obtenemos la direccion del agente de la respuesta
    # No hacemos ninguna comprobacion sobre si es un mensaje valido
    #msg = gr.value(predicate=RDF.type, object=ACL.FipaAclMessage) #Obtenemos el mensaje fipa 
    #content = gr.value(subject=msg, predicate=ACL.content) #Obtenemos el contenido del mensaje fipa
    sj_agentes = gr.triples((None,RDF.type, DSO.Response)) #Obtenemos la adress del contenido
    agentArray = []
    for agenteTuple in sj_agentes:
        agn_uri = agenteTuple[0]
        ragn_addr = gr.value(subject=agn_uri, predicate=DSO.Address) #Obtenemos la adress del contenido
        ragn_uri = gr.value(subject=agn_uri, predicate=DSO.Uri) #Obtenemos la uri del contenido
        name = gr.value(subject=agn_uri, predicate=FOAF.name) #Obtenemos el nombre del agente del contenido
        agente = Agent(name,ragn_uri,ragn_addr,None)
        agentArray.append(agente)
    return agentArray
Beispiel #6
0
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost

# Flask stuff
app = Flask(__name__)

# Configuration constants and variables
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente
InfoAgent = Agent('AgenteInfo1', agn.AgenteInfo,
                  'http://%s:%d/comm' % (hostname, port),
                  'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

# Cola de comunicacion entre procesos
cola1 = Queue()


def register_message():
logger = config_logger(level=1)

# Configuration stuff
hostname = socket.gethostname()
port = 9021

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteDevoluciones = Agent('AgenteDevoluciones',
                       agn.AgenteDevoluciones,
                       'http://%s:%d/comm' % (hostname, port),
                       'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
AgenteDirectorio = Agent('AgenteDirectorio',
                         agn.Directorio,
                         'http://%s:9000/Register' % hostname,
                         'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #8
0
    # dhostname = socket.gethostname()
if args.dhost is None:
    dhostname = "localhost"
else:
    dhostname = args.dhost


agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteAlmacen = Agent('AgenteAlmacen',
                       agn.AgenteAlmacen,
                       'http://%s:%d/comm' % (hostname, port),
                       'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent',
                       agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)


# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
Beispiel #9
0
else:
    hostaddr = hostname = socket.gethostname()

if args.dport is None:
    dport = 9000
else:
    dport = args.dport

if args.dhost is None:
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost

# Datos del Agente
TravelServiceAgent = Agent('ActivitiesAgent', agn.TravelServiceAgent,
                           'http://%s:%d/comm' % (hostaddr, port),
                           'http://%s:%d/stop' % (hostaddr, port))

# Directory agent address
DirectoryService = Agent('DirectoryService', agn.DirectoryService,
                         'http://%s:%d/register' % (dhostname, dport),
                         'http://%s:%d/stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

# Cola de comunicacion entre procesos
cola1 = Queue()


def obscure(dir):
port = 9012

logger = config_logger(level=1)

agn = Namespace("http://www.agentes.org#")

# Peso del lote
peso_lote = 0.0

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteCentroLogistico = Agent('AgenteCentroLogistico',
                              agn.AgenteCentroLogistico,
                              'http://%s:%d/comm' % (hostname, port),
                              'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
AgenteDirectorio = Agent('AgenteDirectorio', agn.Directorio,
                         'http://%s:9000/Register' % hostname,
                         'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
        dport = args.dport

    if args.dhost is None:
        dhostname = socket.gethostname()
    else:
        dhostname = args.dhost

    # Configuration constants and variables
    agn = Namespace("http://www.agentes.org#")

    # Contador de mensajes
    mss_cnt = 0

    # Datos del Agente
    AgentePersonal = Agent('AgentePersonal', agn.AgentePersonal,
                           'http://%s:%d/comm' % (hostname, port),
                           'http://%s:%d/Stop' % (hostname, port))

    # Directory agent address
    DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                           'http://%s:%d/Register' % (dhostname, dport),
                           'http://%s:%d/Stop' % (dhostname, dport))

    # Global dsgraph triplestore
    dsgraph = Graph()

    # Ponemos en marcha los behaviors
    ab1 = Process(target=agentbehavior1)
    ab1.start()

    # Ponemos en marcha el servidor
Beispiel #12
0
    hostaddr = hostname = socket.gethostname()

schedule = args.schedule

# Directory Service Graph
dsgraph = Graph()
# Vinculamos todos los espacios de nombre a utilizar
dsgraph.bind('acl', ACL)
dsgraph.bind('rdf', RDF)
dsgraph.bind('rdfs', RDFS)
dsgraph.bind('foaf', FOAF)
dsgraph.bind('dso', DSO)

agn = Namespace("http://www.agentes.org#")
DirectoryService = Agent('ServiceAgent',
                         agn.DirectoryService,
                         'http://%s:%d/register' % (hostaddr, port),
                         'http://%s:%d/stop' % (hostaddr, port))


def obscure(dir):
    """
    Hide real hostnames
    """
    odir = {}
    for d in dir:
        _,_,port = dir[d][1].split(':')
        odir[d] = (dir[d][0], f'{uuid4()}:{port}', dir[d][2])

    return odir

Beispiel #13
0
# Configuration stuff
hostname = socket.gethostname()
port = 9010

logger = config_logger(level=1)

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteExternoTransportista = Agent('AgenteExternoTransportista',
                                   agn.AgenteExternoTransportista,
                                   'http://%s:%d/comm' % (hostname, port),
                                   'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
AgenteDirectorio = Agent('AgenteDirectorio', agn.Directory,
                         'http://%s:9000/Register' % hostname,
                         'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #14
0

# Configuration stuff
hostname = socket.gethostname()
port = 9011
logger = config_logger(level=1)

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteCompras = Agent('AgenteCompras',
                       agn.AgenteCompras,
                       'http://%s:%d/comm' % (hostname, port),
                       'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
AgenteDirectorio = Agent('AgenteDirectorio',
                       agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)


# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
if args.dhost is None:
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost
    # Agent Namespace

agn = Namespace("http://www.agentes.org#")

# Message Count
mss_cnt = 0

# Data Agent
# Datos del Agente
AgenteObtenedorActividades = Agent('AgenteObtenedorDeOfertasDeActividades',
                                   agn.AgenteObtenedorActividades,
                                   'http://%s:%d/comm' % (hostname, port),
                                   'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent',
                       agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global triplestore graph
dsGraph = Graph()

# Queue
queue = Queue()

# Flask app
# Configuration stuff
hostname = '127.0.1.1'
port = 9009

agn = Namespace(Constants.ONTOLOGY)

# Contador de mensajes
mss_cnt = 0

#Operaciones bancarias
operaciones = []

# Datos del Agente

AgenteExtEntidadBancaria = Agent('AgenteExtEntidadBancaria',
                                 agn.AgenteExtEntidadBancaria,
                                 'http://%s:%d/comm' % (hostname, port),
                                 'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #17
0
if args.open is None:
    hostname = '0.0.0.0'
else:
    hostname = socket.gethostname()

logger = config_logger(level=1)

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteExternoTiendaExterna = Agent('AgenteExternoTiendaExterna',
                                   agn.AgenteExternoTiendaExterna,
                                   'http://%s:%d/comm' % (hostname, port),
                                   'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
AgenteDirectorio = Agent('AgenteDirectorio', agn.AgenteDirectorio,
                         'http://%s:9000/Register' % hostname,
                         'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__, template_folder='../templates')
Beispiel #18
0
    # dhostname = socket.gethostname()
if args.dhost is None:
    dhostname = "localhost"
else:
    dhostname = args.dhost

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteVentaProductos = Agent('AgenteVentaProductos', agn.AgenteVentaProductos,
                             'http://%s:%d/comm' % (hostname, port),
                             'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #19
0
    dport = args.dport

if args.dhost is None:
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost
    # Agent Namespace
    agn = Namespace("http://www.agentes.org#")

    # Message Count
    mss_cnt = 0

    # Data Agent
    # Datos del Agente
    AgentePlanificador = Agent('AgentePlanificador', agn.AgentePlanificador,
                               'http://%s:%d/comm' % (hostname, port),
                               'http://%s:%d/Stop' % (hostname, port))

    # Directory agent address
    DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                           'http://%s:%d/Register' % (dhostname, dport),
                           'http://%s:%d/Stop' % (dhostname, dport))

    # Global triplestore graph
    dsGraph = Graph()

    # Queue
    queue = Queue()

    # Flask app
    app = Flask(__name__)
Beispiel #20
0
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost

# Flask stuff
app = Flask(__name__, template_folder='../templates')

# Configuration constants and variables
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente
AgentTransportista = Agent('AgentTransportista', agn.AgentTransportista,
                           'http://%s:%d/comm' % (hostname, port),
                           'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

#Carrito de la compra
carrito_compra = []


def get_count():
Beispiel #21
0
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost

# Flask stuff
app = Flask(__name__)

# Configuration constants and variables
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente
AgenteDevoluciones = Agent('AgenteDevoluciones', agn.AgenteDevoluciones,
                           'http://%s:%d/comm' % (hostname, port),
                           'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

# Cola de comunicacion entre procesos
cola1 = Queue()

# Productos
products = Graph()
Beispiel #22
0
    dhostname = socket.gethostname()
else:
    dhostname = args.dhost

# Flask stuff
app = Flask(__name__, template_folder='../templates')

# Configuration constants and variables
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente
AgentCentroLogistico = Agent('AgentCentroLogistico', agn.AgentCentroLogistico,
                             'http://%s:%d/comm' % (hostname, port),
                             'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

lote = []
compras_sin_asignar = []
compras_asignadas = []

Beispiel #23
0
else:
    hostname = socket.gethostname()

# Directory Service Graph
dsgraph = Graph()

# Vinculamos todos los espacios de nombre a utilizar
dsgraph.bind('acl', ACL)
dsgraph.bind('rdf', RDF)
dsgraph.bind('rdfs', RDFS)
dsgraph.bind('foaf', FOAF)
dsgraph.bind('dso', DSO)

agn = Namespace("http://www.agentes.org#")
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (hostname, port),
                       'http://%s:%d/Stop' % (hostname, port))
app = Flask(__name__)
mss_cnt = 0

cola1 = Queue()  # Cola de comunicacion entre procesos
directory = {}


@app.route("/Register")
def register():
    """
    Entry point del agente que recibe los mensajes de registro
    La respuesta es enviada al retornar la funcion,
    no hay necesidad de enviar el mensaje explicitamente
Beispiel #24
0
    hostaddr = hostname = socket.gethostname()

if args.dhost is None:
    dhostname = gethostname()
else:
    dhostname = args.dhost

# Configuration constants and variables
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente
Solver = Agent('SolverAgent', agn.Solver,
               'http://%s:%d/comm' % (hostaddr, port),
               'http://%s:%d/stop' % (hostaddr, port))

# Directory agent address
DirectoryService = Agent('ServiceAgent', agn.DirectoryService,
                         'http://%s:%d/register' % (dhostname, dport),
                         'http://%s:%d/stop' % (dhostname, dport))

# Global dsgraph triplestore
dsgraph = Graph()

# Cola de comunicacion entre procesos
cola1 = Queue()

app = Flask(__name__)
Beispiel #25
0
__author__ = 'javier'

# Configuration stuff
hostname = socket.gethostname()
port = 9010

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgentePersonal = Agent('AgenteSimple', agn.AgenteSimple,
                       'http://%s:%d/comm' % (hostname, port),
                       'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #26
0





# Agent Namespace
agn = Namespace("http://www.agentes.org#")

# Message Count
mss_cnt = 0

# Data Agent
# Datos del Agente
AgenteObtenedorAlojamiento = Agent('AgenteObtenedorDeOfertasDeAlojamiento',
                    agn.AgenteObtenedorAlojamiento,
                    'http://%s:%d/comm' % (hostname, port),
                    'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent',
                       agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global triplestore graph
dsGraph = Graph()

# Queue
queue = Queue()

app = Flask(__name__)
Beispiel #27
0
    # dhostname = socket.gethostname()
if args.dhost is None:
    dhostname = "localhost"
else:
    dhostname = args.dhost

agn = Namespace("http://www.agentes.org#")

# Contador de mensajes
mss_cnt = 0

# Datos del Agente

AgenteLogistico = Agent('AgenteLogistico', agn.AgenteLogistico,
                        'http://%s:%d/comm' % (hostname, port),
                        'http://%s:%d/Stop' % (hostname, port))

# Directory agent address
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:9000/Register' % hostname,
                       'http://%s:9000/Stop' % hostname)

# Global triplestore graph
dsgraph = Graph()

cola1 = Queue()

# Flask stuff
app = Flask(__name__)
Beispiel #28
0
EVALUADOR_HOSTNAME = '10.10.53.130'
VENDEDOR_HOSTNAME = '10.10.53.131'
CENTROLOG_HOSTNAME = '10.10.53.132'
TRANSPORTISTA_HOSTNAME = '10.10.53.130'
TRANSPORTISTA2_HOSTNAME = '10.10.53.131'
REPRESENTANTE_HOSTNAME = '10.10.53.132'

NUM_TRANSPORTISTAS = 2

hostname = socket.gethostname()
endpoint_read = 'http://10.10.53.130:9123/myDB/query'
endpoint_update = 'http://10.10.53.130:9123/myDB/update'

AgenteEvaluador = Agent(
    'AgenteEvaluador', AB.AgentEvaluador,
    'http://%s:%d/comm' % (EVALUADOR_HOSTNAME, EVALUADOR_PORT),
    'http://%s:%d/Stop' % (EVALUADOR_HOSTNAME, EVALUADOR_PORT))

AgenteVendedor = Agent(
    'AgenteVendedor', AB.AgenteVendedor,
    'http://%s:%d/comm' % (VENDEDOR_HOSTNAME, VENDEDOR_PORT),
    'http://%s:%d/Stop' % (VENDEDOR_HOSTNAME, VENDEDOR_PORT))

AgenteCentroLogistico = Agent(
    'AgenteCentroLogistico', AB.AgenteCentroLogistico,
    'http://%s:%d/comm' % (CENTROLOG_HOSTNAME, CENTROLOG_PORT),
    'http://%s:%d/Stop' % (CENTROLOG_HOSTNAME, CENTROLOG_PORT))

AgenteTransportista = Agent(
    'SEUR', AB.AgenteTransportista,
    'http://%s:%d/comm' % (TRANSPORTISTA_HOSTNAME, TRANSPORTISTA_PORT),
    dport = args.dport

if args.dhost is None:
    dhostname = '127.0.0.1'
else:
    dhostname = args.dhost

#definimos un espacio de nombre
agn = Namespace("http://www.agentes.org#")

# Contador de mensajes, por si queremos hacer un seguimiento
mss_cnt = 0

#crear agente
AgenteGestorDeProductos = Agent('AgenteGestorDeProductos',
                                agn.AgenteGestorDeProductos,
                                'http://%s:%d/comm' % (hostname, port),
                                'http://%s:%d/Stop' % (hostname, port))

# direccion del agente directorio
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

# Global triplestore graph
dsGraph = Graph()
# Queue
queue = Queue()
#crear aplicacion servidor
app = Flask(__name__)

Beispiel #30
0
if args.dhost is None:
    dhostname = '127.0.0.1'
else:
    dhostname = args.dhost

#definimos un espacio de nombre
agn = Namespace("http://www.agentes.org#")

queue = Queue()
# Contador de mensajes, por si queremos hacer un seguimiento
mss_cnt = 0

#crear agente
AgenteVendedorExterno = Agent('AgenteVendedorExterno',
                              agn.AgenteVendedorExterno,
                              'http://%s:%d/comm' % (hostname, port),
                              'http://%s:%d/Stop' % (hostname, port))

# direccion del agente directorio
DirectoryAgent = Agent('DirectoryAgent', agn.Directory,
                       'http://%s:%d/Register' % (dhostname, dport),
                       'http://%s:%d/Stop' % (dhostname, dport))

#crear aplicacion servidor
app = Flask(__name__, template_folder="./templates")


def get_message_count():
    global mss_cnt
    if mss_cnt is None:
        mss_cnt = 0