/** * Creates an RDFGenerator that adds all of the RDF to the specified model. * * @param model * The Jena model. */ public RDFGenerator(final EIOntModel eagleiOntModel, final Model model) throws IOException { super( eagleiOntModel ); this.model = model; directType = model.createProperty( DIRECT_TYPE_URI ); }
/** * {@inheritDoc} */ @Override public Property createProperty(String nameSpace, String localName) { return super.object.createProperty(nameSpace, localName); }
/** * @param uri * The uri of the property to create * @return A Jena temporary <code>Property</code> */ protected Property createTempProp(final String uri) { return this.tempModel.createProperty(uri); }
/** * {@inheritDoc} */ @Override public Property createProperty(String uri) { return super.object.createProperty(uri); }
public void assertRelation(URI uri, Proxy proxy) throws OREException { res.addProperty(model.createProperty(uri.toString()), ((ProxyJena) proxy).getResource()); }
private void addLocatedInAndLocationOf(final Resource child, final Resource parent) { // add located_in property from the child to the parent final Statement stmt = model.createStatement( child, model.createProperty( LOCATED_IN_URI ), parent ); model.add( stmt ); // add location_of property from the lab to the instrument model.add( model.createStatement( parent, model.createProperty( LOCATION_OF_URI ), child ) ); } }
public void addObject(String subject, String predicate, String object) { Model model =getContextModel(); Resource s = getResource(model, subject.trim()); Property p = model.createProperty(predicate.trim()); Resource o = getResource(model, object.trim()); model.add(s, p, o); }
public void relate(Predicate pred, Object literal) throws OREException { Property property = model.createProperty(pred.getURI().toString()); triple.addProperty(property, model.createTypedLiteral(literal)); }
public void addAgent(URI relationship, Agent agent) throws OREException { Resource resource = ((AgentJena) agent).getResource(); res.addProperty(model.createProperty(relationship.toString()), resource); this.addResourceToModel(resource); }
public void relate(Predicate pred, OREResource resource) throws OREException { Property property = model.createProperty(pred.getURI().toString()); triple.addProperty(property, model.createResource(resource.getURI().toString())); }
public List<Agent> getAgents(URI relationship) throws OREException { List<Agent> agents = new ArrayList<Agent>(); StmtIterator itr = res.listProperties(model.createProperty(relationship.toString())); while (itr.hasNext()) { Statement statement = itr.nextStatement(); Agent agent = JenaOREFactory.createAgent((Resource) statement.getObject()); agents.add(agent); } return agents; }
protected void modifyProperty(Model m, String resourceUri, String property) { Resource r = m.getResource(resourceUri); Property p = m.createProperty(property); r.removeAll(p); // Don't sweat the value or datatype since we expect the PUT to fail anyway. r.addProperty(p, "modified"); }
private static void load3(Model model) { Resource r1 = model.createResource(base1+"r3") ; Property p1 = model.createProperty(baseNS+"p2") ; model.add(r1, p1, "x1") ; model.add(r1, p1, "x2") ; }
private static void load2(Model model) { Resource r1 = model.createResource(base1+"r2") ; Property p1 = model.createProperty(baseNS+"p1") ; model.add(r1, p1, "x1") ; model.add(r1, p1, "x2") ; }
@Test public void testConfiguredAuthorProperties() { Property a = configModel.createProperty( "eh:/A" ); Property b = configModel.createProperty( "eh:/B" ); // Property[] properties = new Property[] {a, b}; RDFList l = configModel.createList( properties ); config.addProperty( ELDA_API.feedAuthorProperties, l ); // FeedRenderer fr = makeFeedRenderer( config ); assertEquals( list(a, b), fr.getAuthorProperties() ); }
public void testEnablePropertiesConfig(boolean expectHardwired, boolean expectNotwired, String control) { Model config = ModelIOUtils.modelFromTurtle(configString(control)); Resource root = config.createResource("eh:/root"); MetaConfig mc = new MetaConfig(root); assertEquals(expectHardwired, mc.drop(config.createProperty("http://purl.org/dc/terms/hasPart"))); assertEquals(expectNotwired, mc.drop(config.createProperty("eh:/not-at-all"))); } protected String configNamedBlockNoSubst() {
private static void load1(Model model) { model.setNsPrefix("", base1) ; Resource r1 = model.createResource(base1+"r1") ; Property p1 = model.createProperty(baseNS+"p1") ; model.add(r1, p1, "x1") ; model.add(r1, p1, "x2") ; }
protected Model getDefaultModel() { Model model = ModelFactory.createDefaultModel(); Resource resource = model.createResource("", model.createResource("http://example.com/ns#Bug")); resource.addProperty(RDF.type, model.createResource(LDP.RDFSource.stringValue())); resource.addProperty( model.createProperty("http://example.com/ns#severity"), "High"); resource.addProperty(DCTerms.title, "Another bug to test."); resource.addProperty(DCTerms.description, "Issues that need to be fixed."); return model; }
@Test public void testTextSearchFromConfig() { Resource config = model.createResource( "eh:/spec" ); Resource endpoint = model.createResource( "eh:/sparql" ); config.addProperty( API.sparqlEndpoint, endpoint ); Property textQuery = model.createProperty( "eh:/textQuery" ); endpoint.addProperty( ELDA_API.textQueryProperty, textQuery ); Source s = GetDataSource.sourceFromSpec( fm, config, am ); TextSearchConfig tsc = s.getTextSearchConfig(); assertEquals( textQuery, tsc.getTextQueryProperty() ); assertNull( tsc.getTextSearchOperand() ); }
@Test public void testTextPropertyFromConfig() { Resource config = model.createResource( "eh:/spec" ); Resource endpoint = model.createResource( "eh:/sparql" ); Property textContent = model.createProperty( "eh:/textContent" ); endpoint.addProperty( ELDA_API.textContentProperty, textContent ); config.addProperty( API.sparqlEndpoint, endpoint ); Source s = GetDataSource.sourceFromSpec( fm, config, am ); TextSearchConfig tsc = s.getTextSearchConfig(); assertEquals( textContent, tsc.getTextContentProperty() ); assertNull( tsc.getTextSearchOperand() ); }