@Override public LocatorIF getDataType() { return occ.getDataType(); }
@Override public boolean evaluate(OccurrenceIF occurrence) { return Objects.equals(occurrence.getDataType(), datatype); } }
private static Collection filterOccurrences(Collection occs) { Collection result = new ArrayList(occs.size()); Iterator iter = occs.iterator(); while (iter.hasNext()) { OccurrenceIF occ = (OccurrenceIF) iter.next(); if (!Objects.equals(occ.getDataType(), DataTypes.TYPE_URI)) result.add(occ); } return result; }
protected static String makeDataKey(OccurrenceIF occ) { return "$$" + occ.getValue() + SPACER + occ.getDataType(); }
@Override public Locator getDatatype() { return topicMap.wrapLocator(wrapped.getDataType()); }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) ) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, String value, LocatorIF datatype, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getValue(), value) && Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) ) result.add(occurIF); } return result; }
public static OccurrenceIF findOccurrence(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (Objects.equals(occurIF.getType(), oType) && Objects.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) return occurIF; } return null; }
public FakeOccurrence(OccurrenceIF occ) { this.occ = occ; LocatorIF datatype = occ.getDataType(); if (datatype.equals(DataTypes.TYPE_URI)) { LocatorIF locator = occ.getLocator(); this.value = normaliseLocatorReference(locator.getAddress()); } else if (datatype.equals(DataTypes.TYPE_INTEGER) || datatype.equals(DataTypes.TYPE_DECIMAL)) this.value = normalizeNumber(occ.getValue()); else this.value = occ.getValue(); }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
public static OccurrenceIF findOccurrence(TopicIF oType, TopicIF topicIF, LocatorIF datatype, Collection<TopicIF> scope) { Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) return occurIF; } return null; }
public static List<OccurrenceIF> findOccurrences(TopicIF oType, TopicIF topicIF, String value, LocatorIF datatype, Collection<TopicIF> scope) { List<OccurrenceIF> result = new ArrayList<OccurrenceIF>(); Iterator<OccurrenceIF> it = topicIF.getOccurrences().iterator(); while (it.hasNext()) { OccurrenceIF occurIF = it.next(); if (ObjectUtils.equals(occurIF.getValue(), value) && ObjectUtils.equals(occurIF.getType(), oType) && ObjectUtils.equals(occurIF.getDataType(), datatype) && CollectionUtils.equalsUnorderedSet(occurIF.getScope(), scope)) result.add(occurIF); } return result; }
@Override public DocumentIF generate(OccurrenceIF occur) { // Create document DocumentIF doc = createDocument(); // Add fields addObjectFields(doc, occur, "O"); if (Objects.equals(occur.getDataType(), DataTypes.TYPE_URI)) addLocatorField(doc, occur.getLocator()); else addContentField(doc, occur.getValue()); return doc; }
private void write(OccurrenceIF occurrence, int number) { AttributesImpl attributes = reifier(occurrence); attributes.addAttribute("", "", AT_NUMBER, null, "" + number); startElement(EL_OCCURRENCE, attributes); attributes.clear(); write(occurrence.getValue()); // normalized in FakeOccurrence below write(occurrence.getDataType(), "datatype"); writeType(occurrence); write(occurrence.getScope()); writeLocators(occurrence.getItemIdentifiers(), EL_ITEMIDENTIFIERS); endElement(EL_OCCURRENCE); }
public void testDynamicOccChange() throws InvalidQueryException, IOException { load("jill.xtm"); OccurrenceIF occ = (OccurrenceIF) getObjectById("jills-contract"); update("update value($C, \"No such contract\") from type($C, contract)"); assertTrue("occurrence not changed after update", occ.getValue().equals("No such contract")); assertTrue("incorrect datatype after update", occ.getDataType().equals(DataTypes.TYPE_STRING)); }
public void testStaticOccChange() throws InvalidQueryException, IOException { load("jill.xtm"); OccurrenceIF occ = (OccurrenceIF) getObjectById("jills-contract"); update("update value(jills-contract, \"No such contract\")"); assertTrue("occurrence not changed after update", occ.getValue().equals("No such contract")); assertTrue("incorrect datatype after update", occ.getDataType().equals(DataTypes.TYPE_STRING)); }
public void testDynamicResource() throws InvalidQueryException, IOException { load("jill.xtm"); OccurrenceIF occ = (OccurrenceIF) getObjectById("jills-contract"); update("update resource($C, \"http://example.com\") " + "from type($C, contract)"); assertTrue("occurrence not changed after update: " + occ.getLocator(), occ.getLocator().getAddress().equals("http://example.com/")); assertTrue("incorrect datatype after update", occ.getDataType().equals(DataTypes.TYPE_URI)); }
public void testStaticResource() throws InvalidQueryException, IOException { load("jill.xtm"); OccurrenceIF occ = (OccurrenceIF) getObjectById("jills-contract"); update("update resource(jills-contract, \"http://example.com\")"); assertTrue("occurrence not changed after update: " + occ.getLocator(), occ.getLocator().getAddress().equals("http://example.com/")); assertTrue("incorrect datatype after update", occ.getDataType().equals(DataTypes.TYPE_URI)); }