public HashMap<String,String> addEntityShape(Entity p, HashMap<String,String> properties) { // default is good for entity List<Type> types=p.getType(); for (Type type: types) { if (type.getValue() instanceof QualifiedName) { QualifiedName name=(QualifiedName) type.getValue(); if (("Dictionary".equals(name.getLocalPart())) || ("EmptyDictionary".equals(name.getLocalPart()))) { properties.put("shape","folder"); } } } return properties; }
public HashMap<String,String> addEntityShape(Entity p, HashMap<String,String> properties) { // default is good for entity List<Type> types=p.getType(); for (Type type: types) { if (type.getValue() instanceof QualifiedName) { QualifiedName name=(QualifiedName) type.getValue(); if (("Dictionary".equals(name.getLocalPart())) || ("EmptyDictionary".equals(name.getLocalPart()))) { properties.put("shape","folder"); } } } return properties; }
/** * Creates a copy of an entity. The copy is shallow in the sense that the new Entity shares the same attributes as the original Entity. * @param e an {@link Entity} to copy * @return a copy of the input {@link Entity} */ public Entity newEntity(Entity e) { Entity res = newEntity(e.getId()); res.getOther().addAll(e.getOther()); res.getType().addAll(e.getType()); res.getLabel().addAll(e.getLabel()); res.getLocation().addAll(e.getLocation()); return res; }
/** * Creates a copy of an entity. The copy is shallow in the sense that the new Entity shares the same attributes as the original Entity. * @param e an {@link Entity} to copy * @return a copy of the input {@link Entity} */ public Entity newEntity(Entity e) { Entity res = newEntity(e.getId()); res.getOther().addAll(e.getOther()); res.getType().addAll(e.getType()); res.getLabel().addAll(e.getLabel()); res.getLocation().addAll(e.getLocation()); return res; }
public void testEntityWithOneTypeAttribute(int i) { Entity a = pFactory.newEntity(q("et" + i)); Object [] pair= attributeValues[i]; Object value=pair[0]; QualifiedName type=(QualifiedName) pair[1]; a.getType().add(pFactory.newType(value,type)); makeDocAndTest(a,"target/attr_entity_one_attr"+i); }
public void testDoc203() { Document idoc203=new IndexedDocument(pFactory,makeDoc203()).toDocument(); assertEquals(idoc203.getStatementOrBundle().size(),1); Entity e=(Entity)idoc203.getStatementOrBundle().get(0); assertEquals("label", e.getLabel().size(),1); assertEquals("location", e.getLocation().size(),1); assertEquals("type", e.getType().size(),1); assertEquals("other", e.getOther().size(),1); }
@Override public void doAction(Entity e) { register(e.getId()); registerLocation(e.getLocation()); registerType(e.getType()); registerValue(e.getValue()); registerOther(e.getOther()); }
@Override public void doAction(Entity e) { register(e.getId()); registerLocation(e.getLocation()); registerType(e.getType()); registerValue(e.getValue()); registerOther(e.getOther()); }
public Document makeDoc203() { Entity e1=pFactory.newEntity(q("e1")); Entity e2=pFactory.newEntity(q("e1")); e2.getLabel().add(pFactory.newInternationalizedString("hello")); e2.getLabel().add(pFactory.newInternationalizedString("hello")); e2.getLocation().add(pFactory.newLocation("liege", pFactory.getName().XSD_STRING)); e2.getLocation().add(pFactory.newLocation("liege", pFactory.getName().XSD_STRING)); e2.getLocation().add(pFactory.newLocation("liege", pFactory.getName().XSD_STRING)); e2.getType().add(pFactory.newType(q("TYPE"), pFactory.getName().PROV_QUALIFIED_NAME)); e2.getType().add(pFactory.newType(q("TYPE"), pFactory.getName().PROV_QUALIFIED_NAME)); e2.getOther().add(pFactory.newOther(q("ELEMENT"), 1, pFactory.getName().XSD_INT)); e2.getOther().add(pFactory.newOther(q("ELEMENT"), 1, pFactory.getName().XSD_INT)); Document doc=pFactory.newDocument(); doc.getStatementOrBundle().add(e1); doc.getStatementOrBundle().add(e2); Namespace nss=Namespace.gatherNamespaces(doc); doc.setNamespace(nss); return doc; }