/** * Creates a new {@link Entity} with provided identifier and label * @param id a {@link QualifiedName} for the entity * @param label a String for the label property (see {@link HasLabel#getLabel()} * @return an object of type {@link Entity} */ public Entity newEntity(QualifiedName id, String label) { Entity res = newEntity(id); if (label != null) res.getLabel().add(newInternationalizedString(label)); return res; }
/** * Creates a new {@link Entity} with provided identifier and label * @param id a {@link QualifiedName} for the entity * @param label a String for the label property (see {@link HasLabel#getLabel()} * @return an object of type {@link Entity} */ public Entity newEntity(QualifiedName id, String label) { Entity res = newEntity(id); if (label != null) res.getLabel().add(newInternationalizedString(label)); 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; }
/** * 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 testDoc202() { Document idoc202=new IndexedDocument(pFactory,makeDoc202()).toDocument(); assertEquals(idoc202.getStatementOrBundle().size(),1); Entity e=(Entity)idoc202.getStatementOrBundle().get(0); assertEquals(e.getLabel().size(),1); }
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); }
public Document makeDoc202() { Entity e1=pFactory.newEntity(q("e1")); Entity e2=pFactory.newEntity(q("e1")); e2.getLabel().add(pFactory.newInternationalizedString("hello")); Document doc=pFactory.newDocument(); doc.getStatementOrBundle().add(e1); doc.getStatementOrBundle().add(e2); Namespace nss=Namespace.gatherNamespaces(doc); doc.setNamespace(nss); return doc; }
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; }