Package datomic

Examples of datomic.Entity


    }

    @RequestMapping(value = "/database/{dbname}/entity/{id}", method = {GET, POST})
    public ModelAndView entity(@PathVariable String dbname, @PathVariable String id) {
        final Connection connection = connect(dbname);
        final Entity entity = connection.db().entity(Long.valueOf(id));
        final List<Entity> instances =
            Attributes.is(entity) ? Attributes.instances(entity, connection.db()) : Collections.<Entity>emptyList();
        final List<Entity> referers = Entities.referers(entity, connection.db());
        return new ModelAndView("entity")
            .addObject("dbname", dbname)
View Full Code Here


    }

    private IRubyObject createEntity(ThreadContext context, Long entityId) {
        try {
            Var entity_fn = DiametricService.getFn("datomic.api", "entity");
            Entity entity = (Entity) entity_fn.invoke(database, entityId);
            RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Entity");
            DiametricEntity diametric_entity = (DiametricEntity)clazz.allocate();
            diametric_entity.init(entity);
            return diametric_entity;
        } catch (Throwable t) {
View Full Code Here

    private IRubyObject createFunction(ThreadContext context, RubySymbol arg) {
        try {
            Var keyword_fn = DiametricService.getFn("clojure.core", "keyword");
            Keyword entityKey = (Keyword) keyword_fn.invoke(arg.toString());
            Var entity_fn = DiametricService.getFn("datomic.api", "entity");
            Entity entity = (Entity) entity_fn.invoke(database, entityKey);
            datomic.function.Function function = (Function) entity.get(DiametricService.keywords.get("db/fn"));
            RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Function");
            DiametricFunction diametric_function = (DiametricFunction)clazz.allocate();
            diametric_function.init(function);
            return diametric_function;
        } catch (Throwable t) {
View Full Code Here

    // Creates a collection containing the set of datomic facts describing this entity
    protected Set<Object> getFacts() {
        // Create the set of facts
        Set<Object> theFacts = new HashSet<Object>();
        // Get the entity
        Entity entity = getDatabase().entity(id);
        // Add the base facts associated with this edge
        Set properties = entity.keySet();
        Iterator<Keyword> propertiesIt = properties.iterator();
        while (propertiesIt.hasNext()) {
            Keyword property = propertiesIt.next();
            // Add all properties (except the ident property (is only originally used for retrieving the id of the created elements)
            if (!property.toString().equals(":db/ident")) {
                theFacts.add(FluxUtil.map(":db/id", id, property.toString(), entity.get(property).toString()));
            }
        }
        return theFacts;
    }
View Full Code Here

TOP

Related Classes of datomic.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.