/** * @param subj */ private void seeing(AResource subj) { if (subj.isAnonymous()) anon.add(subj); Assert.assertFalse("bnode reuse?", oldAnon.contains(subj)); } /**
/** * @param subj */ private void seeing(AResource subj) { if (subj.isAnonymous()) anon.add(subj); Assert.assertFalse("bnode reuse?", oldAnon.contains(subj)); } /**
private Node convert(AResource r) { if (!r.isAnonymous()) { // URI. String uriStr = r.getURI() ; if ( errorForSpaceInURI ) { // Special check for spaces in a URI. // Convert to an error like TokernizerText. if ( uriStr.contains(" ") ) { int i = uriStr.indexOf(' '); String s = uriStr.substring(0,i); String msg = String.format("Bad character in IRI (space): <%s[space]...>", s); riotErrorHandler.error(msg, -1, -1); throw new RiotParseException(msg, -1, -1); } } return NodeFactory.createURI(uriStr); } // String id = r.getAnonymousID(); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
private Property convertPred(AResource r) { if (r.isAnonymous()) return model.createProperty("http://anonymous.ontopia.net/#id" + r.getAnonymousID()); else return model.createProperty(r.getURI()); }
private static Node convert(AResource r) { if (!r.isAnonymous()) return NodeFactory.createURI(r.getURI()); // String id = r.getAnonymousID(); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
private static Node convert(AResource r) { if (!r.isAnonymous()) return NodeFactory.createURI(r.getURI()); // String id = r.getAnonymousID(); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
private Resource convert(AResource r) { if (r.isAnonymous()) return model.createResource(new StringAnonId(r.getAnonymousID())); else return model.createResource(r.getURI()); }
static private void resource(AResource r) { if (r.isAnonymous()) { print("_:j"); print(escapeNTriple(r.getAnonymousID())); print(" "); } else { print("<"); escapeURI(r.getURI()); print("> "); } }
@Override public void statement(AResource sub, AResource pred, AResource obj) { if (obj.isAnonymous()) { logger.warn("Blank nodes cannot be subject identifiers; " + "subject: " + sub.getURI() + "; " + "property: " + pred.getURI()); throw new RDFMappingException("Blank nodes cannot be subject identifiers", sub.getURI(), pred.getURI()); } TopicIF topic = getSubject(sub); LocatorIF loc = null; try { loc = new URILocator(obj.getURI()); } catch (MalformedURLException e) { throw new OntopiaRuntimeException("INTERNAL ERROR", e); } TopicIF other = topicmap.getTopicBySubjectIdentifier(loc); if (other != null && !other.equals(topic)) MergeUtils.mergeInto(other, topic); else topic.addSubjectIdentifier(loc); } }
static private void resource(AResource r) { if (r.isAnonymous()) { print("_:j"); print(escapeNTriple(r.getAnonymousID())); print(" "); } else { print("<"); escapeURI(r.getURI()); print("> "); } }
@Override public void statement(AResource sub, AResource pred, AResource obj) { if (obj.isAnonymous()) { logger.warn("Blank nodes cannot be source locators; " + "subject: " + sub.getURI() + "; " + "property: " + pred.getURI()); if (!lenient) throw new RDFMappingException("Blank nodes cannot be source locators", sub.getURI(), pred.getURI()); } TopicIF topic = getSubject(sub); LocatorIF loc = null; try { loc = new URILocator(obj.getURI()); } catch (MalformedURLException e) { throw new OntopiaRuntimeException("INTERNAL ERROR", e); } TMObjectIF other = topicmap.getObjectByItemIdentifier(loc); if (other instanceof TopicIF) { TopicIF othert = (TopicIF) other; if (othert != null && !othert.equals(topic)) MergeUtils.mergeInto(othert, topic); else topic.addItemIdentifier(loc); } // else FIXME: what to do? } }
@Override public void statement(AResource sub, AResource pred, AResource obj) { if (obj.isAnonymous()) { logger.warn("Blank nodes cannot be subject locators; " + "subject: " + sub.getURI() + "; " + "predicate: " + pred.getURI()); throw new RDFMappingException("Blank nodes cannot be subject locators", sub.getURI(), pred.getURI()); } TopicIF topic = getSubject(sub); LocatorIF loc = null; try { loc = new URILocator(obj.getURI()); } catch (MalformedURLException e) { throw new OntopiaRuntimeException("INTERNAL ERROR", e); } TopicIF other = topicmap.getTopicBySubjectLocator(loc); if (other != null && other != topic) MergeUtils.mergeInto(other, topic); else topic.addSubjectLocator(loc); } }
@Override public void statement(AResource sub, AResource pred, AResource obj) { if (obj.isAnonymous()) { logger.warn("Blank node cannot be occurrence value; " + "subject: " + sub.getURI() + "; " + "predicate: " + pred.getURI()); if (!lenient) throw new RDFMappingException("Blank node cannot be occurrence value", sub.getURI(), pred.getURI()); } String uri = obj.getURI(); if (uri == null) return; // this happens; not sure why, but it does, so we work around it try { TopicIF topic = getSubject(sub); TopicIF ourtype = type; if (ourtype == null) ourtype = getPredicate(pred); OccurrenceIF occ = builder.makeOccurrence(topic, ourtype, new URILocator(uri)); addScope(occ); } catch (MalformedURLException e) { throw new OntopiaRuntimeException(e); } }
public TopicIF getSubject(AResource sub) { try { TopicIF topic; if (sub.isAnonymous()) {
@Override public void endBNodeScope(AResource bnode) { Assert.assertTrue(bnode.isAnonymous()); switch (state) { case 1 : Assert.fail("Missing startRDF"); return ; case 2 : Assert.assertFalse(bnode.hasNodeID()); seen(bnode); break; case 3 : case 4 : Assert.assertTrue(bnode.hasNodeID()); seen(bnode); state = 4; break; default : Assert.fail("impossible - test logic error"); } }
@Override public void endBNodeScope(AResource bnode) { Assert.assertTrue(bnode.isAnonymous()); switch (state) { case 1 : Assert.fail("Missing startRDF"); return ; case 2 : Assert.assertFalse(bnode.hasNodeID()); seen(bnode); break; case 3 : case 4 : Assert.assertTrue(bnode.hasNodeID()); seen(bnode); state = 4; break; default : Assert.fail("impossible - test logic error"); } }