/** * Remove a nodes * */ public void removeComputeNode(ComputeNode cn, Individual ni) { try { ngen.declareModifyElementRemoveNode(modRes, ni.getURI(), null); } catch (NdlException e) { LIBNDL.logger().debug("ModifyGenerator::removeComputeNode, Failed to remove compute node"); e.printStackTrace(); } }
String NS = "http://example.org/example#"; // create ex:Man class OntClass man = model.createClass( NS + "Man" ); // create individual ex:jack Individual jack = model.createIndividual( NS + "jack", man ); // create some properties - probably better to use FOAF here really DatatypeProperty age = model.createDatatypeProperty( NS + "age" ); DatatypeProperty address = model.createDatatypeProperty( NS + "address" ); jack.addProperty( age, model.createTypedLiteral( 50 ) ) .addProperty( address, model.createLiteral( "France" ) );
private void checkCardinalityAndBindValue(BioPAXElement bpe, Individual individual, Model model, OntProperty ontProperty, PropertyEditor editor) { if (editor.isMultipleCardinality()) { NodeIterator nodeIterator = individual.listPropertyValues(ontProperty); while (nodeIterator.hasNext()) { RDFNode propertyValue = (RDFNode) nodeIterator.next(); bindValue(propertyValue, editor, bpe, model); } } else { RDFNode propertyValue = individual.getPropertyValue(ontProperty); bindValue(propertyValue, editor, bpe, model); } }
if (ind.isClass()) { log.debug("Resource {} is already a class", ind.getURI()); return null; } else if (ind.isIndividual()) { return ind;
private void createObjects(OntModel ontModel, Model model) { ExtendedIterator extendedIterator = ontModel.listIndividuals(); while (extendedIterator.hasNext()) { Individual individual = (Individual) extendedIterator.next(); OntClass ontClass = (OntClass) individual.getRDFType().as(OntClass.class); createAndAdd(model, individual.getURI(), ontClass.getLocalName()); } }
if (plist.get(k).hasProperty(hasCodeDTP)){ codesL.add(plist.get(k).getPropertyValue(hasCodeDTP).asLiteral().getString()); System.out.println("The pitfall does not have CODE: " + plist.get(k).getURI()); String title = ind.getPropertyValue(hasNameDTP).asLiteral().getString(); String code = ind.getPropertyValue(hasCodeDTP).asLiteral().getString(); String description = ind.getPropertyValue(hasDescriptionDTP).asLiteral().getString(); String importanceLevel = ind.getPropertyValue(hasImportanceLevelDTP).asLiteral().getString(); boolean hasFrequency = ind.hasProperty(hasFrequencyDTP); int frequency = 0; frequency = ind.getPropertyValue(hasFrequencyDTP).asLiteral().getInt(); Resource affectedE = ind.getPropertyResourceValue(hasAffectedElement); evaluationOutput = evaluationOutput + "<p>" + "The property " + "</p>"; if (code.contentEquals("P05")){ NodeIterator elements= ind.listPropertyValues(mightNotBeInverseOf); NodeIterator elementos= indi.listPropertyValues(hasAffectedElement); String first = elementos.next().asLiteral().getString(); String second = elementos.next().asLiteral().getString(); NodeIterator elements = ind.listPropertyValues(noSuggestion);
if (value.canAs(Individual.class)) { individual = value.as(Individual.class); operation = new Operation(new URI(individual.getURI())); setInvocableEntityProperties(individual, operation); rdfNode = individual.getPropertyValue(MSM.hasInput); mc = obtainMessageContent(rdfNode); if (mc != null) operation.addInput(mc); rdfNode = individual.getPropertyValue(MSM.hasOutput); mc = obtainMessageContent(rdfNode); if (mc != null) operation.addOutput(mc); rdfNode = individual.getPropertyValue(MSM.hasFault); mc = obtainMessageContent(rdfNode); if (mc != null) operation.addFault(mc); rdfNode = individual.getPropertyValue(MSM.hasInputFault); mc = obtainMessageContent(rdfNode); if (mc != null) operation.addInputFault(mc); rdfNode = individual.getPropertyValue(MSM.hasOutputFault); mc = obtainMessageContent(rdfNode); if (mc != null)
Service service = new Service(new URI(individual.getURI())); setInvocableEntityProperties(individual, service); hasOpValues = individual.listPropertyValues(MSM.hasOperation); List<Operation> operations = obtainOperations(hasOpValues); service.setOperations(operations); if (individual.hasProperty(HRESTS.hasAddress)) { service.setAddress(individual.getProperty(HRESTS.hasAddress).getString()); if (individual.hasProperty(MSM_NFP.hasTotalMashups)) { service.setTotalMashups(individual.getProperty(MSM_NFP.hasTotalMashups).getInt()); if (individual.hasProperty(MSM_NFP.hasRecentMashups)) { service.setRecentMashups(individual.getProperty(MSM_NFP.hasRecentMashups).getInt()); Resource forumValue = individual.getPropertyResourceValue(MSM_NFP.hasForum); if (forumValue != null) { Forum forum = new Forum(new URI(forumValue.getURI())); Resource twitterAccountValue = individual.getPropertyResourceValue(MSM_NFP.hasTwitterAccount); if (twitterAccountValue != null) { TwitterAccount twitterAccount = new TwitterAccount(new URI(twitterAccountValue.getURI())); Resource providerValue = individual.getPropertyResourceValue(SCHEMA.provider); if (providerValue != null) { Provider provider = new Provider(new URI(providerValue.getURI())); Resource documentationValue = individual.getPropertyResourceValue(MSM_NFP.hasDocumentation);
String indURI = namingStrategy.getIndividualName(ontologyURI, cmsObject); ind = ontModel.createIndividual(indURI, klass); ind.addProperty(CMSAdapterVocabulary.CMSAD_RESOURCE_REF_PROP, cmsObject.getUniqueRef()); return ind; } else if (ind.isClass()) { log.debug("Resource {} is already a class", ind.getURI()); return null; } else {
nodeIterator = individual.listPropertyValues(SAWSDL.modelReference); FilterByRdfType typeFilter = new FilterByRdfType(resourceType); ExtendedIterator<RDFNode> filteredIter = nodeIterator.filterKeep(typeFilter); if (axiomClass.equals(Condition.class)) { Condition cond; if (axiomIndiv.isAnon()) { cond = new Condition(null); } else { cond = new Condition(new URI(axiomIndiv.getURI())); if (axiomIndiv.isAnon()) { effect = new Effect(null); } else { effect = new Effect(new URI(axiomIndiv.getURI()));
BioPAXElement bpe = model.getByID(individual.getURI()); StmtIterator stmtIterator = individual.listProperties(); while (stmtIterator.hasNext())
private void setResourceProperties(Individual individual, uk.ac.open.kmi.msm4j.Resource result) throws URISyntaxException { Resource res; result.setComment(individual.getComment(null)); result.setLabel(individual.getLabel(null)); NodeIterator seeAlsoIterator = individual.listPropertyValues(RDFS.seeAlso); for (RDFNode seeAlsoValue : seeAlsoIterator.toList()) { result.addSeeAlso(new URI(seeAlsoValue.asResource().getURI())); res = individual.getPropertyResourceValue(DCTerms.source); if (res != null) { result.setSource(new URI(res.getURI())); res = individual.getPropertyResourceValue(DCTerms.creator); if (res != null) { result.setCreator(new URI(res.getURI())); NodeIterator licenseIterator = individual.listPropertyValues(DCTerms.license); for (RDFNode licenseValue : licenseIterator.toList()) { result.addLicense(new URI(licenseValue.asResource().getURI())); NodeIterator sameAsIterator = individual.listPropertyValues(OWL2.sameAs); for (RDFNode sameAsValue : sameAsIterator.toList()) { result.addSameAs(new URI(sameAsValue.asResource().getURI()));
private List<MessagePart> obtainParts(Individual individual, Property partsProperty) throws URISyntaxException { List<MessagePart> result = new ArrayList<MessagePart>(); if (individual == null) return result; RDFNode node; MessagePart messagePart; NodeIterator nodeIterator = null; try { nodeIterator = individual.listPropertyValues(partsProperty); while (nodeIterator.hasNext()) { node = nodeIterator.next(); messagePart = obtainMessagePart(node); if (messagePart != null) result.add(messagePart); } } finally { if (nodeIterator != null) nodeIterator.close(); } return result; }
private Object getAxiom(Individual axiomIndiv) { RDFNode value = axiomIndiv.getPropertyValue(RDF.value); if (value != null && value.isLiteral()) { return value.asLiteral().getValue(); } return null; }
@Override public boolean accept( Individual o ) { // if direct, ignore the sub-class typed resources return o.hasRDFType( OntClassImpl.this, direct ); }} ).filterKeep( new UniqueFilter<Individual>()); }
private List<URI> obtainMappings(Individual individual, Property mappingProperty) throws URISyntaxException { List<URI> result = new ArrayList<URI>(); if (individual == null || mappingProperty == null) return result; NodeIterator nodeIterator = null; Resource schemaMap; RDFNode node; try { nodeIterator = individual.listPropertyValues(mappingProperty); while (nodeIterator.hasNext()) { node = nodeIterator.next(); if (node.isResource()) { schemaMap = node.asResource(); result.add(new URI(schemaMap.getURI())); } } } finally { if (nodeIterator != null) nodeIterator.close(); } return result; }
RDFNode rdfGrounding = individual.getPropertyValue(MSM.isGroundedIn); if (rdfGrounding != null) { if (rdfGrounding.isResource()) { rdfGrounding = individual.getPropertyValue(MSM_WSDL.isGroundedIn); if (rdfGrounding != null) { if (rdfGrounding.isLiteral()) { rdfGrounding = individual.getPropertyValue(MSM_SWAGGER.isGroundedIn); if (rdfGrounding != null) { if (rdfGrounding.isLiteral()) {
@Override public boolean accept(T node) { if (node.canAs(Individual.class)) { Individual individual = node.as(Individual.class); for (Resource rdfType : rdfTypes) { if (individual.hasRDFType(rdfType)) return true; } } return false; } }
private MessagePart obtainMessagePart(RDFNode inputNode) throws URISyntaxException { MessagePart result = null; if (inputNode == null || !inputNode.canAs(Individual.class)) { return result; } Individual individual = inputNode.as(Individual.class); result = new MessagePart(new URI(individual.getURI())); setAnnotableResourceProperties(individual, result); // Process mandatory parts List<MessagePart> mps; mps = obtainParts(individual, MSM.hasMandatoryPart); result.setMandatoryParts(mps); // Process optional parts mps = obtainParts(individual, MSM.hasOptionalPart); result.setOptionalParts(mps); return result; }
private void buildStatementFor(BioPAXElement bean, PropertyEditor editor, Object value, OntModel ontModel) { assert (bean != null && editor != null); Property property = ontModel.getProperty(this.getLevel().getNameSpace() + editor.getProperty()); Individual ind = objectToIndividualMap.get(bean); Class range = editor.getRange(); JenaEditorMap editorMap = (JenaEditorMap) this.getEditorMap(); XSDDatatype dataType = editorMap.getDataTypeFor(editor); if (dataType != null) { ind.addProperty(property, ontModel.createTypedLiteral(value.toString(), dataType)); } else { Individual valueInd = objectToIndividualMap.get(value); if (valueInd == null) // TODO not sure about Boolean case here, but this makes tests pass... { throw new IllegalBioPAXArgumentException( range + " : for value '" + value + "' coresponding individual value is NULL " + "(objectToIndividualMap)"); } ind.addProperty(property, valueInd); } } static OntModel createModel()