Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

PrefixedName



The PrefixedName allows to declare a type in a SPARQL triple.

This can be used in:
  • A Class type
  • A property name
The PrefixedName can be used as a key in a Map, a Set, a SortedMap, or a SortedSet.

Constructors

There are several constructors for a PrefixedName:
  • A constructor using two String arguments for the prefix and the name
  • A constructor using a request and an unique String
  • A constructor using an unique String

Constructor using two Strings

The PrefixedName(String prefix, String name) constructor uses two String arguments allowing to specify the PrefixedName with the prefix and the name.

For example here we create a prefixed name which represents people:Person.
   PrefixedName prefixed = new PrefixedName("people", "Person");

Constructor using a request and an unique String

The PrefixedName(ISparqlRequestGroup request, String name) constructor uses two arguments:
  • The request on which the PrefixedName will be created
  • The name of the Class or the properrty
If the name contain a ":" character, it will be used to separate the prefix and the name.

If the name does not contain a ":" character, the default prefix of the request will be used[1]
See ISparqlRequestGroup.getDefaultPrefix() for more information


For example here we create a prefixed name which represents people:Person.
   SparqlRequest request = new SparqlRequest("people");
   PrefixedName prefixed = new PrefixedName(request, "Person");
Here we create a prefixed name which represents friends:Person.
   SparqlRequest request = new SparqlRequest("people");
   PrefixedName prefixed = new PrefixedName(request, "friends:Person");

Constructor using an unique String

The PrefixedName(String name) constructor uses one String arguments allowing to specify the PrefixedName.

If the name contain a ":" character, it will be used to separate the prefix and the name.

If the name does not contain a ":" character, an empty prefix ("") will be used.

For example here we create a prefixed name which represents people:Person.
   SparqlRequest request = new SparqlRequest("people");
   PrefixedName prefixed = new PrefixedName(request, "Person");
Here we create a prefixed name which represents :Person.
   PrefixedName prefixed = new PrefixedName("Person");
Here we create a prefixed name which represents friends:Person.
   PrefixedName prefixed = new PrefixedName("friends:Person");

Using PrefixedNames as keys

Many of the constructs defined in the SPARQLRequest use PrefixedName as keys.

For example:
   SparqlRequest request = new SparqlRequest("sitac");
   request.addSelect("zone");
   request.addType("zone", "TaskZone");   
Have the following result:
   SELECT ?zone
   WHERE {
      ?zone rdf:type sitac:TaskZone .
   }
The request.getWhereExpressions() method will return a List with one WhereExpression.

The unique element will be a WhereExpression with:
  • The zone variable
  • The sitac:TaskZonePropertyDecl for the element

Notes

  1. ^ See ISparqlRequestGroup.getDefaultPrefix() for more information

See also


Categories: Requestcreation

Copyright 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help