http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/java/org/apache/any23/vocab/WO.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/any23/vocab/WO.java b/api/src/main/java/org/apache/any23/vocab/WO.java index 49d8a35..6a28b72 100644 --- a/api/src/main/java/org/apache/any23/vocab/WO.java +++ b/api/src/main/java/org/apache/any23/vocab/WO.java @@ -17,7 +17,7 @@ package org.apache.any23.vocab; -import org.openrdf.model.URI; +import org.eclipse.rdf4j.model.IRI; /** * <p>The <a href="http://purl.org/ontology/wo/">Wildlife Ontology</a> vocabulary.</p> @@ -46,9 +46,9 @@ public class WO extends Vocabulary { } /** - * The namespace of the vocabulary as a URI. + * The namespace of the vocabulary as a IRI. */ - public final URI NAMESPACE = createURI(NS); + public final IRI NAMESPACE = createIRI(NS); //////////////////////////////////////////////////////////////////// //CLASSES @@ -59,7 +59,7 @@ public class WO extends Vocabulary { * task. For instance, being streamlined is an adaptation to swimming * fast and being able to survive on very little water is an * adaptation to life in the desert.*/ - public final URI Adaption = createClass("Adaption"); + public final IRI Adaption = createClass("Adaption"); /** Animal Intelligence or animal cognition is the title * given to a modern approach to the mental capacities of @@ -67,19 +67,19 @@ public class WO extends Vocabulary { * psychology, but has also been strongly influenced by * the approach of ethology, behavioral ecology, and * evolutionary psychology.*/ - public final URI Animal_Intelligence = createClass("AnimalIntelligence"); + public final IRI Animal_Intelligence = createClass("AnimalIntelligence"); /** Behavioural pattern describes an animal's dominant way of * life. Arboreal animals, for example, live in trees and * nocturnal animals are active at night.*/ - public final URI BehaviouralPattern = createClass("BehaviouralPattern"); + public final IRI BehaviouralPattern = createClass("BehaviouralPattern"); /** A class is a scientific way to group related organisms * together, some examples of classes being jellyfish, * reptiles and sea urchins. Classes are big groups and * contain within them smaller groupings called orders, * families, genera and species.*/ - public final URI Class = createClass("Class"); + public final IRI Class = createClass("Class"); /** A collection of resources, including documents, * multimedia files, programme clips and their associated . @@ -88,17 +88,17 @@ public class WO extends Vocabulary { * the natural world. A collection provides an alternate * way to organize content over and above the basic * taxonomic hierarchy.*/ - public final URI Collection = createClass("Collection"); + public final IRI Collection = createClass("Collection"); /** Communication and senses are how an organism perceives * the world - for instance through scent or sight - and * how it sends messages or warnings to others.*/ - public final URI CommunicationAdaption = createClass("CommunicationAdaption"); + public final IRI CommunicationAdaption = createClass("CommunicationAdaption"); /** Conservation status as described by the IUCN Red List. * Will typically have a number of properties including an * official IUCN status, population trend, and a year of assessment.*/ - public final URI ConservationStatus = createClass("ConservationStatus"); + public final IRI ConservationStatus = createClass("ConservationStatus"); /** Ecosystem roles are about the part an animal or plant * plays in sustaining or maintaining the habitat around them. @@ -106,7 +106,7 @@ public class WO extends Vocabulary { * plants would not produce fruits or seeds. Other species, * such as dung beetles, play a vital role in keeping grasslands * clear of animal waste and recycling valuable resources.*/ - public final URI EcosystemRole = createClass("EcosystemRole"); + public final IRI EcosystemRole = createClass("EcosystemRole"); /** Ecozones are a method of dividing up the Earth's surface. * Each ecozone is a large area that contains a number of @@ -114,13 +114,13 @@ public class WO extends Vocabulary { * of the animals and plants within them. For instance one * ecozone is Australasia, because its marsupials evolved * in isolation to mammals in the rest of the world.*/ - public final URI Ecozone = createClass("Ecozone"); + public final IRI Ecozone = createClass("Ecozone"); /** Organisms that are adapted to extremes (known as Extremophiles) * are organisms that thrives in and even may require physically * or geochemically extreme conditions that are detrimental * to the majority of life on Earth.*/ - public final URI ExtremesAdaptiation = createClass("ExtremesAdaptiation"); + public final IRI ExtremesAdaptiation = createClass("ExtremesAdaptiation"); /** A family is a scientific grouping of closely related organisms. * It has smaller groups, called genera and species, within it. A @@ -129,18 +129,18 @@ public class WO extends Vocabulary { * the grasses (Poaceae). Further Reading: * http://en.wikipedia.org/wiki/Family_%28biology%29 * http://www.bbc.co.uk/nature/family*/ - public final URI Family = createClass("Family"); + public final IRI Family = createClass("Family"); /** Feeding habits describe the dominant diet of a particular * species or group of species, and how they go about obtaining it.*/ - public final URI FeedingHabit = createClass("FeedingHabit"); + public final IRI FeedingHabit = createClass("FeedingHabit"); /** Freshwater habitats include bogs, ponds, lakes, rivers and streams. * About 3% of Earth's water is freshwater, but this includes the water * locked up in the ice caps and trapped in rocks and soil as groundwater. * Only a tiny fraction (0.014%) is surface water in the form of rivers, * lakes and swamps.*/ - public final URI FreshwaterHabitat = createClass("FreshwaterHabitat"); + public final IRI FreshwaterHabitat = createClass("FreshwaterHabitat"); /** A genus is a scientific way of showing that species are very closed * related to each other. In fact the first word of the species' @@ -150,7 +150,7 @@ public class WO extends Vocabulary { * http://en.wikipedia.org/wiki/Genus * http://www.bbc.co.uk/nature/genus * */ - public final URI Genus = createClass("Genus"); + public final IRI Genus = createClass("Genus"); /** A habitat, or biome, is the type of environment in which plant * and animals live. Habitat is dictated by what kinds of plants @@ -159,7 +159,7 @@ public class WO extends Vocabulary { * of plants and animals might be found. Further Reading: * http://en.wikipedia.org/wiki/Habitat * http://www.bbc.co.uk/nature/habitats */ - public final URI Habitat = createClass("Habitat"); + public final IRI Habitat = createClass("Habitat"); /** Infraorders are a subdivision of suborders - thus infraorders * are an intermediate rank of classification, that group together @@ -170,7 +170,7 @@ public class WO extends Vocabulary { * infraorder that contains all the horned dinosaurs. Further Reading: * http://en.wikipedia.org/wiki/Infraorder * http://www.bbc.co.uk/nature/infraorder*/ - public final URI Infraorder = createClass("Infraorder"); + public final IRI Infraorder = createClass("Infraorder"); /** Kingdoms are the major categories into which scientists * divide up all living things. The main kingdoms are animals, @@ -180,26 +180,26 @@ public class WO extends Vocabulary { * do not. Further Reading: * http://en.wikipedia.org/wiki/Kingdom_%28biology%29 * http://www.bbc.co.uk/nature/kingdom*/ - public final URI Kingdom = createClass("Kingdom"); + public final IRI Kingdom = createClass("Kingdom"); /** An organism's Life Cycle describes the stages in an * organisms development including metamorphosis, courtship * displays and parental care.*/ - public final URI Lifecycle = createClass("Lifecycle"); + public final IRI Lifecycle = createClass("Lifecycle"); /** Locomotion is how an animal gets around - for instance by swimming, * flying or climbing.*/ - public final URI LocomotionAdaption = createClass("LocomotionAdaption"); + public final IRI LocomotionAdaption = createClass("LocomotionAdaption"); /** Approximately 71% of the Earth's surface is covered by the oceans, * an area of some 223698816km/sq. Although marine life evolved around * three billion years before life on land, marine habitats are relatively * poorly studied and much of the ocean's depths remains unexplored.*/ - public final URI MarineHabitat = createClass("MarineHabitat"); + public final IRI MarineHabitat = createClass("MarineHabitat"); /** Morphology is anything to do with what a plant or animal looks like - * its size, shape, colour or structure.*/ - public final URI Morphology = createClass("Morphology"); + public final IRI Morphology = createClass("Morphology"); /** An order is a scientific way to categorise related organisms. * An order is a smaller grouping than a class, but bigger than @@ -207,7 +207,7 @@ public class WO extends Vocabulary { * and primates. Further Reading: * http://en.wikipedia.org/wiki/Order_%28biology%29 * http://www.bbc.co.uk/nature/order*/ - public final URI Order = createClass("Order"); + public final IRI Order = createClass("Order"); /** A phylum - also known as a division when referring to plants - * is a scientfic way of grouping together related organisms. @@ -217,34 +217,34 @@ public class WO extends Vocabulary { * further subdivided into classes, orders, families and so on. * Further Reading: http://en.wikipedia.org/wiki/Phylum * http://www.bbc.co.uk/nature/phylum*/ - public final URI Phylum = createClass("Phylum"); + public final IRI Phylum = createClass("Phylum"); /** Predation is catching and killing an animal in order to eat it. * The prey can be chased, ambushed or caught in a trap such as a * spider's web.*/ - public final URI PredationStrategy = createClass("PredationStrategy"); + public final IRI PredationStrategy = createClass("PredationStrategy"); /** A category in the IUCN red list, 2001. Further Reading: * http://www.iucnredlist.org/technical-documents/categories-and-criteria/2001-categories-criteria */ - public final URI RedListStatus = createClass("RedListStatus"); + public final IRI RedListStatus = createClass("RedListStatus"); /** Reproduction covers all the tactics and behaviours involved in obtaining * a mate, conceiving the next generation and successfully raising them. * It includes everything from plants being pollinated, to stags * fighting over hinds, to lionesses babysitting their sisters' cubs.*/ - public final URI ReproductionStrategy = createClass("ReproductionStrategy"); + public final IRI ReproductionStrategy = createClass("ReproductionStrategy"); /** Social behaviour is all about how an animal interacts with members * of its own species. For instance, does it live in a colony or on * its own, does it fight to be top of the pecking order, or does * it try to keep strangers away from its home?*/ - public final URI SocialBehaviour = createClass("SocialBehaviour"); + public final IRI SocialBehaviour = createClass("SocialBehaviour"); /** Generic class defining a biological species. Further Reading: * http://en.wikipedia.org/wiki/Species * http://www.bbc.co.uk/nature/species*/ - public final URI Species = createClass("Species"); + public final IRI Species = createClass("Species"); /** Suborders are an intermediate classification rank - * an order can be split into many closely related suborders. @@ -255,7 +255,7 @@ public class WO extends Vocabulary { * famous carnivorous dinosaurs belong. Further Reading: * http://en.wikipedia.org/wiki/Suborder * http://www.bbc.co.uk/nature/suborder*/ - public final URI Suborder = createClass("Suborder"); + public final IRI Suborder = createClass("Suborder"); /** Subspecies are a rank of classification that is lower * than a species. The differences between subspecies are @@ -269,7 +269,7 @@ public class WO extends Vocabulary { * tiger (Panthera tigris altaica). Further Reading: * http://en.wikipedia.org/wiki/Subspecies * http://www.bbc.co.uk/nature/subspecies*/ - public final URI Subspecies = createClass("Subspecies"); + public final IRI Subspecies = createClass("Subspecies"); /** Superclass is an intermediate classification rank, or * grouping, that sits directly above a class, ranking @@ -278,7 +278,7 @@ public class WO extends Vocabulary { * amphibian, reptile, bird, mammal and dinosaur classes. * Further Reading: http://en.wikipedia.org/wiki/Superclass_(biology) * http://www.bbc.co.uk/nature/superclass*/ - public final URI Superclass = createClass("Superclass"); + public final IRI Superclass = createClass("Superclass"); /** Superfamilies are an intermediate classification rank, * or grouping, that is directly above a family. A @@ -289,7 +289,7 @@ public class WO extends Vocabulary { * of rats, mice, hamsters and gerbils. Further Reading: * http://en.wikipedia.org/wiki/Taxonomic_rank * http://www.bbc.co.uk/nature/superfamily*/ - public final URI Superfamily = createClass("Superfamily"); + public final IRI Superfamily = createClass("Superfamily"); /** Superorders are an intermediate classification rank or * grouping that sit directly above an order. A superorder @@ -299,25 +299,25 @@ public class WO extends Vocabulary { * superorder of them all is Dinosauria - the dinosaurs! * Further Reading: http://en.wikipedia.org/wiki/Superorder * http://www.bbc.co.uk/nature/superorder*/ - public final URI Superorder = createClass("Superorder"); + public final IRI Superorder = createClass("Superorder"); /** Survival strategies include adaptations to changes in . * the organisms environment, including: hibernation, abscission and migration.*/ - public final URI SurvivalStrategy = createClass("SurvivalStrategy"); + public final IRI SurvivalStrategy = createClass("SurvivalStrategy"); /** A taxonomic name, describing the structure and provenance of a taxonomic name.*/ - public final URI TaxonName = createClass("TaxonName"); + public final IRI TaxonName = createClass("TaxonName"); /** Generic concept for a taxonomic rank such as a Genus or Species. * Further Reading: http://en.wikipedia.org/wiki/Taxonomic_rank */ - public final URI TaxonRank= createClass("TaxonRank"); + public final IRI TaxonRank= createClass("TaxonRank"); /** Terrestrial habitats include forests, grasslands, deserts * and rainforests. They are typically defined by factors such * as plant structure (trees and grasses), leaf types (eg broadleaf * and needleleaf), plant spacing (forest, woodland, savanna) and climate.*/ - public final URI TerrestrialHabitat = createClass("TerrestrialHabitat"); + public final IRI TerrestrialHabitat = createClass("TerrestrialHabitat"); /** Tribes are a taxonomic rank that fall between family and genus. * Tribes can also be split in to smaller related groups called subtribes. @@ -327,7 +327,7 @@ public class WO extends Vocabulary { * as a classification rank, for example, bombini is the tribe of bumblebees. * Further Reading: http://en.wikipedia.org/wiki/Tribe_(biology) * http://www.bbc.co.uk/nature/tribe*/ - public final URI Tribe = createClass("Tribe"); + public final IRI Tribe = createClass("Tribe"); ////////////////////////////////////////////////////////// //PROPERTIES @@ -335,126 +335,126 @@ public class WO extends Vocabulary { /** * associates a taxon rank with an adaptation which it displays */ - public final URI adaptation = createProperty("adaptation"); + public final IRI adaptation = createProperty("adaptation"); /** * associates a taxon rank with a class */ - public final URI clazz = createProperty("class"); + public final IRI clazz = createProperty("class"); /** * associates a taxon rank, habitat, species, clip with a collection of which it is a member */ - public final URI collection = createProperty("collection"); + public final IRI collection = createProperty("collection"); /** * associates a taxon rank with a description of a recent assessment of its conservation status */ - public final URI conservationStatus = createProperty("conservationStatus"); + public final IRI conservationStatus = createProperty("conservationStatus"); /** * associates a habitat, ecozone, or taxon rank with a map depicting its distribution or location */ - public final URI distributionMap = createProperty("distributionMap"); + public final IRI distributionMap = createProperty("distributionMap"); /** indicates that a habitat or a taxon rank can be found within an ecozone */ - public final URI ecozone = createProperty("ecozone"); + public final IRI ecozone = createProperty("ecozone"); /** associates a taxon rank with a family */ - public final URI family = createProperty("family"); + public final IRI family = createProperty("family"); /** associates a taxon rank with a genus */ - public final URI genus = createProperty("genus"); + public final IRI genus = createProperty("genus"); /** associates a taxon rank with a habitat in which it grows. * Sub-property of wo:habitat to be used for plants, fungi, etc */ - public final URI growsIn = createProperty("growsIn"); + public final IRI growsIn = createProperty("growsIn"); /** associates a taxon rank with a habitat in which it may typically be found */ - public final URI habitat = createProperty("habitat"); + public final IRI habitat = createProperty("habitat"); /** associates a taxon rank with a infraorder */ - public final URI infraorder = createProperty("infraorder"); + public final IRI infraorder = createProperty("infraorder"); /** associates a taxon rank with a kingdom*/ - public final URI kingdom = createProperty("kingdom"); + public final IRI kingdom = createProperty("kingdom"); /** associates a taxon rank with a habitat in which it lives. * Sub-property of wo:habitat to be used for members of the animal kingdom */ - public final URI livesIn = createProperty("livesIn"); + public final IRI livesIn = createProperty("livesIn"); /** associates a taxon rank with a taxon name */ - public final URI name = createProperty("name"); + public final IRI name = createProperty("name"); /** associates a taxon rank with an order */ - public final URI order = createProperty("order"); + public final IRI order = createProperty("order"); /** associates a taxon rank with a phylum */ - public final URI phylum = createProperty("phylum"); + public final IRI phylum = createProperty("phylum"); /** associates a Conservation Status with a category in the IUCN Red List*/ - public final URI redListStatus = createProperty("redListStatus"); + public final IRI redListStatus = createProperty("redListStatus"); /** associates a taxon rank with a species*/ - public final URI species = createProperty("species"); + public final IRI species = createProperty("species"); /** associates a taxon rank with a subspecies*/ - public final URI subspecies = createProperty("subspecies"); + public final IRI subspecies = createProperty("subspecies"); /** associates a taxon rank with a suborder*/ - public final URI suborder = createProperty("suborder"); + public final IRI suborder = createProperty("suborder"); /** associates a taxon rank with a superclass*/ - public final URI superclass = createProperty("superclass"); + public final IRI superclass = createProperty("superclass"); /** associates a taxon rank with a superfamily*/ - public final URI superfamily = createProperty("superfamily"); + public final IRI superfamily = createProperty("superfamily"); /** associates a taxon rank with a superorder*/ - public final URI superorder = createProperty("superorder"); + public final IRI superorder = createProperty("superorder"); /** associates a taxon rank with a tribe*/ - public final URI tribe = createProperty("tribe"); + public final IRI tribe = createProperty("tribe"); ////////////////////////////////////////////////////////////// //DATATYPE PROPERTIES ////////////////////////////////////////////////////////////// /** Used to specify the name of a class as part of a Taxon Name*/ - public final URI clazzName = createProperty("className"); + public final IRI clazzName = createProperty("className"); /** associates a formal taxon name with a common version. E.g. * Panthera leo might be associated with a common name of 'Lion'. * A given taxon name may have several common names*/ - public final URI commonName = createProperty("commonName"); + public final IRI commonName = createProperty("commonName"); /** Used to specify the name of a family as part of a Taxon Name*/ - public final URI familyName = createProperty("familyName"); + public final IRI familyName = createProperty("familyName"); /** specifies the genus part of a binomial name, allowing this * portion of the name to be explicitly described. Therefore this * property will typically only be used in TaxonNames associated * with species. The property is largely provided as a convenience * to avoid applications having to parse the binomial name.*/ - public final URI genusName = createProperty("genusName"); + public final IRI genusName = createProperty("genusName"); /** Used to specify the name of a infraorder as part of a Taxon Name*/ - public final URI infraorderName = createProperty("infraorderName"); + public final IRI infraorderName = createProperty("infraorderName"); /** Used to specify the name of a kingdom as part of a Taxon Name */ - public final URI kingdomName = createProperty("kingdomName"); + public final IRI kingdomName = createProperty("kingdomName"); /** Used to specify the name of an order as part of a Taxon Name */ - public final URI orderName = createProperty("orderName"); + public final IRI orderName = createProperty("orderName"); /** Used to specify the name of a phylum as part of a Taxon Name */ - public final URI phylumName = createProperty("phylumName"); + public final IRI phylumName = createProperty("phylumName"); /** provides some indication of the population trend associated with an * assessment of a taxon's conversation status. The value of this * property is a simple literal, and is recommended to be one of: * Decreasing, Increasing, Stable, Unknown.*/ - public final URI populationTrend = createProperty("populationTrend"); + public final IRI populationTrend = createProperty("populationTrend"); /** associates a taxon name with its formal scientific name. This * may be a binomial name (e.g. Panthera leo) in the case of a @@ -462,10 +462,10 @@ public class WO extends Vocabulary { * of a name associated with another taxon rank. In formal * taxonomic naming conventions, the scientific name is often * qualified with the source of the name, e.g. Panthera leo (Linnaeus, 1758).*/ - public final URI scientificName = createProperty("scientificName"); + public final IRI scientificName = createProperty("scientificName"); /** associates a short description with a Collection.*/ - public final URI shortDescription = createProperty("shortDescription"); + public final IRI shortDescription = createProperty("shortDescription"); /** specifies the species part of a binomial name, allowing this * portion of the name to be explicitly described. Therefore @@ -473,47 +473,47 @@ public class WO extends Vocabulary { * associated with species. The property is largely provided * as a convenience to avoid applications having to parse the * binomial name.*/ - public final URI speciesName = createProperty("speciesName"); + public final IRI speciesName = createProperty("speciesName"); /** Used to specify the name of a suborder as part of a Taxon Name*/ - public final URI suborderName = createProperty("suborderName"); + public final IRI suborderName = createProperty("suborderName"); /** Used to specify the name of a subspecies as part of a Taxon Name*/ - public final URI subspeciesName = createProperty("subspeciesName"); + public final IRI subspeciesName = createProperty("subspeciesName"); /** Used to specify the name of a superspecies as part of a Taxon Name*/ - public final URI superspeciesName = createProperty("superspeciesName"); + public final IRI superspeciesName = createProperty("superspeciesName"); /** Used to specify the name of a superclass as part of a Taxon Name*/ - public final URI superclassName = createProperty("superclassName"); + public final IRI superclassName = createProperty("superclassName"); /** Used to specify the name of a superfamily as part of a Taxon Name*/ - public final URI superfamilyName = createProperty("superfamilyName"); + public final IRI superfamilyName = createProperty("superfamilyName"); /** Used to specify the name of a superorder as part of a Taxon Name*/ - public final URI superorderName = createProperty("superorderName"); + public final IRI superorderName = createProperty("superorderName"); /** a naming property, associating a formal taxonomic name with a Taxon * Name instance. This property is a parent of a number of sub-properties * that provide more specific terms for denoting names of families, phyla, * species, etc.*/ - public final URI taxonomicName = createProperty("taxonomicName"); + public final IRI taxonomicName = createProperty("taxonomicName"); /** description of the threat(s) that have been identified as part of * the assessment of the Conservation Status of a taxon*/ - public final URI threatDescription = createProperty("threatDescription"); + public final IRI threatDescription = createProperty("threatDescription"); /** Used to specify the name of a tribe as part of a Taxon Name*/ - public final URI tribeName = createProperty("tribeName"); + public final IRI tribeName = createProperty("tribeName"); /** the year in which the conservation status was assessed.*/ - public final URI yearAssessed = createProperty("yearAssessed"); + public final IRI yearAssessed = createProperty("yearAssessed"); - private URI createClass(String name) { + private IRI createClass(String name) { return createClass(NS, name); } - private URI createProperty(String name) { + private IRI createProperty(String name) { return createProperty(NS, name); }
http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/java/org/apache/any23/vocab/XFN.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/any23/vocab/XFN.java b/api/src/main/java/org/apache/any23/vocab/XFN.java index 8ac1b7f..428868d 100644 --- a/api/src/main/java/org/apache/any23/vocab/XFN.java +++ b/api/src/main/java/org/apache/any23/vocab/XFN.java @@ -17,7 +17,7 @@ package org.apache.any23.vocab; -import org.openrdf.model.URI; +import org.eclipse.rdf4j.model.IRI; import java.util.HashMap; import java.util.Map; @@ -41,35 +41,35 @@ public class XFN extends Vocabulary { return instance; } - public final URI contact = createProperty("contact"); - public final URI acquaintance = createProperty("acquaintance"); - public final URI friend = createProperty("friend"); - public final URI met = createProperty("met"); - public final URI coWorker = createProperty("co-worker"); - public final URI colleague = createProperty("colleague"); - public final URI coResident = createProperty("co-resident"); - public final URI neighbor = createProperty("neighbor"); - public final URI child = createProperty("child"); - public final URI parent = createProperty("parent"); - public final URI spouse = createProperty("spouse"); - public final URI kin = createProperty("kin"); - public final URI muse = createProperty("muse"); - public final URI crush = createProperty("crush"); - public final URI date = createProperty("date"); - public final URI sweetheart = createProperty("sweetheart"); - public final URI me = createProperty("me"); - - public final URI mePage = createProperty(NS, "mePage"); - - private Map<String, URI> PeopleXFNProperties; - - private Map<String, URI> HyperlinkXFNProperties; - - public URI getPropertyByLocalName(String localName) { + public final IRI contact = createProperty("contact"); + public final IRI acquaintance = createProperty("acquaintance"); + public final IRI friend = createProperty("friend"); + public final IRI met = createProperty("met"); + public final IRI coWorker = createProperty("co-worker"); + public final IRI colleague = createProperty("colleague"); + public final IRI coResident = createProperty("co-resident"); + public final IRI neighbor = createProperty("neighbor"); + public final IRI child = createProperty("child"); + public final IRI parent = createProperty("parent"); + public final IRI spouse = createProperty("spouse"); + public final IRI kin = createProperty("kin"); + public final IRI muse = createProperty("muse"); + public final IRI crush = createProperty("crush"); + public final IRI date = createProperty("date"); + public final IRI sweetheart = createProperty("sweetheart"); + public final IRI me = createProperty("me"); + + public final IRI mePage = createProperty(NS, "mePage"); + + private Map<String, IRI> PeopleXFNProperties; + + private Map<String, IRI> HyperlinkXFNProperties; + + public IRI getPropertyByLocalName(String localName) { return PeopleXFNProperties.get(localName); } - public URI getExtendedProperty(String localName) { + public IRI getExtendedProperty(String localName) { return HyperlinkXFNProperties.get(localName); } @@ -81,15 +81,15 @@ public class XFN extends Vocabulary { return PeopleXFNProperties.containsKey(localName); } - private URI createProperty(String localName) { + private IRI createProperty(String localName) { if(HyperlinkXFNProperties == null) { - HyperlinkXFNProperties = new HashMap<String, URI>(); + HyperlinkXFNProperties = new HashMap<String, IRI>(); } if(PeopleXFNProperties == null) { - PeopleXFNProperties = new HashMap<String, URI>(); + PeopleXFNProperties = new HashMap<String, IRI>(); } - URI result = createProperty(NS, localName + "-hyperlink"); + IRI result = createProperty(NS, localName + "-hyperlink"); HyperlinkXFNProperties.put(localName, result); result = createProperty(NS, localName); http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/java/org/apache/any23/vocab/XHTML.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/any23/vocab/XHTML.java b/api/src/main/java/org/apache/any23/vocab/XHTML.java index 3cf963b..134b9b2 100644 --- a/api/src/main/java/org/apache/any23/vocab/XHTML.java +++ b/api/src/main/java/org/apache/any23/vocab/XHTML.java @@ -17,7 +17,7 @@ package org.apache.any23.vocab; -import org.openrdf.model.URI; +import org.eclipse.rdf4j.model.IRI; /** * The <a href="http://www.w3.org/1999/xhtml/vocab/">XHTML</a> vocabulary. @@ -35,10 +35,10 @@ public class XHTML extends Vocabulary { return instance; } - public final URI license = createProperty(NS, "license" ); - public final URI meta = createProperty(NS, "meta" ); - public final URI alternate = createProperty(NS, "alternate" ); - public final URI stylesheet = createProperty(NS, "stylesheet"); + public final IRI license = createProperty(NS, "license" ); + public final IRI meta = createProperty(NS, "meta" ); + public final IRI alternate = createProperty(NS, "alternate" ); + public final IRI stylesheet = createProperty(NS, "stylesheet"); private XHTML(){ super(NS); http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/java/org/apache/any23/writer/TripleHandler.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/any23/writer/TripleHandler.java b/api/src/main/java/org/apache/any23/writer/TripleHandler.java index c5b80e5..6d88ed3 100644 --- a/api/src/main/java/org/apache/any23/writer/TripleHandler.java +++ b/api/src/main/java/org/apache/any23/writer/TripleHandler.java @@ -18,16 +18,16 @@ package org.apache.any23.writer; import org.apache.any23.extractor.ExtractionContext; -import org.openrdf.model.Resource; -import org.openrdf.model.URI; -import org.openrdf.model.Value; +import org.eclipse.rdf4j.model.Resource; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.Value; /** * Defines a document based triple handler. */ public interface TripleHandler { - void startDocument(URI documentURI) throws TripleHandlerException; + void startDocument(IRI documentIRI) throws TripleHandlerException; /** * Informs the handler that a new context has been established. @@ -50,14 +50,14 @@ public interface TripleHandler { * @param context extraction context. * @throws TripleHandlerException if there is an error receiving the triple. */ - void receiveTriple(Resource s, URI p, Value o, URI g, ExtractionContext context) throws TripleHandlerException; + void receiveTriple(Resource s, IRI p, Value o, IRI g, ExtractionContext context) throws TripleHandlerException; /** * Invoked with a currently open context, notifies the detection of a * namespace. * * @param prefix namespace prefix. - * @param uri namespace <i>URI</i>. + * @param uri namespace <i>IRI</i>. * @param context namespace context. * @throws TripleHandlerException if there is an error receiving the namespace. */ @@ -80,10 +80,10 @@ public interface TripleHandler { * Informs the handler that the end of the document * has been reached. * - * @param documentURI document URI. + * @param documentIRI document IRI. * @throws TripleHandlerException if there is an error ending the document. */ - void endDocument(URI documentURI) throws TripleHandlerException; + void endDocument(IRI documentIRI) throws TripleHandlerException; /** * Sets the length of the content to be processed. http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/java/org/apache/any23/writer/WriterFactory.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/any23/writer/WriterFactory.java b/api/src/main/java/org/apache/any23/writer/WriterFactory.java index d8b23cc..3012beb 100644 --- a/api/src/main/java/org/apache/any23/writer/WriterFactory.java +++ b/api/src/main/java/org/apache/any23/writer/WriterFactory.java @@ -19,7 +19,7 @@ package org.apache.any23.writer; import java.io.OutputStream; -import org.openrdf.rio.RDFFormat; +import org.eclipse.rdf4j.rio.RDFFormat; /** * @author Peter Ansell [email protected] http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/api/src/main/resources/default-configuration.properties ---------------------------------------------------------------------- diff --git a/api/src/main/resources/default-configuration.properties b/api/src/main/resources/default-configuration.properties index ed0c7ca..d047a83 100644 --- a/api/src/main/resources/default-configuration.properties +++ b/api/src/main/resources/default-configuration.properties @@ -47,11 +47,11 @@ any23.extraction.metadata.domain.per.entity=off # registered the RDFa 1.0 legacy one (org.deri.any23.extractor.rdfa.RDFaExtractor). any23.extraction.rdfa.programmatic=on -# The extraction context URI to be used by the -# SingleDocumentExtraction. If == '?' the document URI will +# The extraction context IRI to be used by the +# SingleDocumentExtraction. If == '?' the document IRI will # be used. It can be overriden by specifying a different # value in ExtractionParameters. -any23.extraction.context.uri=? +any23.extraction.context.iri=? # Any23 Core Plugin Dirs any23.plugin.dirs=./plugins @@ -59,7 +59,7 @@ any23.plugin.dirs=./plugins # Microdata Configuration. # ---- Enables(on)/disables(off) strict Microdata extraction. # If turned off, it uses the any23.microdata.ns.default -# to build URIs for anonymous properties +# to build IRIs for anonymous properties any23.microdata.strict=off # ---- Microdata default namespace. any23.microdata.ns.default=http://schema.org/ http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 3947163..be0b6ba 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.apache.any23</groupId> <artifactId>apache-any23</artifactId> - <version>1.2-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../</relativePath> </parent> @@ -53,11 +53,6 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>apache-any23-nquads</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> <artifactId>apache-any23-test-resources</artifactId> <version>${project.version}</version> <type>test-jar</type> @@ -97,54 +92,51 @@ <!-- BEGIN: Sesame --> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-model</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-model</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-api</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-api</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-turtle</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-jsonld</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-rdfxml</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-turtle</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-ntriples</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-rdfxml</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-rio-trix</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-ntriples</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-repository-sail</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-rio-trix</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-sail-memory</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-repository-sail</artifactId> </dependency> <dependency> - <groupId>org.openrdf.sesame</groupId> - <artifactId>sesame-repository-api</artifactId> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-sail-memory</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.rdf4j</groupId> + <artifactId>rdf4j-repository-api</artifactId> </dependency> <dependency> <groupId>org.semarglproject</groupId> - <artifactId>semargl-sesame</artifactId> + <artifactId>semargl-rdf4j</artifactId> </dependency> <!-- END: Sesame --> - <!-- BEGIN: Misc --> - <dependency> - <groupId>com.github.jsonld-java</groupId> - <artifactId>jsonld-java-sesame</artifactId> - </dependency> - <!-- END: Misc --> - <!-- BEGIN: Apache Commons, this version is hosted in the any23-repository-external repository --> <dependency> http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/Any23.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/Any23.java b/core/src/main/java/org/apache/any23/Any23.java index 7364668..9be8a28 100644 --- a/core/src/main/java/org/apache/any23/Any23.java +++ b/core/src/main/java/org/apache/any23/Any23.java @@ -217,7 +217,7 @@ public class Any23 { if (!httpClientInitialized) { if (userAgent == null) { throw new IOException("Must call " + Any23.class.getSimpleName() + - ".setHTTPUserAgent(String) before extracting from HTTP URI"); + ".setHTTPUserAgent(String) before extracting from HTTP IRI"); } httpClient.init( new DefaultHTTPClientConfiguration(this.getAcceptHeader()) ); httpClientInitialized = true; @@ -248,27 +248,27 @@ public class Any23 { } /** - * <p>Returns the most appropriate {@link DocumentSource} for the given<code>documentURI</code>.</p> - * <p><b>N.B.</b> <code>documentURI's</code> <i>should</i> contain a protocol. + * <p>Returns the most appropriate {@link DocumentSource} for the given<code>documentIRI</code>.</p> + * <p><b>N.B.</b> <code>documentIRI's</code> <i>should</i> contain a protocol. * E.g. <b>http:</b>, <b>https:</b>, <b>file:</b> * </p> * - * @param documentURI the document <i>URI</i>. + * @param documentIRI the document <i>IRI</i>. * @return a new instance of DocumentSource. - * @throws URISyntaxException if an error occurs while parsing the <code>documentURI</code> as a <i>URI</i>. + * @throws URISyntaxException if an error occurs while parsing the <code>documentIRI</code> as a <i>IRI</i>. * @throws IOException if an error occurs while initializing the internal {@link org.apache.any23.http.HTTPClient}. */ - public DocumentSource createDocumentSource(String documentURI) throws URISyntaxException, IOException { - if(documentURI == null) throw new NullPointerException("documentURI cannot be null."); - if (documentURI.toLowerCase().startsWith("file:")) { - return new FileDocumentSource( new File(new URI(documentURI)) ); + public DocumentSource createDocumentSource(String documentIRI) throws URISyntaxException, IOException { + if(documentIRI == null) throw new NullPointerException("documentIRI cannot be null."); + if (documentIRI.toLowerCase().startsWith("file:")) { + return new FileDocumentSource( new File(new URI(documentIRI)) ); } - if (documentURI.toLowerCase().startsWith("http:") || documentURI.toLowerCase().startsWith("https:")) { - return new HTTPDocumentSource(getHTTPClient(), documentURI); + if (documentIRI.toLowerCase().startsWith("http:") || documentIRI.toLowerCase().startsWith("https:")) { + return new HTTPDocumentSource(getHTTPClient(), documentIRI); } throw new IllegalArgumentException( - String.format("Unsupported protocol for document URI: '%s' . " - + "Check that document URI contains a protocol.", documentURI) + String.format("Unsupported protocol for document IRI: '%s' . " + + "Check that document IRI contains a protocol.", documentIRI) ); } @@ -309,12 +309,12 @@ public class Any23 { /** * Performs metadata extraction on the <code>in</code> string - * associated to the <code>documentURI</code> URI, declaring + * associated to the <code>documentIRI</code> IRI, declaring * <code>contentType</code> and <code>encoding</code>. * The generated events are sent to the specified <code>outputHandler</code>. * * @param in raw data to be analyzed. - * @param documentURI URI from which the raw data has been extracted. + * @param documentIRI IRI from which the raw data has been extracted. * @param contentType declared data content type. * @param encoding declared data encoding. * @param outputHandler handler responsible for collecting of the extracted metadata. @@ -324,29 +324,29 @@ public class Any23 { */ public ExtractionReport extract( String in, - String documentURI, + String documentIRI, String contentType, String encoding, TripleHandler outputHandler ) throws IOException, ExtractionException { - return extract(new StringDocumentSource(in, documentURI, contentType, encoding), outputHandler); + return extract(new StringDocumentSource(in, documentIRI, contentType, encoding), outputHandler); } /** * Performs metadata extraction on the <code>in</code> string - * associated to the <code>documentURI</code> URI, sending the generated + * associated to the <code>documentIRI</code> IRI, sending the generated * events to the specified <code>outputHandler</code>. * * @param in raw data to be analyzed. - * @param documentURI URI from which the raw data has been extracted. + * @param documentIRI IRI from which the raw data has been extracted. * @param outputHandler handler responsible for collecting of the extracted metadata. * @return <code>true</code> if some extraction occurred, <code>false</code> otherwise. * @throws IOException if there is an error reading the {@link org.apache.any23.source.DocumentSource} * @throws org.apache.any23.extractor.ExtractionException if there is an error during extraction */ - public ExtractionReport extract(String in, String documentURI, TripleHandler outputHandler) + public ExtractionReport extract(String in, String documentIRI, TripleHandler outputHandler) throws IOException, ExtractionException { - return extract(new StringDocumentSource(in, documentURI), outputHandler); + return extract(new StringDocumentSource(in, documentIRI), outputHandler); } /** @@ -365,40 +365,40 @@ public class Any23 { } /** - * Performs metadata extraction from the content of the given <code>documentURI</code> + * Performs metadata extraction from the content of the given <code>documentIRI</code> * sending the generated events to the specified <code>outputHandler</code>. - * If the <i>URI</i> is replied with a redirect, the last will be followed. + * If the <i>IRI</i> is replied with a redirect, the last will be followed. * * @param eps the parameters to be applied to the extraction. - * @param documentURI the URI from which retrieve document. + * @param documentIRI the IRI from which retrieve document. * @param outputHandler handler responsible for collecting of the extracted metadata. * @return <code>true</code> if some extraction occurred, <code>false</code> otherwise. * @throws IOException if there is an error reading the {@link org.apache.any23.source.DocumentSource} * @throws org.apache.any23.extractor.ExtractionException if there is an error during extraction */ - public ExtractionReport extract(ExtractionParameters eps, String documentURI, TripleHandler outputHandler) + public ExtractionReport extract(ExtractionParameters eps, String documentIRI, TripleHandler outputHandler) throws IOException, ExtractionException { try { - return extract(eps, createDocumentSource(documentURI), outputHandler); + return extract(eps, createDocumentSource(documentIRI), outputHandler); } catch (URISyntaxException ex) { - throw new ExtractionException("Error while extracting data from document URI.", ex); + throw new ExtractionException("Error while extracting data from document IRI.", ex); } } /** - * Performs metadata extraction from the content of the given <code>documentURI</code> + * Performs metadata extraction from the content of the given <code>documentIRI</code> * sending the generated events to the specified <code>outputHandler</code>. - * If the <i>URI</i> is replied with a redirect, the last will be followed. + * If the <i>IRI</i> is replied with a redirect, the last will be followed. * - * @param documentURI the URI from which retrieve document. + * @param documentIRI the IRI from which retrieve document. * @param outputHandler handler responsible for collecting of the extracted metadata. * @return <code>true</code> if some extraction occurred, <code>false</code> otherwise. * @throws IOException if there is an error reading the {@link org.apache.any23.source.DocumentSource} * @throws org.apache.any23.extractor.ExtractionException if there is an error during extraction */ - public ExtractionReport extract(String documentURI, TripleHandler outputHandler) + public ExtractionReport extract(String documentIRI, TripleHandler outputHandler) throws IOException, ExtractionException { - return extract((ExtractionParameters) null, documentURI, outputHandler); + return extract((ExtractionParameters) null, documentIRI, outputHandler); } /** http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/cli/MicrodataParser.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/cli/MicrodataParser.java b/core/src/main/java/org/apache/any23/cli/MicrodataParser.java index 9a593e4..19c59bf 100644 --- a/core/src/main/java/org/apache/any23/cli/MicrodataParser.java +++ b/core/src/main/java/org/apache/any23/cli/MicrodataParser.java @@ -67,7 +67,7 @@ public class MicrodataParser implements Tool { documentInputInputStream = documentSource.openInputStream(); final TagSoupParser tagSoupParser = new TagSoupParser( documentInputInputStream, - documentSource.getDocumentURI() + documentSource.getDocumentIRI() ); org.apache.any23.extractor.microdata.MicrodataParser.getMicrodataAsJSON(tagSoupParser.getDOM(), System.out); } finally { @@ -84,7 +84,7 @@ public class MicrodataParser implements Tool { try { return new HTTPDocumentSource(DefaultHTTPClient.createInitializedHTTPClient(), value); } catch ( URISyntaxException e ) { - throw new ParameterException("Invalid source URI: '" + value + "'"); + throw new ParameterException("Invalid source IRI: '" + value + "'"); } } final Matcher fileMatcher = FILE_DOCUMENT_PATTERN.matcher(value); http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/cli/MimeDetector.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/cli/MimeDetector.java b/core/src/main/java/org/apache/any23/cli/MimeDetector.java index 87148ca..c9072cb 100644 --- a/core/src/main/java/org/apache/any23/cli/MimeDetector.java +++ b/core/src/main/java/org/apache/any23/cli/MimeDetector.java @@ -67,7 +67,7 @@ public class MimeDetector implements Tool{ final DocumentSource documentSource = document.get(0); final MIMETypeDetector detector = new TikaMIMETypeDetector(); final MIMEType mimeType = detector.guessMIMEType( - documentSource.getDocumentURI(), + documentSource.getDocumentIRI(), documentSource.openInputStream(), MIMEType.parse(documentSource.getContentType()) ); @@ -90,7 +90,7 @@ public class MimeDetector implements Tool{ try { return new HTTPDocumentSource(client, document); } catch ( URISyntaxException e ) { - throw new IllegalArgumentException("Invalid source URI: '" + document + "'"); + throw new IllegalArgumentException("Invalid source IRI: '" + document + "'"); } } throw new IllegalArgumentException("Unsupported protocol for document " + document); http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/cli/PluginVerifier.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/cli/PluginVerifier.java b/core/src/main/java/org/apache/any23/cli/PluginVerifier.java index 70b72f5..a747b49 100644 --- a/core/src/main/java/org/apache/any23/cli/PluginVerifier.java +++ b/core/src/main/java/org/apache/any23/cli/PluginVerifier.java @@ -24,8 +24,6 @@ import org.apache.any23.extractor.ExtractorFactory; import org.apache.any23.mime.MIMEType; import org.apache.any23.plugin.Any23PluginManager; import org.apache.any23.plugin.Author; -import org.apache.any23.plugin.ExtractorPlugin; - import java.io.File; import java.io.PrintStream; import java.util.Collection; http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/cli/Rover.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/cli/Rover.java b/core/src/main/java/org/apache/any23/cli/Rover.java index 1c77860..26a8663 100644 --- a/core/src/main/java/org/apache/any23/cli/Rover.java +++ b/core/src/main/java/org/apache/any23/cli/Rover.java @@ -74,8 +74,8 @@ public class Rover implements Tool { ) private PrintStream outputStream = System.out; - @Parameter(description = "input URIs {<url>|<file>}+", converter = ArgumentToURIConverter.class) - protected List<String> inputURIs = new LinkedList<String>(); + @Parameter(description = "input IRIs {<url>|<file>}+", converter = ArgumentToIRIConverter.class) + protected List<String> inputIRIs = new LinkedList<String>(); @Parameter(names = { "-e", "--extractors" }, description = "a comma-separated list of extractors, e.g. rdf-xml,rdf-turtle") private List<String> extractors = new LinkedList<String>(); @@ -158,7 +158,7 @@ public class Rover implements Tool { : new ExtractionParameters(configuration, ValidationMode.None , nestingDisabled); if (defaultns != null) { - extractionParameters.setProperty(ExtractionParameters.EXTRACTION_CONTEXT_URI_PROPERTY, + extractionParameters.setProperty(ExtractionParameters.EXTRACTION_CONTEXT_IRI_PROPERTY, defaultns); } @@ -195,7 +195,7 @@ public class Rover implements Tool { } public void run() throws Exception { - if (inputURIs.isEmpty()) { + if (inputIRIs.isEmpty()) { throw new IllegalArgumentException("Expected at least 1 argument."); } @@ -205,8 +205,8 @@ public class Rover implements Tool { try { final long start = System.currentTimeMillis(); - for (String inputURI : inputURIs) { - DocumentSource source = any23.createDocumentSource(inputURI); + for (String inputIRI : inputIRIs) { + DocumentSource source = any23.createDocumentSource(inputIRI); performExtraction( source ); } @@ -223,7 +223,7 @@ public class Rover implements Tool { } } - public static final class ArgumentToURIConverter implements IStringConverter<String> { + public static final class ArgumentToIRIConverter implements IStringConverter<String> { @Override public String convert(String uri) { @@ -232,7 +232,7 @@ public class Rover implements Tool { try { return new URL(uri).toString(); } catch (MalformedURLException murle) { - throw new ParameterException(format("Invalid URI: '%s': %s", uri, murle.getMessage())); + throw new ParameterException(format("Invalid IRI: '%s': %s", uri, murle.getMessage())); } } http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/cli/VocabPrinter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/cli/VocabPrinter.java b/core/src/main/java/org/apache/any23/cli/VocabPrinter.java index 70bf16f..7fde887 100644 --- a/core/src/main/java/org/apache/any23/cli/VocabPrinter.java +++ b/core/src/main/java/org/apache/any23/cli/VocabPrinter.java @@ -18,7 +18,9 @@ package org.apache.any23.cli; import org.apache.any23.vocab.RDFSchemaUtils; -import org.openrdf.rio.RDFFormat; +import org.eclipse.rdf4j.rio.RDFFormat; +import org.eclipse.rdf4j.rio.RDFWriterRegistry; +import org.eclipse.rdf4j.rio.Rio; import com.beust.jcommander.IStringConverter; import com.beust.jcommander.Parameter; @@ -44,12 +46,7 @@ public class VocabPrinter implements Tool { @Override public RDFFormat convert(String value) { - try { - return RDFFormat.valueOf(value); - } catch (Throwable t) { - throw new IllegalArgumentException("Unknown format [" + value - + "'"); - } + return RDFWriterRegistry.getInstance().getFileFormatForMIMEType(value).orElseThrow(Rio.unsupportedFormat(value)); } } http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/extractor/ExampleInputOutput.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/ExampleInputOutput.java b/core/src/main/java/org/apache/any23/extractor/ExampleInputOutput.java index f5caa82..c640699 100644 --- a/core/src/main/java/org/apache/any23/extractor/ExampleInputOutput.java +++ b/core/src/main/java/org/apache/any23/extractor/ExampleInputOutput.java @@ -65,12 +65,12 @@ public class ExampleInputOutput { return new String(MemCopyFactory.toByteArray(in), "utf-8"); } - public String getExampleURI() { + public String getExampleIRI() { if (factory.getExampleInput() == null) { return null; } if (isBlindExtractor()) { - return factory.getExampleInput(); // Should be a URI. + return factory.getExampleInput(); // Should be a IRI. } return "http://example.com/"; } @@ -82,7 +82,7 @@ public class ExampleInputOutput { ByteArrayOutputStream out = new ByteArrayOutputStream(); TripleHandler writer = new TurtleWriter(out); new SingleDocumentExtraction( - new StringDocumentSource(getExampleInput(), getExampleURI()), + new StringDocumentSource(getExampleInput(), getExampleIRI()), factory, writer).run(); try { http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/extractor/ExtractionResultImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/ExtractionResultImpl.java b/core/src/main/java/org/apache/any23/extractor/ExtractionResultImpl.java index c587ddc..be411e6 100644 --- a/core/src/main/java/org/apache/any23/extractor/ExtractionResultImpl.java +++ b/core/src/main/java/org/apache/any23/extractor/ExtractionResultImpl.java @@ -21,10 +21,10 @@ import org.apache.any23.extractor.html.MicroformatExtractor; import org.apache.any23.rdf.Prefixes; import org.apache.any23.writer.TripleHandler; import org.apache.any23.writer.TripleHandlerException; -import org.openrdf.model.BNode; -import org.openrdf.model.Resource; -import org.openrdf.model.URI; -import org.openrdf.model.Value; +import org.eclipse.rdf4j.model.BNode; +import org.eclipse.rdf4j.model.Resource; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.Value; import java.io.PrintStream; import java.util.ArrayList; @@ -118,6 +118,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { return issues.size(); } + @Override public void printReport(PrintStream ps) { ps.print(String.format("Context: %s [errors: %d] {\n", context, getIssuesCount())); for (Issue issue : issues) { @@ -131,10 +132,12 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { ps.print("}\n"); } + @Override public Collection<Issue> getIssues() { return issues.isEmpty() ? Collections.<Issue>emptyList() : Collections.unmodifiableList(issues); } + @Override public ExtractionResult openSubResult(ExtractionContext context) { final String contextID = context.getUniqueID(); if (knownContextIDs.contains(contextID)) { @@ -152,7 +155,8 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { return context; } - public void writeTriple(Resource s, URI p, Value o, URI g) { + @Override + public void writeTriple(Resource s, IRI p, Value o, IRI g) { if (s == null || p == null || o == null) return; // Check for misconstructed literals or BNodes, Sesame does not catch this. if (s.stringValue() == null || p.stringValue() == null || o.stringValue() == null) { @@ -169,10 +173,12 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { } } - public void writeTriple(Resource s, URI p, Value o) { + @Override + public void writeTriple(Resource s, IRI p, Value o) { writeTriple(s, p, o, null); } + @Override public void writeNamespace(String prefix, String uri) { checkOpen(); try { @@ -185,10 +191,12 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { } } - public void notifyIssue(IssueLevel level, String msg, int row, int col) { + @Override + public void notifyIssue(IssueLevel level, String msg, long row, long col) { issues.add(new Issue(level, msg, row, col)); } + @Override public void close() { if (isClosed) return; isClosed = true; @@ -215,7 +223,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { Prefixes prefixes = extractor.getDescription().getPrefixes(); for (String prefix : prefixes.allPrefixes()) { try { - tripleHandler.receiveNamespace(prefix, prefixes.getNamespaceURIFor(prefix), context); + tripleHandler.receiveNamespace(prefix, prefixes.getNamespaceIRIFor(prefix), context); } catch (TripleHandlerException e) { throw new RuntimeException(String.format("Error while writing namespace %s", prefix), e @@ -228,6 +236,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { } } + @Override public void addResourceRoot(String[] path, Resource root, Class<? extends MicroformatExtractor> extractor) { if(resourceRoots == null) { resourceRoots = new ArrayList<ResourceRoot>(); @@ -235,6 +244,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { resourceRoots.add( new ResourceRoot(path, root, extractor) ); } + @Override public List<ResourceRoot> getResourceRoots() { List<ResourceRoot> allRoots = new ArrayList<ResourceRoot>(); if(resourceRoots != null) { @@ -249,6 +259,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { return allRoots; } + @Override public void addPropertyPath( Class<? extends MicroformatExtractor> extractor, Resource propertySubject, @@ -262,6 +273,7 @@ public class ExtractionResultImpl implements TagSoupExtractionResult { propertyPaths.add( new PropertyPath(path, propertySubject, property, object, extractor) ); } + @Override public List<PropertyPath> getPropertyPaths() { List<PropertyPath> allPaths = new ArrayList<PropertyPath>(); if(propertyPaths != null) { http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/extractor/ExtractorRegistryImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/ExtractorRegistryImpl.java b/core/src/main/java/org/apache/any23/extractor/ExtractorRegistryImpl.java index 5175f8c..736e6bb 100644 --- a/core/src/main/java/org/apache/any23/extractor/ExtractorRegistryImpl.java +++ b/core/src/main/java/org/apache/any23/extractor/ExtractorRegistryImpl.java @@ -30,7 +30,7 @@ import java.util.List; * Singleton class acting as a register for all the various * {@link Extractor}. */ -public class ExtractorRegistryImpl extends info.aduna.lang.service.ServiceRegistry<String, ExtractorFactory> implements ExtractorRegistry { +public class ExtractorRegistryImpl extends org.eclipse.rdf4j.common.lang.service.ServiceRegistry<String, ExtractorFactory> implements ExtractorRegistry { /** * Public constructor for ExtractorRegistryImpl. Should normally call getInstance. @@ -116,7 +116,7 @@ public class ExtractorRegistryImpl extends info.aduna.lang.service.ServiceRegist @Override public void unregister(String name) { if(this.has(name)) { - this.remove(this.get(name)); + this.remove(this.get(name).get()); } } @@ -130,11 +130,8 @@ public class ExtractorRegistryImpl extends info.aduna.lang.service.ServiceRegist * {@link ExtractorFactory} associated to the provided name. */ @Override - public ExtractorFactory<?> getFactory(String name) { - ExtractorFactory<?> result = this.get(name); - if (result == null) { - throw new IllegalArgumentException("Unregistered extractor name: " + name); - } + public ExtractorFactory<?> getFactory(final String name) { + ExtractorFactory<?> result = this.get(name).orElseThrow(() -> new IllegalArgumentException("Unregistered extractor name: " + name)); return result; } http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/extractor/SingleDocumentExtraction.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/SingleDocumentExtraction.java b/core/src/main/java/org/apache/any23/extractor/SingleDocumentExtraction.java index e496755..8cd33dd 100644 --- a/core/src/main/java/org/apache/any23/extractor/SingleDocumentExtraction.java +++ b/core/src/main/java/org/apache/any23/extractor/SingleDocumentExtraction.java @@ -42,10 +42,9 @@ import org.apache.any23.writer.TripleHandlerException; import org.apache.any23.extractor.Extractor.BlindExtractor; import org.apache.any23.extractor.Extractor.ContentExtractor; import org.apache.any23.extractor.Extractor.TagSoupDOMExtractor; -import org.openrdf.model.BNode; -import org.openrdf.model.URI; -import org.openrdf.model.impl.URIImpl; -import org.openrdf.model.impl.ValueFactoryImpl; +import org.eclipse.rdf4j.model.BNode; +import org.eclipse.rdf4j.model.IRI; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,7 +79,7 @@ public class SingleDocumentExtraction { private final DocumentSource in; - private URI documentURI; + private IRI documentIRI; private final ExtractorGroup extractors; @@ -208,17 +207,17 @@ public class SingleDocumentExtraction { extractionParameters = ExtractionParameters.newDefault(configuration); } - final String contextURI = extractionParameters.getProperty(ExtractionParameters.EXTRACTION_CONTEXT_URI_PROPERTY); + final String contextIRI = extractionParameters.getProperty(ExtractionParameters.EXTRACTION_CONTEXT_IRI_PROPERTY); ensureHasLocalCopy(); try { - this.documentURI = new Any23ValueFactoryWrapper( - ValueFactoryImpl.getInstance() - ).createURI( "?".equals(contextURI) ? in.getDocumentURI() : contextURI); + this.documentIRI = new Any23ValueFactoryWrapper( + SimpleValueFactory.getInstance() + ).createIRI( "?".equals(contextIRI) ? in.getDocumentIRI() : contextIRI); } catch (Exception ex) { - throw new IllegalArgumentException("Invalid URI: " + in.getDocumentURI(), ex); + throw new IllegalArgumentException("Invalid IRI: " + in.getDocumentIRI(), ex); } if(log.isInfoEnabled()) { - log.info("Processing " + this.documentURI); + log.info("Processing " + this.documentIRI); } filterExtractorsByMIMEType(); @@ -228,16 +227,16 @@ public class SingleDocumentExtraction { sb.append(factory.getExtractorName()); sb.append(' '); } - sb.append("match ").append(documentURI); + sb.append("match ").append(documentIRI); log.debug(sb.toString()); } // Invoke all extractors. try { - output.startDocument(documentURI); + output.startDocument(documentIRI); } catch (TripleHandlerException e) { - log.error(String.format("Error starting document with URI %s", documentURI)); - throw new ExtractionException(String.format("Error starting document with URI %s", documentURI), + log.error(String.format("Error starting document with IRI %s", documentIRI)); + throw new ExtractionException(String.format("Error starting document with IRI %s", documentIRI), e ); } @@ -282,7 +281,7 @@ public class SingleDocumentExtraction { } catch (TripleHandlerException e) { throw new ExtractionException( String.format( - "Error while adding extraction metadata triples document with URI %s", documentURI + "Error while adding extraction metadata triples document with IRI %s", documentIRI ), e ); @@ -290,10 +289,10 @@ public class SingleDocumentExtraction { } try { - output.endDocument(documentURI); + output.endDocument(documentIRI); } catch (TripleHandlerException e) { - log.error(String.format("Error ending document with URI %s", documentURI)); - throw new ExtractionException(String.format("Error ending document with URI %s", documentURI), + log.error(String.format("Error ending document with IRI %s", documentIRI)); + throw new ExtractionException(String.format("Error ending document with IRI %s", documentIRI), e ); } @@ -421,7 +420,7 @@ public class SingleDocumentExtraction { } ensureHasLocalCopy(); detectedMIMEType = detector.guessMIMEType( - java.net.URI.create(documentURI.stringValue()).getPath(), + java.net.URI.create(documentIRI.stringValue()).getPath(), localDocumentSource.openInputStream(), MIMEType.parse(localDocumentSource.getContentType()) ); @@ -445,19 +444,19 @@ public class SingleDocumentExtraction { final Extractor<?> extractor ) throws ExtractionException, IOException, ValidatorException { if(log.isDebugEnabled()) { - log.debug("Running {} on {}", extractor.getDescription().getExtractorName(), documentURI); + log.debug("Running {} on {}", extractor.getDescription().getExtractorName(), documentIRI); } long startTime = System.currentTimeMillis(); final ExtractionContext extractionContext = new ExtractionContext( extractor.getDescription().getExtractorName(), - documentURI, + documentIRI, documentLanguage ); final ExtractionResultImpl extractionResult = new ExtractionResultImpl(extractionContext, extractor, output); try { if (extractor instanceof BlindExtractor) { final BlindExtractor blindExtractor = (BlindExtractor) extractor; - blindExtractor.run(extractionParameters, extractionContext, documentURI, extractionResult); + blindExtractor.run(extractionParameters, extractionContext, documentIRI, extractionResult); } else if (extractor instanceof ContentExtractor) { ensureHasLocalCopy(); final ContentExtractor contentExtractor = (ContentExtractor) extractor; @@ -542,7 +541,7 @@ public class SingleDocumentExtraction { is.reset(); final TagSoupParser tagSoupParser = new TagSoupParser( is, - documentURI.stringValue(), + documentIRI.stringValue(), candidateEncoding ); if(extractionParameters.isValidate()) { @@ -606,10 +605,10 @@ public class SingleDocumentExtraction { // Add source Web domains to every resource root. String domain; try { - domain = new java.net.URI(in.getDocumentURI()).getHost(); + domain = new java.net.URI(in.getDocumentIRI()).getHost(); } catch (URISyntaxException urise) { throw new IllegalArgumentException( - "An error occurred while extracting the host from the document URI.", + "An error occurred while extracting the host from the document IRI.", urise ); } @@ -618,7 +617,7 @@ public class SingleDocumentExtraction { output.receiveTriple( resourceRoot.getRoot(), vSINDICE.getProperty(SINDICE.DOMAIN), - ValueFactoryImpl.getInstance().createLiteral(domain), + SimpleValueFactory.getInstance().createLiteral(domain), null, context ); @@ -641,7 +640,7 @@ public class SingleDocumentExtraction { private ExtractionContext createExtractionContext() { return new ExtractionContext( "consolidation-extractor", - documentURI, + documentIRI, UUID.randomUUID().toString() ); } @@ -694,7 +693,7 @@ public class SingleDocumentExtraction { * </ul> * @param resourceRoots list of RDF nodes representing roots of * extracted microformat graphs and the corresponding HTML paths. - * @param propertyPaths list of RDF nodes representing property subjects, property URIs and the HTML paths + * @param propertyPaths list of RDF nodes representing property subjects, property IRIs and the HTML paths * from which such properties have been extracted. * @param addDomainTriples * @param output a triple handler event collector. @@ -713,7 +712,7 @@ public class SingleDocumentExtraction { output.openContext(context); } catch (TripleHandlerException e) { throw new ExtractionException( - String.format("Error starting document with URI %s", documentURI), + String.format("Error starting document with IRI %s", documentIRI), e ); } @@ -761,7 +760,7 @@ public class SingleDocumentExtraction { output.openContext(context); } catch (TripleHandlerException e) { throw new ExtractionException( - String.format("Error starting document with URI %s", documentURI), + String.format("Error starting document with IRI %s", documentIRI), e ); } @@ -793,9 +792,9 @@ public class SingleDocumentExtraction { // adding extraction date String xsdDateTimeNow = RDFUtils.toXSDDateTime(new Date()); output.receiveTriple( - new URIImpl(documentURI.toString()), + SimpleValueFactory.getInstance().createIRI(documentIRI.toString()), vSINDICE.getProperty(SINDICE.DATE), - ValueFactoryImpl.getInstance().createLiteral(xsdDateTimeNow), + SimpleValueFactory.getInstance().createLiteral(xsdDateTimeNow), null, context ); @@ -809,9 +808,9 @@ public class SingleDocumentExtraction { } } output.receiveTriple( - new URIImpl(documentURI.toString()), + SimpleValueFactory.getInstance().createIRI(documentIRI.toString()), vSINDICE.getProperty(SINDICE.SIZE), - ValueFactoryImpl.getInstance().createLiteral(numberOfTriples + 1), // the number of triples plus itself + SimpleValueFactory.getInstance().createLiteral(numberOfTriples + 1), // the number of triples plus itself null, context ); http://git-wip-us.apache.org/repos/asf/any23/blob/445d13ab/core/src/main/java/org/apache/any23/extractor/TagSoupExtractionResult.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/TagSoupExtractionResult.java b/core/src/main/java/org/apache/any23/extractor/TagSoupExtractionResult.java index cd122db..c228dd9 100644 --- a/core/src/main/java/org/apache/any23/extractor/TagSoupExtractionResult.java +++ b/core/src/main/java/org/apache/any23/extractor/TagSoupExtractionResult.java @@ -18,8 +18,8 @@ package org.apache.any23.extractor; import org.apache.any23.extractor.html.MicroformatExtractor; -import org.openrdf.model.BNode; -import org.openrdf.model.Resource; +import org.eclipse.rdf4j.model.BNode; +import org.eclipse.rdf4j.model.Resource; import java.util.Arrays; import java.util.List; @@ -56,7 +56,7 @@ public interface TagSoupExtractionResult extends ExtractionResult { * * @param extractor the identifier of the extractor responsible for retrieving such property. * @param propertySubject the subject of the property. - * @param property the property URI. + * @param property the property IRI. * @param object the property object if any, <code>null</code> otherwise. * @param path the path of the <i>HTML</i> node from which the property literal has been extracted. */
